M EQU Byte Ptr 0[BX] TITLE 'Output two interlaced Line - EPSON Double Density' DGROUP GROUP DATA ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; ; ; GSCAN : SCAN and discard trailing blanks in a output image line, ; ; ; before output the non-blank data bytes to printer ; ; ; Monochrome printer, modified from zscanids for epson high res. ; ; ; MSB = Top wire, 8 dots per byte, Double Density, ; ; ; Interlaced bit map output. ; ; ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; Revision : Jan. 03, 1984 File "ZSCANFX8.A86" Version 1.0 ; ; Jan-03-84: Link with module PRINTIO for BDOS printer output function. ; ; Link with module ZPRINTIO for PC DOS ROM BIOS printer output. ; ; Dec-20-83: ; ; Use ES as bitmap Buffer segment address instead of DS, Bitmap buffer may ; ; Have been dynamically allocated ; ; ; ; GSCAN (Bytptr, Bytcount) ; ; ; ; Function : SCAN and discard any trailing blanks in an output buffer, ; ; before sending the non-blank data bytes to the printer ; ; ; ; First output the even dot lines in the print line ; ; Get Data from bit map ; ; while byte = 0 ; Starting from the last byte ; ; decrement bytptr ; Update byte pointer ; ; byte = byte [bytptr] ; get next byte ; ; decrement byte count ; ; ; end while ; ; call bytout(byte count); Output bit image to printer ; ; Repeat and output the odd dot lines ; ; ; ; Input : XW - No. of bytes per print line ; ; ISTBYT - Address pointer to the first byte ; ; ; ; Calls : BYTOUT - Scan and output image bytes to through LST: device ; ; ; ;----------------------------------------------------------------------------; ; CALL GSCAN ; ISTBYT = Address pointer of first byte in buffer ; XW = No. of Bytes in print line to check ; RET ; cseg PUBLIC GSCAN, BYTOUT extrn esc3:near, genter:near, pout:near dseg EXTRN XW:word, XWTWO:word, ISTBYT:word extrn Pixl:word, TMPXW:word, BWIDE:word cseg GSCAN: ; First output the even dots, line feed one dots, then output the ; odd dots. Mov Cl, 2 onepass: Push Cx ; ISTBYT = first byte address in bitmap to start scanning bit pattern Mov Bx, Word Ptr ISTBYT MOV Ax, Word Ptr XW ; No. of Data bytes per Line ; Initialize byte count and byte pointer Add Bx, Ax Inc Ax ; Start from end of line ; for j = XW to 1 ckloop: Dec Bx ; Next byte address Dec Ax ; Decrement byte count Jz nobyte ; byte count = zero, output no data byte Call CMP_BLANK ; Check buffer for BLank bytes jz ckloop ; New Xw = AX = byte count for a single pixel line Mov Word Ptr TMPXW, Ax Mov Bx, 8 Mul Bx Mov Word Ptr BWIDE, Ax ; BWIDE = Xw x 8 = No. of graphics bytes sending to the printer ; Xw = No. of graphics bytes per single pixel, each print pass ; prints eight vertical pixels Call GENTER ; Printer Graphics Image Mode command ; TMPXW = No. of non-blank bytes in this 8 pixel Print Line MOV Dx, Word Ptr TMPXW ; ISTBYT = first byte address in bitmap to start scanning bit pattern Mov Bx, Word ptr ISTBYT ; for i = 1 to byte count Call BYTOUT ; Output this line nobyte: Pop Cx ; Output two lines for each gscan call Dec Cl jz scandone ; micro line feed 1/3 dot, setup buffer pointer to the odd lines ; output the odd lines Call Esc3 Mov Bx, word ptr XW Sub word ptr ISTBYT, Bx Jmp onepass scandone: RET ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ; This routine checks for any trailing blanks in the data line, ; blank data bytes are discarted before the non-zero graphics ; data bytes are send to the printer. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= CMP_BLANK: ; = bitmap data Byte address ; PIXL = the no. of bytes to check Push Bx Mov Ch, Byte Ptr PIXL NextB: Cmp Es:m, 0 Jne C_done Sub Bx, word ptr XWTWO ; Byte in next odd or even pixel line Dec Ch ; Check all 8 pixels Jnz Nextb C_done: Pop Bx Ret ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; ; ; BYTOUT : SCAN OUTPUT from BITMAP to PRINTER (one vertical print pass) ; ; ; Graphics byte MSB = Top Wire, LSB = Bottom Wire ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; bytout (nbyt) ; ; ; ; Function : SCAN and OUTPUT XW Bytes from BITMAP to PRINTER ; ; ; ; Mask out PIXL bytes of bit pattern from BITMAP (starting ; ; at NBYT) into graphic byte format befor output to printer ; ; ; ; PIXL = No. of bits printed in each graphic byte ; ; Espon Prints 8 dots per byte, ; ; DIABLO Prints 8 bits per byte ; ; for i= 1 to xw ; ; output byte ; ; ; ; Input : NBYT - Starting byte position in BITMAP buffer ; ; ; ;----------------------------------------------------------------------------; ; ; CALL BYTOUT ; Dx = Xw, No. of Bytes to Output ; Bx = NBYT, start address in BITMAP ; RET BYTOUT: PUSH Dx ; Save Word Count Push Bx One_byte: Mov Dx, 0801H ; the loop and shift count used by ; Maskout routine Mov Ch, 80H ; Start Bitmask Repeat: Mov Cl, Byte Ptr PIXL ; No. of Vertival Pixels to Mask out Push Bx ; Save byte address Push Cx Push Dx ; Save Shift Counter and bit count Push Es Call MSKout ; Get the desired bits from bitmap ; Returns the graphics byte in
Onebyt: Call Pout ; Output byte in
to printer Pop Es Pop Dx Pop Cx POP Bx ; The Byte address ROR Ch, 1 ; Update the bitmask to next bit position Inc Dl ; update Shift counter Dec Dh ; loops 8 bit positions Jnz repeat Pop BX Pop Dx Inc Bx ; Next Bitmap Byte address Dec Dx ; Decrement Byte count Jnz BYTOUT RET ; ; ; Mskout (nbyt, nbit, result) ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; Mask out data bits from bytes BITMAP(nbyt), BITMAP(nbyt+ ; ; XW*1),..., BITMAP(nbyt+XW*PIXL) ; ; PIXL = No. of bits printed in each graphic byte ; ; Datasouth = 6, Prism = 7, DEC LA50 = 6 ; ; for i = 1 to pixl { ; ; bit = bitmap(nbyt) ^ mask ; ; byte = (byte v bit) ; ; shift byte left to make room for next bit ; ; nbyt = nbyt + (xw * pixl) } ; ; ; ; INPUT : ; ; NBYT - BYTE POSITION TO TRANSPOSE FROM BITMAP ; ; NBIT - Bit position to transpose from BITMAP ; ; XW - No. of bytes per print line (row order in buffer) ; ; used to calculate offset to the same byte in next line; ; PIXL - No. of bits to transpose until final result ; ; ; ; Output : RESULT - Printer graphic byte with bit pattern transposed ; ; from BITMAP ; ; ; ; Calls : None ; ; ; ;----------------------------------------------------------------------------; ; ; CALL MSKOUT ; Bx = NBYT, start address ; CH = NBIT, mask ; CL = PIXL, loop count ; Dl = Rotate Count ; RET ; Dl = RESULT, on 'RETURN' ; BX = unchanged mask ; All other reg clubbered ; MSKOUT: Push Dx ;Save the Rotate count in Dl ;Dl will be used as temporary reg. ; Bx points to Byte address in bitmap XOR AL,AL ;Clear work reg AGAIN: Rol AL,1 ;Make room for next bit MOV DL,AL ;Save temp result MOV AL,Es:M ;Get next byte from BITMAP AND AL,CH ;Leave only the desired bit OR AL,DL ;Combine with temp result ; Get Offset to same byte in next pixel line ; starting from bottom pixel going 'up'. Sub BX,word Ptr XWTWO ;BX Points to dots in the next ;even or odd pixel line DEC CL ;Done yet ? JNZ AGAIN ;No, continue ; ; The resulting bit pattern still needs to be rotated into correct ; Printer wire position : MSB = Top, LSB = Bottom ; Pop Dx ;Get the rotate count stored in DL ROTA: Rol AL,1 ;Rotate bits until correct position DEC DL JNZ ROTA ;Done yet ? MOV Dl,AL RET ;Return with result in Dl END