// AIWorkb.bcpl // Alto - 1822 Interface Test Program // L. Stewart last modified: January 4, 1981 6:10 PM // This module contains support procedures get "AIMenuDefs.d" get "AIMenuNames.d" get "AIEditMenuNames.d" get "AIHW.d" get "AItest.d" external //Incoming Procedures from Packages [ Block //Context package CreateStringStream //Strings package PutTemplate //Template package Dismiss //Altotimer package ReadPackedRAM //Packed Ram package Random //Random number gen package SetBLV //LoadRam package ] external //OS procedures [ Closes; Gets; OpenFile; StartIO; Wss; Ws; ShowDisplayStream Endofs ] (1024) external //Incoming Procedures [ SetInterruptMasks //from AIWork ]  external //Outgoing Procedures [ WriteCStat PutBoxTemplate GetBoxNumber GetBoxString BlinkBox EditPacket SetResults PrintBuffers LoaduCode SilentBoot Update Type Contents Cleanup SetInterrupts CheckBuffers ] external //Incoming OS Statics [ keys ] external //Incoming Statics [ iBuf //from AIWork oBuf BufSize cb CMask //from AITest IMask OMask cInterrupt iInterrupt oInterrupt red yellow blue Menu workS menuStream menuS Blast IMPNop //from AIComm PRUTop IMPEchoLeader PRUEchoLeader ] external //Outgoing Statics (in AIWorkb.bcpl) [ PacketType //Imp?, Pru?, or what PacketLength //echo test packet size BufferPrintCount // PrintBuffers uCodeFname //Name of packed Ram file SBootVector //Boot Vector updateInterval //Pinging process AutoUpdateSwitch PacketPattern //echo test data pattern PacketLoopCount //test repititions cIntSwitch //Interrupt enables iIntSwitch oIntSwitch eMenuData //Edit menu handle ] static [ PacketType = typeRandom PacketLength = 12 BufferPrintCount = 0 uCodeFname SBootVector = #177736 // SilentBoot /task 5 updateInterval = 10 //Pinging process (tenths of seconds) AutoUpdateSwitch = true PacketLoopCount = 1 PacketPattern = #170360 cIntSwitch = false // interrupts on completion iIntSwitch = false oIntSwitch = false ] static [ eMenuData index M Msel ] let WriteCStat(stat;numargs na) be [ PutBoxTemplate(Menu!ICountv,"#$6UF0O",cb>>CB.InputPointer-iBuf) PutBoxTemplate(Menu!OCountv,"#$6UF0O",cb>>CB.OutputPointer-oBuf) PutBoxTemplate(Menu!IPostv,"#$6UF0O",cb>>CB.InputPost) PutBoxTemplate(Menu!OPostv,"#$6UF0O",cb>>CB.OutputPost) PutBoxTemplate(Menu!CPostv,"#$6UF0O",cb>>CB.ControlPost) test na le 0 ifso [ FlipBox(Menu!status1,0) FlipBox(Menu!status2,0) FlipBox(Menu!status3,0) ] ifnot [ PutBoxTemplate(Menu!status1,stat<>STRING.length = 0 [ let length = string>>STRING.length while Endofs(keys) do [ Block() if Blast break ] let char = Blast ? $*177,Gets(keys) switchon char into [ case $*n: // carriage return [ if first then docase $*177 break ] case $*177: //break [ string = oldstring PutBoxTemplate(box,"$S",string) break ] case $*010: //backspace [ if length gr 0 then string>>STRING.length = length-1 endcase ] case $.: [ if length ls 16 then string>>STRING.length = length+1 string>>STRING.char^(length+1) = char endcase ] default: [ if ((char ge $A)&(char le $Z)) docase $. if ((char ge $a)&(char le $z)) docase $. if ((char ge $0)&(char le $9)) docase $. BlinkBox(box,20) endcase ] ] PutBoxTemplate(box,"$S",string) first = false ] repeat ] and BlinkBox(box,time) be [ FlipBox(box) Dismiss(time) FlipBox(box) ] and EditPacket() be [ let buf,len = nil,nil let r,y,b = nil,nil,nil if blue return M = eMenuData!0 ShowDisplayStream(menuStream,DSbelow,menuS) until Blast do [ Block() Msel = ScanMenu(M,0,true) r = (Msel & mred) ne 0 y = (Msel & myellow) ne 0 b = (Msel & mblue) ne 0 Msel = (Msel & #377) switchon (Msel) into [ case EPrint: PrintBuffers(r,y,b); endcase case EIBuffer: buf = iBuf;len = PacketLength; docase EAdr case EOBuffer: buf = oBuf;len = PacketLength; docase EAdr case EIMPNop: buf = IMPNop;len = IMPLeaderlen; docase EAdr case EIMPEcho: buf = IMPEchoLeader;len = IMPLeaderlen; docase EAdr case EPRUEcho: buf = PRUEchoLeader;len = PRULeaderlen; docase EAdr case EPRUTop: buf = PRUTop;len = PRULeaderlen; docase EAdr case EAdr: [ if (index ge len) then index = (len-1) rem 8 if r then index = 0 if b & (index le (len-8)) then index = index + 8 if y & (index gr 7) then index = index - 8 PutBoxTemplate(M!EAdr,"#$6UF0O",index) for i = E0 to E7 do PutBoxTemplate(M!i,(index+i-E0 gr len) ? " ","#$6UF0O",buf!(index+i-E0)) endcase if Msel eq EAdr then Msel = 0 ] case EQuit: FlipBox(M!Msel); break case E0: case E1: case E2: case E3: case E4: case E5: case E6: case E7: if (index+Msel-E0 le len) then GetBoxNumber(M!Msel,lv buf!(index+Msel-E0)) Msel = 0 default: ] if Msel then FlipBox(M!Msel) ] ShowDisplayStream(menuStream,DSdelete) ] and SetResults(ires,ores) be [ let string = nil let ustat = nil ustat = ores ? (cb>>CB.OutputPost)<>CB.InputPost)<