.TITLE IDSOUT .ENABL LC .IDENT /APR 83/ ; ; This is the series of subroutines that look in the IDSRAS buffer ; for a window or band of raster data, and extracts that data in ; a way that can be shipped out the IDS printer. ; ; ; first, find all the stuff we need to print ; .PSECT IDSRAS,RW,D,OVR,GBL .XOFF: ; start of pointer table to the window ; ; ; Here, we define a few of the needed data structures, etc ; ; .PSECT IDSDMP .MCALL QIOW$,DIR$ ATT: QIOW$ IO.ATT,,1 DET: QIOW$ IO.DET,,1 WRITE: QIOW$ IO.WAL,,1 ; IDSINI: .BYTE 15,14,3 ; return, formfeed, graphics init IDSINL= . - IDSINI .EVEN IDSFIN: .BYTE 3,2 ; control character, alpha mode. IDSFIL= . - IDSFIN .EVEN BUFLEN= 2000. BUFFER: .BLKB BUFLEN ; buffer for building an output string .EVEN .PAGE ; ; now for the attach and deattach ... ; IDSATT::MOV @2(R5),ATT+Q.IOLU ; set the loon in place DIR$ #ATT ; and attach it MOV @2(R5),WRITE+Q.IOLU ; set up the loon for the write MOV #IDSINI,WRITE+Q.IOPL ; set up the initialization string MOV #IDSINL,WRITE+Q.IOPL+2 ; and its length DIR$ #WRITE ; and initialize the printer RETURN ; and go home ; IDSDET::MOV @2(R5),WRITE+Q.IOLU ; set the loon up for the write MOV #IDSFIN,WRITE+Q.IOPL ; setup the finish message MOV #IDSFIL,WRITE+Q.IOPL+2 ; and its length DIR$ #WRITE ; and restore the printer to 'normal' MOV @2(R5),DET+Q.IOLU ; set the loon in place DIR$ #DET ; and detach it RETURN ; simple as that. now home. .PAGE ; ; ; IDSDMP - a subroutine to dump the contents of the raster window ; to the printer. This routine assumes that the device ; is attached and the loon is in place in the write directive. ; It is also assumed that the printer is in graphics mode. ; ; CALL IDSDMP(LOON) where LOON is the logical unit for the output ; ; The IDS printers print 7 nibs at one time, as the print head passes ; from left to right. There are 1092 such positions on the PRISM 132 ; printer. This subroutine finds the appropriate bits and packs them ; in the IDS format, and ships them out. A control character "3 sets ; a control mode. To ship a "3 out, two must be sent. ; ; IDSDMP::MOV @2(R5),WRITE+Q.IOLU ; set up the write loon CLR R4 ; R4 = raster line # times 2 ; ; clear out our temp buffer ; 5$: MOV #BUFFER,R2 ; R2 = pointer to temp buffer MOV #BUFLEN,R3 ; R3 = length of the buffer MOV #200,R0 ; hold in a register - its faster 10$: MOVB R0,(R2)+ ; set bit 8 for TT driver SOB R3,10$ ; done yet? ; ; get bit positions, and a line of bits from our buffer ; MOV #1,R2 ; R2 = bit position on the print head ; 1 = top pin 12$: MOV #BUFFER,R3 ; reset pointer to our buffer MOV .XOFF(R4),R1 ; get pointer to the line in window ADD #2,R4 ; and set up for the next (by words) ; ; take one byte from the window, and give it to 8 bytes in our buffer ; 15$: MOVB (R1)+,R0 ; got the one byte from the window .IRP LAB,<20$,21$,22$,23$,24$,25$,26$,27$> ; once for each bit RORB R0 ; move the bit to the carry BCC LAB ; the bit isn't set ... BISB R2,(R3) ; it is set - set our bit LAB: INC R3 ; and point to the next byte .ENDR ; ; see if we've done the whole line yet ; CMP R1,.XOFF(R4) ; compare to the next pointer BLOS 15$ ; not done yet - more bytes this line ; ; we've finished one nib of the line - go for another ; ASLB R2 ; this is the nib we're working on BPL 12$ ; high bit of byte will set carry - ; if not set, we haven't done 7 bits. .PAGE ; ; finished 7 lines - temp buffer has the IDS format data. ; ; R4 = number of the next line in the window ; all other registers are scratch. ; ; How much data do we have? ; MOV #BUFFER,R3 ; start of the buffer MOV R3,R2 ; and a copy of it ADD #MAXNY,R2 ; end of the line MOV #200,R1 ; empty buffer marker 30$: CMPB R1,-(R2) ; check for null BEQ 30$ ; loop until we see something CMP R2,R3 ; did we go past the beginning? BHI 40$ ; no, we found something to plot MOV R3,R2 ; Set the end of the string DEC R2 ; less one for later increment BR 60$ ; and go ship it out. ; ; (R2) ==> last character. Don't let us go too far ... ; CMP #BUFFER+MAXNY,R2 ; look at theory's end BHI 40$ ; not off the end, we're ok. MOV #,R2 ; past the end. set us at the end. ; ; now look for control characters ("203) ; 40$: MOV #203,R1 ; this is what we're looking for CLR R0 ; clear a counting flag 45$: CMPB R1,(R3)+ ; check for one BNE 50$ ; INC R0 ; found one - count it 50$: CMP R3,R2 ; done yet? BLOS 45$ ; not yet. ; ; now double all the "203's ; TST R0 ; did we find some? BEQ 60$ ; no - don't move anything MOV R2,R3 ; R2 = end of the old string ADD R0,R3 ; R3 = end of the new string MOV R3,-(SP) ; save the end of the string INC R2 ; for autodecrement, must be past INC R3 ; what you're looking for MOV #BUFFER,R0 ; R0 = beginning of the buffer ; 52$: MOVB -(R2),-(R3) ; move a byte CMPB R1,(R3) ; is this a "203? BNE 55$ ; nope just continue MOVB R1,-(R3) ; double all "203's 55$: CMP R2,R0 ; at the end (beginning)? BHI 52$ ; not yet - continue MOV (SP)+,R2 ; done. get pointer to the end .PAGE ; ; line is reduced; all "203's are doubled. ; (we hope that the line is still less than BUFLEN-2 bytes long) ; now to add in the graphics line feed, and ship it out. ; R4 still contains the number of the next line in the window ; R2 ==> last character in the buffer ; 60$: INC R2 ; get past, for additions MOVB #203,(R2)+ ; put in a control character MOVB #16,(R2)+ ; and a graphics line feed MOV #BUFFER,R3 ; get the start of our buffer MOV R3,WRITE+Q.IOPL ; set up the buffer SUB R3,R2 ; calculate the length of the buffer MOV R2,WRITE+Q.IOPL+2 ; and put in place DIR$ #WRITE ; and write it out ; ; so much for that line - any more? ; MOV #MAXNX,R0 ; get the max # lines per window ASL R0 ; double it, to match us CMP R0,R4 ; have we done it all? BHI 5$ ; nope - go finish RETURN ; that's all - just leave .END