.TITLE PTXLIN .ENABL LC .IDENT /APR 83/ ; ; This subroutine gets a line of raster data from the buffer and ; returns it in the supplied line buffer. Also returned is the ; printable length of the buffer, excluding trailing 0's. ; ; Internally, the raster buffer contains 99 bytes (792 bits) ; for each line of raster. This must be repacked into 132 bytes of ; 6 bits each, with bit 6 set in each byte (3 bytes --> 4 bytes). ; ; CALL PTXLIN(LINE,BUFFER,LENGTH) ; ; where LINE is the raster line number to retrieve ; (0 --> MAXNX-1) ; BUFFER is the returned line buffer of up to ; 132 bytes plus the graphics character. ; LENGTH is the printable length of BUFFER. ; ; modification history: ; ; 20 april 83 hg initial edit ; ;--------------------------------------------------------------------------------- ; ; first, define the raster buffer ; .PSECT PTXRAS,RW,D,OVR,GBL .XOFF: ; pointer table start ; ; Now for the routine at hand - first definitions ; .PSECT PTXLIN LINE = 2 BUFFER = 4 LENGTH = 6 .PAGE ; ; clear out the buffer, get pointer to the line in question ; PTXLIN::MOV @LINE(R5),R0 ; line number ASL R0 ; make it a word offset MOV .XOFF(R0),R0 ; and point to the line itself MOV BUFFER(R5),R1 ; get the buffer's address MOV R1,R2 ; and copy it for clearing use MOV #132.,R4 ; get a counter MOV #100,R3 ; remember bit 6 must be set 10$: MOVB R3,(R2)+ ; clear a byte SOB R4,10$ ; and around until done ; ; R0 = start of raster buffer (input) ; R1 = start of line buffer (output) ; R2 = counter - 33 sets of 3 bytes (99) --> 33 sets of 4 bytes (132) ; MOV #33.,R2 ; get our counter ; ; first byte of the 4 we're making ; 20$: MOVB (R0),R4 ; get the byte (with extra stuff) BIC #177700,R4 ; bag all but the bottom 6 bits BISB R4,(R1)+ ; and put into our buffer ; ; second of the 4 ; MOVB (R0)+,R4 ; get the first of the 3 again .REPT 6 ASR R4 ; move low 2 bits into position .ENDM BIC #177774,R4 ; clear all but these two bits BISB R4,(R1) ; and put into our buffer MOVB (R0),R4 ; get the second of the 3 bytes ASL R4 ; and shift up - leave two bits ASL R4 ; BIC #177703,R4 ; clear all but the 4 bits BISB R4,(R1)+ ; and stuff into our buffer ; ; third of the 4 ; MOVB (R0)+,R4 ; get the second of the 3 again .REPT 4 ASR R4 ; low 4 bits are good .ENDM BIC #177760,R4 ; keep only these 4 bits BISB R4,(R1) ; and set them in our buffer MOVB (R0),R4 ; get the last of the 3 bytes .REPT 4 ASL R4 ; and shift two bits down to place .ENDM BIC #177717,R4 ; bag all but the 2 bits BISB R4,(R1)+ ; and put into the buffer ; ; fourth of the 4 ; MOVB (R0)+,R4 ; all ready - just clean it up ASR R4 ; shift down two places ASR R4 ; BIC #177700,R4 ; get rid of extra stuff BISB R4,(R1)+ ; put in the buffer ; ; and loop for all 33 sets ; SOB R2,20$ ; loop until done ; ; now look backward for the last printing character (non "100) ; 30$: CMPB R3,-(R1) ; R1 = end of the string BEQ 30$ ; and loop until we don't match MOV BUFFER(R5),R0 ; get the buffer's address CMP R0,R1 ; did we go past the end? BLO 40$ ; nope - R1 --> last character MOV R0,R1 ; empty line - make R1 point DEC R1 ; before the line (last char.) 40$: INC R1 ; point to the first free spot MOVB #5,(R1)+ ; add in the graphics command SUB R0,R1 ; calculate the length of string MOV R1,@LENGTH(R5) ; and return it RETURN ; all done - go on home .END