//AIproms.bcpl // L. Stewart //last modified April 19, 1978 9:36 PM get "Streams.d" external [ //incoming procedures OpenFile; Ws; Puts; Closes //incoming statics dsp ] static [ mbFile; memoryNumber ] structure String [ length byte; char^1,1 byte ] //------------------------------------------------------------------- let AltoImpRoms() be //------------------------------------------------------------------- [ mbFile = OpenFile("AIProms.mb",ksTypeWriteOnly,charItem) DoMemory(256,4,"Control",GenControl) DoMemory(256,4,"Input",GenInput) DoMemory(256,4,"Output",GenOutput) PutWord(mbFile,0) //end of file Closes(mbFile) ] //------------------------------------------------------------------- and DoMemory(length,width,name,Generator) be //------------------------------------------------------------------- //length is 2^(number of address bits) //width is the number of output bits //name is a BCPL string //generator is a procedure [ Puts(dsp,$*N); Ws(name) PutWord(mbFile,4) //declare memory parameters memoryNumber = memoryNumber +1 PutWord(mbFile,memoryNumber) PutWord(mbFile,width) for i = 1 to name>>String.length do Puts(mbFile,name>>String.char^i) Puts(mbFile,0) //asciz end of string if (name>>String.length & 1) eq 0 then Puts(mbFile,0) //pad to word boundry PutWord(mbFile,2) //set current memory and location PutWord(mbFile,memoryNumber) PutWord(mbFile,0) //location = 0 for addr = 0 to length-1 do [ PutWord(mbFile,1) //memory data word PutWord(mbFile,0) //source line number (not used) PutWord(mbFile,Generator(addr)) ] ] //------------------------------------------------------------------- and PutWord(stream,w) be //------------------------------------------------------------------- [ Puts(stream,w rshift 8) Puts(stream,w) ] //------------------------------------------------------------------- and GenControl(address) = valof //------------------------------------------------------------------- //an I3601 [ manifest [ //states stateIdle = 0 stateStartOutput = 1 stateSetControl = 2 stateStartInput = 3 //wakeups NOTE: Low bit inverted before reaching NEXT nothing = 0 wakeupControl = 0 wakeupInputStart = 1 wakeupInputData = 2 wakeupOutputData = 3 //SIO's sioSetControl = 3 sioStartInput = 2 sioStartOutput = 1 sioOtherDevice = 0 ] structure Address: [ blank bit 8 NotSIO bit //A0 pin 5 NotBus bit 2 NotISWakC bit NotIWake bit NotOWake bit OldState bit 2 ] structure Data: [ Nextbits bit 2 //Q0 pin 12 NewState bit 2 blank bit 12 ] let SIO = address<