! Little test program to bounce data from Qsart to terminal. ! Interrupt driven of course. %Constinteger Channels = 4 %Constinteger Board Addr = 16_7FFC0 %constinteger default baudcode=13 %constintegerarray baudrate(0:15)= 46, 50, 75, 110, 135, 150, 300, 600, 1200, 1800, 2000, 2400, 4800, 9600,19200,38400 %recordformat DEV F(%byte bstatus,data,intvec,dstatus,x,mode,y,command) ! BSTATUS and INTVEC are board registers, X and Y "do not exist", ! DATA, DSTATUS, MODE, COMMAND are registers in the 2651s. %recordformat BOARD F(%record(devf)%array dev(0:3)) @Board Addr %record(boardf) board %recordformat INT F(%integer ptr,lim,beg,data,pc,sp,%record(devf)%name dev) ! One of these per interrupt vector. PC points to the int handling code. ! SP points to the stack of a process waiting for a significant interrupt. ! PTR and LIM delimit a data buffer along which PTR moves. DATA (in the ! receiver case) marks the boundary between the command part and the data ! part of an incoming packet. %recordformat INTTAB F(%record(intf)%namearray int(0:15)) %constinteger mode1=16_4e,mode2=16_30,comm=16_37 ! Hardware initialisation values: ! 1 stop bit, no odd parity, 8 bits, async 16*baud clock, ! internal clocks, normal operation, force RTS active, ! reset error, no break, enable rx, force DTR active, enable tx. %recordformat CHAN F(%record(intf)%name rx,tx,%integer buffer,baudcode) ! One of these per client machine. BUFFER is the (queue of) outgoing buffer(s). %constinteger errormask=16_38 ! Dev status: [dsr|dcd|fe|oe|pe|txe/dsrc/dcdc|rxr|txr] %constinteger txie=1,rxie=2,reset=8 ! Board command/status: [inting|0|0|0|reset|txeie|rxrie|txrie] %constinteger txvec=1,rxvec=5 ! Board interrupt vector is n+m where n=channel(0:3), ! m=(1:txr,5:rxr,9:txe) %Ownrecord(Inttabf) Inttab %Ownrecord(intf)%array Ints (0:15) %ownrecord(chanf)%array channel(0:3) %Routine Set Baud (%Integer unit,code) %Record(Devf)%Name Dev Dev == Board_Dev(Unit) Dev_Bstatus = Reset Dev_Bstatus = 0 Dev_Mode = Mode1 Dev_Mode = Mode2 + Code Dev_Command = Comm Dev_Bstatus = Rxie Channel(unit)_Baudcode = Code %End Set Baud (0,Default Baud Code) %Routine Setup Interrupt Handler @16_4000c1 %Byte Vdus @16_1074 %Integer Main Vector %For i = 0,1,15 %Cycle int == ints(i) ; IntTab_Int(i) == int int = 0; int_pc = addr(BadInt) %Repeat Ints(0)_Dev == Board_Dev(0) %For j = 0,1,3 %Cycle Chan == Channel (j) ; Chan_Buffer = 0; Dev == Board_Dev (j) k = (j!!3) + TxVec Int == Ints(k) ; int_pc = addr (txint); int_dev == dev; chan_tx == int k = k - TxVec + RxVec Int == Ints(k) ; int_pc = addr (rxint); int_dev == dev; chan_rx == int %Repeat *lea inttab,a0 *lea inttabref,a1 *