.TITLE PRTVCG Peritek spooler .NLIST BEX .ENABL LC ; ; Peritek spooler ; ; This module is part of the spooler daemon. It copies files to the Peritek ; VCG display controller and supports Dacom facsimile, Sun bitmap and ; Tektronix formats. ; ; This program requires the Image Data Interface IMGTEK and VCG Driver TEKVCG, ; along with the Peritek CSP-2 subroutine package. ; ; External symbols ; .GLOBL VCGINI,VCGWRT ;image data interface .GLOBL QUELST,FILBUF,FILBLK ;sharp pointers ; ; Entry symbols ; .GLOBL PRTVCG ;peritek display spooler .GLOBL TKRPLY ;flashy graphics ; ; System definitions ; .ASECT .MCALL .COM,.CHR,.PRT ;dcnlib macros .MCALL .READW ;rt-11 macroni .MCALL CALL,FORMAT ;netlib macros .COM ;define common data .CHR ;define ascii character codes .PRT ;define queue file entry format ; ; Assembly parameters ; MAXSIZ = 4 ;max blocks input buffer VCGREG = 174760 ;vcg register base (4 words) VCGWDW = 175000 ;vcg window base (128 words) ; ; Sun image file header ; (32-bit byte-swapped doublewords) ; . = 0 RS.MAG: .BLKW 2 ;(ras_magic) magic number RS.WID: .BLKW 2 ;(ras_width) width (pels) of image RS.HGH: .BLKW 2 ;(ras_height) height (pels) of image RS.DPT: .BLKW 2 ;(ras_depth) depth (1,8,24 bits) of pel RS.IMG: .BLKW 2 ;(ras_length) length (bytes) of image RS.TYP: .BLKW 2 ;(ras_type) type of file RS.COL: .BLKW 2 ;(ras_maptype) type of colormap RS.MAP: .BLKW 2 ;(ras_maplength) length (bytes) of color map RS.LEN = . ;length of header ; ; VCG control registers ; . = 0 VCGADR: .BLKW 1 ;crtc address register VCGDAT: .BLKW 1 ;crtc data register VCGCTL: .BLKW 1 ;display address and control register VC.ADR = 177400 ;line address bits 7-0 VC.AD8 = 000200 ;line address bit 8 VC.VGO = 000040 ;enable crtc VC.WDW = 000020 ;enable window memory addressing VC.MEM = 000002 ;write ones in memory VC.DMA = 000001 ;enable dma memory addressing VCGBUF: .BLKW 1 ;display buffer register ; ; Procedure segment ; .PSECT $BOSI,RO,I ; ; Peritek spooler ; PRTVCG: CLR LPMODE ;default mode .READW #ARGBLK,#3,#FILBUF,#MAXSIZ*256.,FILBLK ;read first block BCC 1$ ;branch if ok FORMAT #COM14,#QUELST ;file read error BR 5$ ; 1$: MOV R0,NWORDS ;set pointers ADD #MAXSIZ,FILBLK MOV #FILBUF,BUFPTR CMP FILBUF,MAGIC ;no. is this sun image file BNE 2$ ;branch if no CMP FILBUF+2,MAGIC+2 BEQ INP10 ;branch if yes 2$: CMP FILBUF,FAXMGC ;no. is this facsimile file BNE 3$ ;branch if no CALL VCGINI,#2,#1726.,#2200.,LPMODE ;yes. light fax BR 4$ ; 3$: CALL VCGINI,#0,#0,#0,LPMODE ;light tektronix 4$: JSR PC,BINP ;get next data word BCS 5$ ;branch if unable CALL VCGWRT,R0 ;cough it up BR 4$ ; 5$: CLC ;normal return RTS PC ; ; Sun bitmap format ; INP10: MOV FILBUF+RS.WID+2,XMAX ;sun format. extract header info SWAB XMAX MOV FILBUF+RS.HGH+2,YMAX SWAB YMAX MOV XMAX,R0 ;compute bits per line ADD #17,R0 BIC #17,R0 MUL YMAX,R0 ;compute total bits ASHC #-4.,R0 ;convert to words MOV R0,LENGTH MOV R1,LENGTH+2 MOV FILBUF+RS.MAP+2,R0 ;adjust for color map SWAB R0 ADD #RS.LEN,R0 ADD R0,BUFPTR ASR R0 SUB R0,NWORDS CMP FILBUF+RS.DPT+2,#1*400 ;is this b/w BNE RSTOR ;branch if no CALL VCGINI,#1,XMAX,YMAX,LPMODE ;yes. light b/w bitmap 1$: SUB #1,LENGTH+2 ;is copy complete SBC LENGTH BCS 2$ ;branch if yes JSR PC,BINP ;no. get next data word BCS 2$ ;branch if error CALL VCGWRT,R0 ;cough it up BR 1$ ; 2$: CLC ;normal return RTS PC ; ; Restore color image ; RSTOR: CALL VCGINI,#0,#0,#0,LPMODE ;light bitmap color MOV #FILBUF+RS.LEN,R3 ;copy color map values CLR R1 1$: CMP R3,BUFPTR ;is copy done BHIS 2$ ;branch if yes BIC #177400,@#VCGREG+VCGCTL ;no. bop another one BIS R1,@#VCGREG+VCGCTL MOV (R3)+,R0 SWAB R0 MOV R0,@#VCGREG+VCGBUF ADD #400,R1 BR 1$ ; 2$: CLR YPOS ;initialize pointers MOV #1,SERDES BIS #VC.WDW,@#VCGREG+VCGCTL 3$: MOV YPOS,R0 ;set y position ASH #8.,R0 RORB R0 BIC #177600,@#VCGREG+VCGCTL BIS R0,@#VCGREG+VCGCTL MOV #VCGWDW,R1 ;get next line MOV #128.,R2 4$: JSR PC,BINP ;get next data word BCS 5$ ;branch if error MOV R0,(R1)+ SOB R2,4$ INC YPOS CMP YPOS,YMAX ;is this last line BLO 3$ ;branch if no 5$: CLC ;yes. normal return RTS PC ; ; Subroutine to read buffer ; Returns r0 = byte ; BINP: TST NWORDS ;is buffer empty BNE 1$ ;branch if no MOV #FILBUF,BUFPTR ;yes. read next buffer .READW #ARGBLK,#3,#FILBUF,#MAXSIZ*256.,FILBLK BCS 2$ ;branch if error MOV R0,NWORDS ;ok. update pointers ADD #MAXSIZ,FILBLK 1$: MOV @BUFPTR,R0 ;read byte ADD #2,BUFPTR DEC NWORDS CLC RTS PC ; 2$: TSTB @#52 ;bad read. is it eof BEQ 3$ ;branch if yes FORMAT #COM14,#QUELST ;file read error 3$: SEC ;error exit TKRPLY: RTS PC ;siberian railroad ; ; Data segment ; .PSECT $BOSD,RO,D ; MAGIC: .WORD 123131,112552 ;sun image file magic identifier (?!) FAXMGC: .WORD 034114 ;facsimile file identifer COM14: .ASCIZ '?PRTQ-F-File read error ^F' .EVEN ; ; Variables ; LPMODE: .BLKW 1 ;image mode (landscape/portrait) ARGBLK: .BLKW 5 ;rt-11 argument block YPOS: .BLKW 1 ;current y position (0-511) XMAX: .BLKW 1 ;max x pels (1-640) YMAX: .BLKW 1 ;max y pels (1-512) LENGTH: .BLKW 2 ;image length (pels) SERDES: .BLKW 1 ;assembly register NWORDS: .BLKW 1 ;words remaining BUFPTR: .BLKW 1 ;buffer pointer ; .END