M EQU Byte Ptr 0[BX] TITLE 'Monochrome Printer Setup' DGROUP GROUP DATA ; **************************************************************************** ; * * ; * SETUPS : SETUP BITMAP ACCESSING PARAMETERS for Monochrome Printer GIOS * ; * * ; **************************************************************************** ; * ; Revision : Jan. 03, 1984 FILE "ZSETUP40.A86" Version 1.0 * ; * ;***** MODE NOTES : ********************************************************* ; Dec-22-83 Allocate memory block for Bit map buffer, the bit map buffer * ; size and address segment and offset are now set at open work- * ; station time * ; * ; PRINTER SETUP MODULE * ; * ; SET UP BITMAP ACCESSING PARAMETERS FOR PRINTER * ; * ; Setups (xmax, ymax) * ; * ; Function : * ; * ; Compute the following variables at runtime to support * ; the BITMAP buffer Access by the Vector rasterization * ; and Bitmap Scanner Routines (RASTER and SCANIT) * ; Program constants : * ; * ; BSIZE : The allocated BITMAP buffer size in bytes * ; PIXL : No. of pixel wires 'Plotted' per Graphic byte sent to the * ; Printer: Vertical pixels per scan line (DIABLO = 1) * ; (DEC LA50 = 6), (Epson = 8), (Datasouth = 6),... * ; WIRE : No. of vertical Pixels per Graphic Print Pass (DIABLO = 4) * ; No. of wires in the Print Head, or for the Epson double * ; density, wire = two print pass = 16 dots * ; * ; Input : * ; * ; XMAX, YMAX are the Maximum Plot extents in pixels * ; zxmax The Maximum horizontal display surface in Pixels * ; * ; Output : * ; * ; XW : No. of bytes per Horizontal Print Line * ; Line Width in pixels (XMAX) / 8 * ; YW : No. of Print lines per Vertical Plot page * ; Plot Height in pixels (YMAX) / pixels per Graphics Line (WIRE)* ; PLINE : No. of Print Lines per BITMAP buffer (Plot Strip) * ; Buffer size / Bytes per Scan Line * ; * ; NSTRIP: No. of Plot Strips to Raster Scan per Plot * ; * ; YSIZE : No. of Vertical Pixels per Plot strip (PLINE * WIRE) * ; * ; BYTEND: End of BITMAP buffer address * ; * ; MAPEND: Pointer to the First Byte from bitmap to start output scan * ; * ; PSIZE : Actual Buffer Size used for each Plot Strip * ; * ; MPTY : Bitmap Buffer Empty Flag, Set by SETBIT, Cleared by CLRBUF * ; * ;----------------------------------------------------------------------------+ PUBLIC SETUPS, CLRBUF, ZSETCOR EXTRN GSETUP:near ; EXTRN NEGHL:near, CMPDH:near, MIDH:near, DIDH:near ; EXTRN POUT:near DSEG PUBLIC MAPEND, MPTY, BYTEND, BMIN PUBLIC XW, YW, NEGXW, PLINE, NSTRIP, YSIZE PUBLIC XMAX, YMAX, XMIN, YMIN, OBJCNT EXTRN zxmax:word, OBJLST:word, LASTBAND:WORD EXTRN PIXL:word, WIRE:word ; Extrn BSIZE:word, WORDCOUNT:word EXTRN BITMAP:word, Bitmap_Offset:word Extrn Bitmap_size:word, Bitmap_words:word dseg ;----------------------------------------------------------------------------+ ; The following variables are computed at runtime : + ;----------------------------------------------------------------------------+ ; ; XMAX,YMAX = Maximum Plot Extent (varys from plot to plot) ; XMAX DW 00 ;XMAX = Pixels per Print line width (bits) YMAX DW 00 ;YMAX = Pixel per Plot height XMIN DW 07FFFH YMIN DW 07FFFH BMIN RS 02 ;BMIN = Minimum Buffer size in Bytes XW RS 02 NEGXW RS 02 YW RS 02 ;No. of Print Lines for this plot ;YW = YMAX div PIXL PLINE RS 02 ;No. of Graphic Print Lines per BITMAP ;PLINE = BSIZE div BMIN NSTRIP RS 02 ;No. of Plot Strips to clip the plot for ;output, NSTRIP = YW div PLINE ;YW = Total no. of vertical Print Lines per ;Plot, YW = YMAX div PIXL + 1 PDOTS Rs 02 ;No. of Vertical dots in each STRIP: PLINE*WIRE YSIZE RS 02 ;No. of vertical Pixels per Print Line ;----------------------------------------------------------------------------+ ; BITMAP BUFFER and OBJECT LIST BUFFER VARIABLES + ;----------------------------------------------------------------------------+ MAPEND RS 02 ;Address of Last Row of Actual Buffer ;MAPEND= (PLINE * xw) + BITMAP - XW BYTEND rs 02 PSIZE RS 02 ;Size of Actual Buffer used for each Plot Strip ;The BITMAP buffer is not always entirely used MPTY RS 02 ;If 0 : The BITMAP is Empty OBJCNT RS 02 ;Total No. of Objects Stored in Object List cseg ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; This module sets up the Plot Strip variables for RASTER ; ; and SCANNER modules to access the BITMAP BUFFER properly ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SETUPS: ; XW = (xmax / 8) + 1 Print line width in bytes MOV DX, Word Ptr ZXMAX ;Check Xmax < ZXMAX MOV ax, Word Ptr XMAX CMP DX, ax JGE SETJ06 ;ZXMAX > Xmax ? MOV Word Ptr XMAX, dx ;Xmax = ZXMAX mov ax, dx SETJ06: ; XW is the number of data bytes per line ; xw = (xmax div 8) + 1 mov cx, 8 mov dx, 0 div cx ; xw = xmax div 8 inc ax mov word ptr xw, ax ; bmin = Mimimum bitmap buffer size in Bytes = xw * wire mov cx, word ptr WIRE ; No. of vertical Pixels per pass mul cx mov word ptr BMIN, ax ; pline = bsize / bmin Print lines per band (PLot Strip) SKIP1: ;;;;; MOV AX,BSIZE ; = bsize Mov Ax, Word Ptr Bitmap_size MOV DX,0 DIV Word Ptr BMIN ;pline = bsize / bmin MOV Word Ptr PLINE,AX Mul Word Ptr WIRE Mov Word Ptr PDOTS, Ax ; yw = The no. of print lines for this plot ; Yw = (Ymax / Wire) + 1 mov ax, word ptr ymax CMP ax, 0 JBE SETJ05 ;HANDLE Y <= 0 CONDITION Mov Bx, Word Ptr Wire Mov Dx, 0 Div Bx Inc Ax jmp setj01 SETJ05: MOV AX,1 MOV Word Ptr YMAX,AX SETJ01: MOV Word Ptr YW, AX ; = yw ; If yw < pline = This Plot needs less than one Plot Strip ; Tailor the no. of print lines to the size of the plot : YW CMP AX, Word Ptr PLINE JGE SETJ03 ;If PLINE < Yw, no change ; If Pline > Yw, Use Yw as Pline MOV Word Ptr PLINE, AX ; nstrip = yw / Pline SETJ03: mov bx, word ptr pline ; Initialize print lines in the last strip mov word ptr lastband, bx MOV DX,0 DIV bx ;nstrip = yw / Pline ; Is yw a multiple of pdots ? CMP DX,0 ;remainder in JE SETJ02 ; Add one strip for non-zero remainders Inc Ax ; The remainder in Dx is the no. of print lines ; to output in the last plot strip : lastband. ; For printer GIOS with a large bit map buffer, this will prevent ; too many blank lines being generated at the end of the plot. Mov Word Ptr Lastband, Dx SETJ02: MOV Word Ptr NSTRIP,AX ; = nstrip MOV AX, WORD PTR bmin MUL Word Ptr PLINE ; = pline * bimn MOV Word Ptr PSIZE,AX ;Actual Buffer size in Bytes ; ;;;;;;; ADD AX,(Offset BITMAP) ; = (pline * xw) + bitmap Add Ax, Word Ptr Bitmap_offset Mov word ptr Bytend, ax ; Ysize = -(Wire * Pline) + 1 ; No. of wires in each plot strip, used to compute the beginning ; Y value of the next plot strip. ; Each plot strip defined by TOPY (max. y) and BOTY (min. y) ; where BOTY = TOPY - YSIZE MOV AX,Word Ptr PLINE mov bx, Word ptr WIRE neg bx mul bx INC AX MOV Word Ptr YSIZE,AX ; = Ysize ; Get the buffer Address of the first byte to start ; scanning bit image for output ; Returns MAPEND which points to the First dot of the ; top pixel row in bitmap for this plot ; and Setup Printer for Graphics Image Mode CALL GSETUP RET ;----------------------------------------------------------------------------+ ; Clear BITMAP Buffer for Next Plot Strip + ;----------------------------------------------------------------------------+ CLRBUF: Mov Cx, Word Ptr Bitmap_words ; Get Buffer Word Count ;;;;;;; MOV BX,(Offset BITMAP) ;Get Start Address Mov Bx, Word Ptr Bitmap_offset MOV AX, 0 CLRL01: MOV Es:word ptr 0[bx], Ax ;Clear the word INC BX ;Next byte address Inc Bx DEC CX ;Decrement byte count JNZ CLRL01 ;More Bytes MOV Word Ptr MPTY, Ax ;Clear BITMAP buffer MPTY flag RET ;----------------------------------------------------------------------------+ ; Set Color Parameters, this entry is here for compatibility with color + ; printer gios, so the output primitive routines are the same for both + ; monochrome and color printer drivers + ;----------------------------------------------------------------------------+ ; Color Index in , Called by dotext, domark, dodraw(line), and dofill ; This routine get the printer color command parameter for that color index. ZSETCOR: ;;;; MOV Bh, 0 ; --> Output Primitive color index ;;;; Mov Al, Byte Ptr CBITS[Bx] ;;;; Mov Byte Ptr COLORBIT, Al RET END END