.TITLE CSRK .MCALL RCVX$S,MRKT$,SDAT$S,WTSE$S,DCBDF$,UCBDF$,SCBDF$ ; ; CSRK.MAC - Utility to send BREAK to a designated terminal port. ; ; Author: Rick Webster, Caterpillar Tractor Co. ; DCBDF$ UCBDF$ SCBDF$ ,,SYSDEF .IFDF R$$MPL .MCALL KRBDF$ KRBDF$ .ENDC CSRK: RCVX$S ,#RCVBUF CMP #400,RCVBUF+4 ; Send BREAK function BEQ 110$ ; Yes, branch MOVB RCVBUF+4,R0 ; No, must be find CSR .IFDF R$$MPL MOV #20000,R5 ; Start search at 20000 for M+ since ; I&D space systems have protected ; memory mapped by APR 0. There are ; no DCB's before this any way .IFF CLR R5 ; Start search at address 0 for M .ENDC 10$: CMP (R5),#"TT ; Have we found a possible TT DCB? BEQ 30$ ; Yes, branch 20$: ADD #2,R5 ; No, set to look at next word BR 10$ ; Continue looping 30$: MOV R5,R1 ; SUB #D.NAM,R1 ; R1 points to D.LNK 40$: MOV D.UCB(R1),R2 ; R2 points to first UCB MOV D.UNIT(R1),R3 ; R3 has low/high unit number BIC #177400,R3 ; R3 has lowest unit # for this DCB MOV D.UNIT(R1),R4 ; Set R4 to CLRB R4 ; the highest unit SWAB R4 ; number covered by this DCB SUB R3,R4 ; Set R4 to the line INC R4 ; number on this controller + 1 ADD #U.DCB,R2 ; Point to DCB back pointer 50$: BIT #1,R2 ; Is it an odd address? BNE 20$ ; Yes, not really a DCB, cont. looking CMP (R2),R1 ; Does alleged UCB point to DCB? BNE 20$ ; No, not a DCB, continue looking ADD D.UCBL(R1),R2 ; Point to next UCB for this DCB SOB R4,50$ ; Continue DCB validity check CMPB R0,D.UNIT+1(R1) ; Does this DCB have the unit we want? BLOS 60$ ; Yes, branch MOV (R1),R1 ; No, point to next TT DCB BIT #1,R1 ; Odd address BNE 20$ ; Yes, not a DCB, continue looking BR 40$ ; No, go do validity check on this DCB 60$: MOV D.UNIT(R1),R3 ; Set R3 to lowest BIC #177400,R3 ; unit number for this DCB SUB R3,R0 ; R0 gets line number MOV D.UCBL(R1),R3 ; R3 has UCB length MUL R0,R3 ; R3 has offset to desired UCB ADD D.UCB(R1),R3 ; R3 points to desired UCB BIT #U2.DZ1,12(R3) ; Is unit a DZ11? BEQ 70$ ; No, branch MOV #1,RCVBUF+10 ; Yes, set type to 1 BR 100$ ; 70$: BIT #U2.DH1,12(R3) ; Is unit a DH11? BEQ 80$ ; No, branch MOV #2,RCVBUF+10 ; Yes, set type to 2 BR 100$ ; 80$: BIT #40000,12(R3) ; Is unit a DJ11? BEQ 90$ ; No, branch MOV #-1,RCVBUF+10 ; -1 indicates that break not possible BR 100$ ; 90$: CLR RCVBUF+10 ; 100$: CLR RCVBUF+6 ; MOVB U.UNIT(R3),RCVBUF+6 ; Put physical unit number in message MOV U.SCB(R3),R4 ; R4 gets SCB address .IFNDF R$$MPL ; If an RSX11M system MOV S.CSR(R4),RCVBUF+4 ; Put CSR address in message .IFF ; If an RSX11M+ system MOV S.KRB(R4),R4 ; R4 points to KRB MOV K.CSR(R4),RCVBUF+4 ; Put CSR address in message .ENDC JMP 140$ ; Go return info to sender ; ; Transmit BREAK ; 110$: MOV RCVBUF+6,R3 ; R3 gets CSR address CMP R3,#160000 ; Valid CSR? BHIS 115$ ; Yes, branch 111$: JMP 140$ ; No, just return a packet to sender 115$: MOV RCVBUF+10,R5 ; R5 gets physical unit number MOV RCVBUF+12,R4 ; R4 gets type of controller ASL R4 ; Convert controller type to index ASL R5 ; Convert unit number to index CMP R4,#4 ; Valid index? BGT 111$ ; No, branch ADD BRKREG(R4),R3 ; R3 points to BREAK register MOV #1,R2 ; Assume DL11, set bit 0 CMP #2,R4 ; Test unit type BGT 130$ ; Branch for DL11 BNE 120$ ; Branch for DH11 CMP R5,#14. ; Valid index BGT 111$ ; No branch MOVB DZTAB+1(R5),R2 ; Set bit in high byte for DZ11 BIC #177400,R2 BR 130$ ; 120$: CMP R5,#30. ; Valid index BGT 111$ ; No, branch MOV DHTAB(R5),R2 ; Set bit in word for unit # on DH11 130$: MOV RCVBUF+12,R4 ; R4 gets type of controller CMP R4,#1 ; DZ11? BNE 131$ MOVB R2,1(R3) BR 132$ 131$: BIS R2,(R3) ; Set appropriate bit in BREAK register 132$: MOV RCVBUF+14,MRKTIM+M.KTMG ; Get timer value ;132$: MOV #200.,MRKTIM+M.KTMG ; Set for 3.33 second break DIR$ #MRKTIM ; Mark time for indicated time WTSE$S #2 ; " CMP R4,#1 ; DZ11? BNE 133$ CLRB 1(R3) BR 134$ 133$: BIC R2,(R3) ; Clear bit in BREAK register 134$: MOV RCVBUF+16,MRKTIM+M.KTMG ; Get 2nd timer value DIR$ #MRKTIM ; Wait indicated time WTSE$S #2 ; " 140$: SDAT$S #RCVBUF,#RCVBUF+4 ; Tell sender we are done JMP CSRK ; Get more data if any MRKTIM: MRKT$ 2,,1 DHTAB: .WORD 1 .WORD 2 .WORD 4 .WORD 10 .WORD 20 .WORD 40 .WORD 100 .WORD 200 DZTAB: .WORD 400 .WORD 1000 .WORD 2000 .WORD 4000 .WORD 10000 .WORD 20000 .WORD 40000 .WORD 100000 BRKREG: .WORD 4 .WORD 6 .WORD 14 RCVBUF: .BLKW 15. .END CSRK