Trailing-Edge
-
PDP-10 Archives
-
tops20tools_v6_9-jan-86_dumper
-
tools/tvaxv1/gtvr02.mar
There are 7 other files named gtvr02.mar in the archive. Click here to see a list.
.TITLE GTVR02 - TV OUTPUT ROUTINE
;
; IN GFPTR = REL BYTE NR OF SCREEN PTR
; GFCNT = NR OF BYTES IN BUFFER
; GOPTR = START BYTE NR FOR OUTPUT
; GSTAT/GXCTLL = ^L DONE
;
.MACRO MOVSP P1
MOVL GTTAB,R1
MOVL P1*4(R1),R1
MOVC3 (R1),2(R1),(R8)
MOVL R3,R8
.ENDM
.PAGE
INIT GTVR02
MOVL GFPTR,R1
BSBW GMOVHOLR ;SET HOLE AT PTR
MOVL GOBUFFA,R8
MOVSP 0 ;HOME
BITB GSTAT,#GXCTLL
IF. *ON ;^L DONE OR FIRST TIME
BSBW CLEAR ;CLEAR SCREEN + WINDOW
TSTL GFCNT
IF. *EQ ;EMPTY BUFFER
MOVW #^A'/\',@GSBUFFA
MOVC3 #FSL,FS,(R8)
MOVL R3,R8
ELSE.
SUBL3 #900,GFPTR,GOPTR
IF. *LTS ;BEFORE START BUFFER
CLRL GOPTR
ENDIF.
MOVL #10,R7 ;POSITION MID SCREEN
BSBW CHKSR ;CALCULATE START
BSBW MOVSR ;SET SCREEN BUFFER + TERM
ENDIF.
ELSE. ;NOT ^L DONE
TSTL GFCNT
IF. *EQ ;EMPTY BUFFER
BITB #WXCLR,WSTAT
IF. *OFF ;NOT CLEAR
BSBW CLEAR
ENDIF.
MOVW #^A'/\',@GSBUFFA
MOVC3 #FSL,FS,(R8)
MOVL R3,R8
ELSE.
BITB #GXMORE,GSTAT
IF. *ON ;MORE REQUESTED
BICB2 #GXMORE,GSTAT
BITB #WMORE,WSTAT
IF. *ON ;MORE PRESENT
SUBL3 GHCNT,WSEND,GOPTR
ENDIF.
BSBW MOVSR
BRW L2
ENDIF.
CMPL GFPTR,GOPTR
IF. *LT ;PTR BEFORE WINDOW
L1: SUBL3 #900,GFPTR,GOPTR
IF. *LTS
CLRL GOPTR
ENDIF.
MOVL #10,R7
ELSE.
SUBL3 GOPTR,GFPTR,R1
CMPL R1,#1600
IF. *GT ;TOO FAR AHEAD
BRW L1
ENDIF.
MOVL #0,R7 ;DO NOT REPOSITION SCREEN IF
ENDIF.
BSBW CHKSR ;CHECK START OF OUTPUT
BSBW MOVSR ;MOVE SCREEN BUFFER + TERM
ENDIF.
ENDIF.
L2: BSBW WRITR
RET
;
;
CLEAR:
BISB2 #WXCLR,WSTAT
MOVSP 1 ;CLEAR
BICB2 #WMORE,WSTAT
MOVC5 #0,(R0),#SPACE,#1600,@GSBUFFA ;WINDOW TO SPACE
RSB
.PAGE
;
; SHIFT THE HOLE IN THE BUFFER
; IN GHPTR,GHCNT
; GFBUFFA,GFCNT
; R1 = NEW GHPTR
GMOVHOLR:: PUSHR #^M<R6,R7,R8,R9>
CMPL R1,GHPTR
IF. *LT ;SHIFT HOLE LEFT
ADDL3 GHPTR,GFBUFFA,R6 ;FROM ADDR
ADDL3 GHCNT,R6,R7 ;TO ADDR
SUBL3 R1,GHPTR,R8 ;LENGTH TO SHIFT
MOVL R1,GHPTR ;NEW PTR
MOVH1: CMPL R8,GHCNT
IF. *GT ;CAN NOT IN 1*
SUBL2 GHCNT,R6
SUBL2 GHCNT,R7
SUBL2 GHCNT,R8
MOVC3 GHCNT,(R6),(R7)
BRW MOVH1
ENDIF.
SUBL2 R8,R6
SUBL2 R8,R7
MOVC3 R8,(R6),(R7)
ELSE. ;NO SHIF LEFT
IF. *NE ;SHIFT HOLE RIGHT
ADDL3 GHPTR,GFBUFFA,R3 ;TO ADDR
SUBL3 GHPTR,R1,R8 ;LENGTH TO SHIFT
MOVL R1,GHPTR ;NEW PTR
ADDL3 GHCNT,R3,R1 ;FROM ADDR
MOVH2: CMPL R8,G64K
IF. *GT ;CAN NOT IN 1*
MOVC3 G64K,(R1),(R3)
SUBL2 G64K,R8
BRW MOVH2
ENDIF.
MOVC3 R8,(R1),(R3)
ENDIF.
ENDIF.
POPR #^M<R6,R7,R8,R9>
RSB
.PAGE
;
; INCREASE SIZE OF HOLE IN BUFFER
; IN GHPTR,GHCNT
; GFBUFFA,GFCNT
; R1 = NR OF BYTES TO INCREMENT
;
GEXTHOLR:: PUSHR #^M<R6,R7,R8,R9>
ADDL3 GHPTR,GFBUFFA,R8
ADDL2 GHCNT,R8 ;END OF HOLE
ADDL3 GFCNT,GFBUFFA,R6
ADDL2 GHCNT,R6 ;END OF BUFFER = FROM
SUBL3 R8,R6,R8 ;LENGTH PART AFTER HOLE
ADDL3 R1,R6,R7 ;TO ADDR
SUBL3 GFBUFFA,R7,R0
CMPL R0,#GBUFS*512-2
IF. *GT ;BUFFER EXCEEDED
MOVW #11,GERRN
RET
ENDIF.
ADDL2 R1,GHCNT
MOVL R1,R9
EXTH1: CMPL R8,R9
IF. *GT ;CAN NOT IN 1*
SUBL2 R9,R8
EXTH2: CMPL R9,G64K
IF. *GT ;TOO BIG
SUBL2 G64K,R6
SUBL2 G64K,R7
SUBL2 G64K,R9
MOVC3 G64K,(R6),(R7)
BRW EXTH2
ENDIF.
SUBL2 R9,R6
SUBL2 R9,R7
MOVC3 R9,(R6),(R7)
BRW EXTH1
ENDIF.
EXTH3: CMPL R8,G64K
IF. *GT
SUBL2 G64K,R6
SUBL2 G64K,R7
SUBL2 G64K,R8
MOVC3 G64K,(R6),(R7)
BRW EXTH3
ENDIF.
SUBL2 R8,R6
SUBL2 R8,R7
MOVC3 R8,(R6),(R7)
POPR #^M<R6,R7,R8,R9>
RSB
.PAGE
;
; MOVE OUTPUT TO SCREEN BUFFER AND TO SCREEN
;
MOVSR:
BICB2 #WXCLR,WSTAT
ADDL3 GOPTR,GFBUFFA,R6
MOVL GSBUFFA,R7
SUBL3 GOPTR,GFPTR,R0
IF. *LTS ;PASSED /\ AND HOLE
MOVW #-1,WPTR
ADDL2 GHCNT,R6
ELSE.
MOVW R0,WPTR ;SET REL SCR /\
ENDIF.
CLRB WSW
CLRW WTAB2 ;INDICATE CURSOR POSITION
ADDL3 GFCNT,GFBUFFA,R1
ADDL2 GHCNT,R1
MOVB #255,(R1) ;INDICATE END FOR GOOD DISPLAY
MOVL R1,WFEND ;SAVE END OF BUFFER
MOVL #20,WLOOP
MOVS1: MOVAB 80(R7),WNXTWA ;SET ADDR NEXT WINDOW LINE
BSBW GLINR
BSBW MOVLR ;GENERATE + UPDATE
ADDL3 #1024,GOBUFFA,R1
CMPL R8,R1
IF. *GE ;TOO MUCH OUTPUT
SUBL3 GOBUFFA,R8,R1 ;LENGTH SO FAR
BSBW GWRITR
MOVL GOBUFFA,R8 ;START OF OUTPUT BUFFER
ENDIF.
MOVB #LF,(R8)+
CMPL WLOOP,#11
IF. *EQ ;MID SCREEN
SUBL3 GFBUFFA,R6,GMIDPTR
TSTW WPTR
IF. *LTS ;PASSED HOLE
SUBL2 GHCNT,GMIDPTR
ENDIF.
ENDIF.
SOBGTR WLOOP,MOVS1
MOVS2:
SUBL3 GFBUFFA,R6,WSEND ;END OF DISPLAYED INFO
RSB
WLOOP: .BLKL
WNXTWA: .BLKL 1 ;ADDR OF NEXT WINDOW LINE
WFEND: .BLKL
.PAGE
;
; CHECK OFFSET OF SCREEN PTR FROM OUT START
; IN GOPTR
; GFPTR
; R7 = NR OF WINDOW LINES -10 AFTER WHICH REPOSITION OCCURS
; OUT GOPTR UPDATED IF NEED BE
;
CHKSR:
ADDL3 GOPTR,GFBUFFA,R6
SUBL3 GOPTR,GFPTR,WTSCL ;TOTAL LL TOO SCAN
CHKS1:
MOVL R6,WLTAB[R7] ;START OF WINDOW LINE
MOVW #8,WSCL
MOVL #10,WLOOP
CHKS2: CMPW WSCL,WTSCL
IF. *LT
MOVW WSCL,WSCLM
ELSE. ;WSCLM=MIN( WSCL,WTSCL )
MOVW WTSCL,WSCLM
ENDIF.
SCANC WSCLM,(R6),GSCT,#1
IF. *NE ;HT OR CR FOUND
SUBW2 R0,WSCLM
SUBW2 WSCLM,WTSCL
DECW WTSCL
ADDL3 #1,R1,R6
CMPB (R1),#GCRX
IF. *EQ ;END OF LINE DETECTED
BRW CHKS3
ENDIF.
ELSE.
SUBW2 WSCLM,WTSCL
IF. *LES ;WE ARE THERE
BRW CHKS4
ENDIF.
MOVL R1,R6
ENDIF.
CMPL WLOOP,#1
IF. *EQ ;LAST PART OF WINDOW LINE
MOVW #7,WSCL
ENDIF.
DECL WLOOP
IF. *NE ;NOT END OF LOOP
BRW CHKS2
ENDIF.
CMPB (R6),#GCRX
IF. *EQ ;END OF LINE IN POS 80
INCL R6
DECW WTSCL
ELSE.
CMPB 1(R6),#GCRX
IF. *EQ ;END OF LINE IN POS 81
CMPB #32,(R6)
IF. *LE ;80 DISPLAY
ADDL2 #2,R6
SUBW2 #2,WTSCL
ENDIF.
ENDIF.
ENDIF.
CHKS3: TSTW WTSCL
IF. *LTS
BRW CHKS4
ENDIF.
INCL R7
CMPL R7,#20
IF. *EQ ;END OF WINDOW REACHED
MOVC3 #40,WLTAB+40,WLTAB+36
DECL R7
SUBL3 GFBUFFA,WLTAB+40,GOPTR
ENDIF.
BRW CHKS1
CHKS4:
RSB
WLN: .BLKL ;NR OF LINES ON WINDOW BEFORE PTR
WLTAB: .BLKL 20 ;TABLE OF BUFFER START ADDR S
WTSCL: .BLKL ;TOTAL LL TO PTR
WSCLM: .BLKL ;LL TO SCAN
RSB
.PAGE
;
;
; MOVE ONE TERMINAL LINE TO WINDOW AND TERMINAL
; IN WLIN = 80 BYTES NO TABS
; WTAB2 = NR OF TABS ON TERMINAL
; R7 = WINDOW PTR
; SEND ONLY BYTES TO TERMINAL THAT DIFFER
;
MOVLR: PUSHR #^M<R6>
MOVAB WLIN,R6
MOVL #10,WMLP ;10 * 8 BYTES
CLRW WTAB
MOVL1: CMPC3 #8,(R6),(R7)
IF. *EQ ;OLD WINDOW = NEW WINDOW
ADDL2 #8,R6
ADDL2 #8,R7
INCW WTAB
SOBGTR WMLP,MOVL1
BSBW DONC ;TEST DISPLAY ON
BRW MOVLX ;EXIT
ENDIF.
CMPW WTAB,WTAB2
IF. *NE ;NOT AT CORRECT POSITION
CMPW WTAB,WTAB2
IF. *LT ;GONE TOO FAR ON TERM
MOVB #CR,(R8)+
CLRW WTAB2
ELSE.
BSBW DONC
ENDIF.
SUBW3 WTAB2,WTAB,R0
MOVC3 R0,WHT,(R8)
MOVL R3,R8
MOVW WTAB,WTAB2 ;SET TABS ON SCREEN
ENDIF.
ASHL #3,WMLP,WMOV
SKPC #SPACE,WMOV,(R6)
IF. *EQ ;ALL SPACES
BSBW DONC
BITB GSTAT,#GXCTLL
IF. *OFF ;NOT ^L DONE
MOVSP 2 ;ERASE TO END OF LINE
MOVC5 #0,(R0),#SPACE,WMOV,(R7)
ENDIF.
ADDL2 WMOV,R7
BRW MOVLX
ENDIF.
MOVL (R6)+,(R7)+
ADDL2 #4,R7
BSBW MOV4R
CMPL (R6)+,-4(R7)
IF. *NE
MOVL -4(R6),-4(R7)
BSBW MOV4R
ELSE.
BITB #GXHP,GSTAT2
IF. *ON ;HP
BITB #WXON,WSW
IF. *ON ;DISPLAY ON
BSBW MOV1R ;MOVE 4 BYTES
ELSE.
MOVB #HT,(R8)+
ENDIF.
ELSE.
MOVB #HT,(R8)+
ENDIF.
ENDIF.
INCW WTAB
INCW WTAB2
DECL WMLP
IF. *NE
BRW MOVL1
ENDIF.
CMPB #HT,-1(R8)
IF. *EQ ;HT MUST NOT AT END OF LINE
DECL R8
ENDIF.
BITB #GXHP,GSTAT2
IF. *ON ;HP
BITB #WXON,WSW
IF. *ON ;STILL DISPLAY ON
DECL R8
MOVW ESCOFF,(R8)+
MOVB -1(R7),(R8)+
BICB2 #WXON,WSW
ENDIF.
ENDIF.
MOVLX: POPR #^M<R6>
RSB
;
MOV4R:
BITB #GXHP,GSTAT2
IF. *ON
BITB #WXON,WSW
IF. *OFF ;NOT DISPLAY ON
SCANC #4,-4(R6),GSCT,#4
IF. *NE ;SOME NON DISPLAYABLE FOUND
BISB2 #WXON,WSW
MOVW ESCY,(R8)+
SUBL3 #1,WMLP,R0
ASHL #3,R0,R0
MOVC5 #0,(R0),#SPACE,R0,(R7) ;CLEAR WINDOW LINE
ENDIF.
ENDIF.
BSBW MOV1R
ELSE.
SUBL2 #4,R6
MOVL #4,R0
MOV4.1: CMPB (R6),#^A' '
IF. *LT
MOVB GNONDIS,(R8)+
INCL R6
ELSE.
MOVB (R6)+,(R8)+
ENDIF.
SOBGTR R0,MOV4.1
ENDIF.
RSB
;
MOV1R: ;MOVE 4 BYTES
LOCC #CR,#4,-4(R6)
IF. *EQ ;NO CR
MOVL -4(R6),(R8)+
ELSE. ;CR DETECTED
MOVL #4,R0
MOVAB -4(R6),R1
MOV101: CMPB #CR,(R1)
IF. *EQ ;CR DETECTED
MOVB (R1)+,(R8)+
MOVW ESCOFF,(R8)+
MOVW ESCOFF,@WNXTWA ;ALSO TO WINDOW
MOVL ESCPOS,(R8)+
MOVW ESCPOS+4,(R8)+
PUSHR #^M<R0,R1>
MOVAB WLIN,R0
SUBL2 R0,R1
EDIT R1,2,(R8) ;COL POSITION
ADDL2 #2,R8
MOVB #^A'C',(R8)+
MOVW ESCY,(R8)+
POPR #^M<R0,R1>
ELSE.
MOVB (R1)+,(R8)+
ENDIF.
SOBGTR R0,MOV101
ENDIF.
RSB
ESCPOS: .BYTE 27
.ASCII /&a-1r/
;
DONC: ;TEST IF DISPLAY FUNCTIONS ON
BITB #GXHP,GSTAT2
IF. *ON
BITB #WXON,WSW
IF. *ON ;DISPALY ON
BICB2 #WXON,WSW
MOVC3 #6,ESCOFF,(R8)
MOVL R3,R8
ENDIF.
ENDIF.
RSB
;
WHT: .REPEAT 20
.BYTE HT
.ENDR
WMOV: .BLKL
WMLP: .BLKL
WLIN: .BLKB 84
WTAB: .BLKW
WTAB2: .BLKW
ESCY: .BYTE 27,^A/Y/
ESCOFF: .BYTE 27,^A'Z',8,8,27,^A'K'
.PAGE
; GENERATE ONE LINE FOR SCREEN WINDOW
; IN R6 = BUFFER PTR
; WPTR = HL2 - REL POS FROM R6 FOR /\
; WSW = STATUS
; OUT R6,WPTR UPDATED
; WLIN = BUFFER FOR NEW WINDOW LINE
;
GLINR: PUSHR #^M<R7>
MOVL #10,WGLP
MOVAB WLIN,R7
MOVB #SPACE,WLIN+79
BITB #WXP1,WSW
IF. *ON ;\ FROM PREVIOUS TIME
BICB2 #WXP1,WSW
MOVB #^A'\',(R7)+
MOVW #7,WSCL
MOVW #79,WLINL
ELSE.
MOVW #8,WSCL
MOVW #80,WLINL
ENDIF.
GLIN1: CMPW WPTR,WSCL
IF. *LT ;PTR IN THESE WSCL BYTES
SCANC WPTR,(R6),GSCT,#1
IF. *NE ;HT OR CR FOUND
SUBW3 R0,WPTR,R0
SUBW2 R0,WPTR
DECW WPTR ;ADJUST /\ PTR
CMPB (R1),#HT
IF. *EQ
MOVC5 R0,(R6),#SPACE,WSCL,(R7)
INCL R1
MOVL R1,R6
MOVL R3,R7
SUBW2 WSCL,WLINL
ELSE. ;CR FOUND
MOVC5 R0,(R6),#SPACE,WLINL,(R7)
ADDL3 #1,R1,R6
BRW GLINX
ENDIF.
ELSE. ;FOUND PLACE TO INSERT /\
MOVC3 WPTR,(R6),(R7)
MOVW #^A'/\',(R3)+
MOVL R1,R6
MOVL R3,R7
ADDW2 #2,WPTR
SUBW2 WPTR,WSCL
SUBW2 WPTR,WLINL
ADDL2 GHCNT,R6 ;SKIP THE HOLE
MOVW #-1,WPTR
TSTW WSCL
IF. *LTS ;OVERFLOW \
MOVW #7,WSCL
ELSE.
IF. *GT ;8 BYTES NOT FULL
BRW GLIN2
ELSE.
MOVW #8,WSCL
ENDIF.
ENDIF.
ENDIF.
ELSE. ;NO PTR TO INSERT
GLIN2: SCANC WSCL,(R6),GSCT,#1
IF. *NE ;HT,CR OR END FOUND
SUBW3 R0,WSCL,R0
SUBW2 R0,WPTR
DECW WPTR
CMPB (R1),#HT
IF. *EQ ;HT FOUND
MOVC5 R0,(R6),#SPACE,WSCL,(R7)
ADDL3 #1,R1,R6
MOVL R3,R7
SUBW2 WSCL,WLINL
ELSE.
CMPB (R1),#GCRX
IF. *EQ ;CR FOUND
MOVC5 R0,(R6),#SPACE,WLINL,(R7)
ADDL3 #1,R1,R6
ELSE. ;END OF BUFFER
MOVC5 R0,(R6),#SPACE,WLINL,(R7)
CMPL R1,WFEND
IF. *NE ;NOT AT END
SUBL3 R6,R1,R0
INCL R0
SUBW2 R0,WSCL
SUBW2 R0,WLINL
ADDL2 R0,R7
MOVL R1,R6
INCL R6
DECW WSCL
BRW GLIN2
ENDIF.
MOVL R1,R6
ENDIF.
BRW GLINX
ENDIF.
ELSE. ;NO SPECIAL ACTION
MOVC3 WSCL,(R6),(R7)
MOVL R1,R6
MOVL R3,R7
SUBW2 WSCL,WPTR ;ADJUST /\ PTR
SUBW2 WSCL,WLINL
ENDIF.
MOVW #8,WSCL ;NEXT SCAN 8 BYTES
ENDIF.
DECL WGLP
IF. *EQ ;END OF WINDOW LINE REACHED
CMPB #GCRX,(R6)
IF. *EQ ;CR IN POS 80
TSTW WPTR
IF. *NE ;NOT AT PTR POSITION
CMPB WLIN+79,#^A'\'
IF. *NE ;NOT PTR AT END THIS LINE
DECW WPTR
INCL R6 ;SKIP END OF LINE
BRW GLINX
ENDIF.
ENDIF.
DECL R7
BISB2 #WXP1,WSW
ELSE.
CMPB WLIN+79,#^A'\'
IF. *EQ ;OVERFLOW \
DECL R7
BISB2 #WXP1,WSW
ELSE.
CMPB 1(R6),#GCRX
IF. *EQ ;CR IN POS 81
CMPW #1,WPTR
IF. *LT ;NOT /\ AT END
CMPB #SPACE,(R6)
IF. *LE ;DISPLAYABLE
MOVB (R6)+,(R7)+
INCL R6
SUBW2 #2,WPTR
BRW GLINX
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
MOVB #^A'!',(R7)+
ELSE.
CMPL WGLP,#1
IF. *EQ ;LAST 8 POS IN WINDOW LINE
DECW WSCL
ENDIF.
BRW GLIN1
ENDIF.
GLINX: POPR #^M<R7>
RSB
WGLP: .BLKL
CR=13
LF=10
HT=9
SPACE=32
WPTR: .BLKW
WLINL: .BLKW
WSCL: .BLKW
WSW: .BLKB
WXP1=^X80 ;\ OVERFLOW OCCURRED
WXON=^X40 ;DISPLAY FUNCTIONS ON HP
.PAGE
;
; WRITE OUTPUT TO TERMINAL
; IN GOBUFFA = ADDR OUTPUT
; R8 = END OF OUTPUT
;
WRITR:
MOVB #CR,(R8)+
TSTL GFCNT
IF. *EQ ;EMPTY
MOVL GHCNT,WSEND
ENDIF.
ADDL3 GFCNT,GHCNT,R1
CMPL WSEND,R1
IF. *GE ;END OF BUFFER ON SCREEN
BITB #WMORE,WSTAT
IF. *ON
BICB2 #WMORE,WSTAT
MOVSP 2 ;CLEAR TO END OF LINE
MOVW CRLF,(R8)+
ELSE.
MOVB #LF,(R8)+
ENDIF.
ELSE.
BITB #WMORE,WSTAT
IF. *ON
MOVB #LF,(R8)+
ELSE.
BISB2 #WMORE,WSTAT
MOVC3 #WML,WM,(R8)
MOVL R3,R8
ENDIF.
ENDIF.
MOVB #^A/*/,(R8)+
MOVSP 1 ;CLEAR
SUBL3 GOBUFFA,R8,R1 ;OUTPUT LENGTH
TSTW GERRN
IF. *NE ;ERROR PRESENT
CALLS #0,GTVR07
CLRW GERRN
ENDIF.
BSBW GWRITR ;SEND TO TERMINAL
BICB2 #GXCTLL,GSTAT
RSB
;
;
FS:
.ASCII [/\[
.BYTE 13,10,10,10,10,10,10,10,10,10,10
.BYTE 10,10,10,10,10,10,10,10,10,10
FSL=.-FS
CRLF: .BYTE 13,10
WSTAT: .BYTE 0
WMORE=^X80 ;MORE ON TERMINAL
WXCLR=^X40 ;WINDOW + TERM CLEAR
WM: .ASCII /--MORE--/
.BYTE 13,10
WML=.-WM
WSEND: .LONG 0
.END