.TITLE INISRV UDP initialization .NLIST BEX .ENABL LC ; ; Pdp11/dcn - UDP initialization ; ; External symbols ; .GLOBL RDLIN,HASH ;i/o utilities .GLOBL KWKTBL ;command table ; ; Entry symbols ; .GLOBL SETUP ;initialization ; ; System definitions ; .ASECT .MCALL .COM,.CHR ;dcnlib definitions .MCALL .LOOKU,.READW,.PURGE ;rt-11 definitions .MCALL FORMAT ;netlib macros .COM ;define common data .CHR ;define ascii character codes ; .PSECT $BOSI,RO,I ; ; Initialization request ; SETUP: .LOOKU #ARGBLK,#4,#CMDNAM ;open command file BCC 1$ ;branch if okay FORMAT #COM09 ;unable to open command file BR 10$ ; 1$: MOV #INPEND,INPPTR ;initialize pointers CLR INPBLK 2$: MOV #CMDBUF,R1 ;get next command line 3$: JSR PC,CMDBYT BCS 10$ ;branch if cant CMPB R0,#'; ;is this comment BEQ 5$ ;branch if yes CMPB R0,#040 ;no. delete control chars BLO 4$ MOVB R0,(R1)+ 4$: CMPB R0,#CR ;until BNE 3$ BR 6$ ; 5$: JSR PC,CMDBYT ;gobble comment BCS 10$ ;branch if cant CMPB R0,#CR BNE 5$ 6$: CLRB (R1)+ ;backstop MOV #CMDBUF,R0 ;interpret command line JSR PC,RDLIN JSR PC,HASH ;get command name BEQ 2$ ;ignore if empty line MOV #KWKTBL,R1 ;search for match 7$: TST (R1)+ ;is this end of table BEQ 9$ ;branch if yes CMP R0,-2(R1) ;no. do entries match BEQ 8$ ;branch if yes TST (R1)+ ;no. step to next BR 7$ ; 8$: ADD @R1,R1 ;entries match. call subroutine JSR PC,@R1 BR 2$ ; 9$: FORMAT #COM13 ;unknown command BR 2$ ; 10$: .PURGE #4 ;clean up and go home RTS PC ; ; Subroutine to read byte ; Returns r0 = byte, c(cc) = 1 if error/end file ; CMDBYT: CMP INPPTR,#INPEND ;is buffer empty BLO 1$ ;branch if no .READW #ARGBLK,#4,#INPBUF,#256.,INPBLK ;yes. read next buffer BCS 2$ ;branch if error INC INPBLK MOV #INPBUF,INPPTR 1$: MOVB @INPPTR,R0 ;read byte BIC #^C177,R0 INC INPPTR CLC ;normal exit RTS PC ; 2$: TSTB @#52 ;bad read. is it eof BEQ 3$ ;branch if yes FORMAT #COM20 ;file read error 3$: SEC ;exception exit RTS PC ; ; Data segment ; .PSECT $BOSD,RO,D ; CMDNAM: .RAD50 'DK UDP INX' ;command file name COM09: .ASCIZ '?UDP-W-Unable to open command file DK:UDP.INX' COM20: .ASCIZ '?UDP-W-Command file read error' COM13: .ASCIZ '?UDP-W-Unknown command' .EVEN ; .PSECT $ERAS,RW,I ; ; Variables ; ARGBLK: .BLKW 5 ;rt-11 argument block INPBLK: .BLKW 1 ;input block INPPTR: .BLKW 1 ;input pointer INPBUF: .BLKW 256. ;input buffer INPEND = . ;end of input buffer CMDBUF: .BLKB 128. ;command buffer .EVEN ; .END