M EQU Byte Ptr 0[BX] TITLE 'Output one Line - EPSON Single 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 Low Res. ; ; ; MSB = Top wire, 8 dots per byte, Single Density Mode ; ; ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; Revision : Jan. 04, 1984 File "ZSCANFXL.A86" Version 1.0 ; ; ; ; GSCAN (Bytptr, Bytcount) ; ; ; ; Function : SCAN and discard any trailing blanks in an output buffer, ; ; before sending the non-blank data bytes to the printer ; ; ; ; 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 ; ; ; ; 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 ; ; Register ES: Bitmap Buffer Segment Address must be saved ; ;----------------------------------------------------------------------------; ; 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 Genter:near, pout:near dseg EXTRN XW:word, ISTBYT:word extrn Pixl:word, TMPXW:word, BWIDE:word cseg GSCAN: ; 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 ; The Above Check loop leaves the Number of significant data bytes ; for the current print line in Mov Word Ptr TMPXW, Ax Mov Bx, 8 ; Multiply by 8 to get the No. of Mul Bx ; graphics data byte to send to the printer 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 ; Get the bit map address pointer for this print line: ISTBYT and ; the no. of non-blank data bytes to scan: TMPXW ; Call BYTOUT routine to scan and output one print line MOV Dx, Word Ptr TMPXW Mov Bx, Word ptr ISTBYT ; for i = 1 to byte count Call BYTOUT ; Output this line nobyte: 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 ; Bitmap Buffer Segment address Jne C_done ; Returns zero flag set if all bytes ; checked are zero. Sub Bx, word ptr XW ; Points to the byte in next pixel line Dec Ch ; decrement pixel count 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 bute ; ; 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 Dx ; Save Shift Counter and Bit counts Push Cx Push Es Call MSKout ; Get the desired bits from bitmap ; Returns the graphics byte in
Onebyt: Call Pout ; Output byte in
Pop Es Pop Cx Pop Dx POP Bx ; The Current 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) ; ; PIXL - No. of bits to transpose until final result ; ; ; ; Output :
- Printer graphic byte with bit pattern transposed ; ; from BITMAP ; ; ; ; Calls : None ; ; ; ;------------------------------------------------------------------------; ; ; CALL MSKOUT ; Bx = NBYT, start address ; CH = NBIT, mask ; CL = PIXL, loop count ; Dx = Count to shift bits into correct print wire position ; RET ; Dl = RESULT, on 'RETURN' ; BX = unchanged mask ; All other reg clubbered ; MSKOUT: PUSH DX ;Save away shift counter ; 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 Top pixel going 'down'. Sub BX,word Ptr XW ; BX Points to dots in the next ; 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 shift count 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