M EQU Byte Ptr 0[BX] TITLE 'Color Printer Setup' DGROUP GROUP DATA ; **************************************************************************** ; * * ; * SETUP3 : SETUP BITMAP ACCESSING PARAMETERS for Color Printer GIOS * ; * * ; **************************************************************************** ; * ; Revision : Jan. 12, 1984 FILE "ZSETUPC.A86" GSX-86 V1.3 1-1 * ; * ;***** MODE NOTES : ********************************************************* ; JAN. 12, 1984 Allocates 32k bytes memory block for bit map buffer, the * ; bitmap buffer size and segment address are now set at open * ; workstation 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) * ; * ; Input : * ; * ; XMAX, YMAX are the Maximum Plot extents * ; zxmax The Maximum Device Width in Pixels * ; * ; Program constants : * ; * ; BSIZE : The allocated BITMAP buffer size in bytes * ; PIXL : No. of pixel wires 'Plotted' per Graphic byte sent to the * ; printer * ; * ; 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)* ; PIXL : No. of pixels per graphics print line (DIABLO = 1) * ; * ; PLINE : No. of Print Lines per BITMAP buffer (Plot Strip) * ; Buffer size / Bytes per Print Line * ; WIRE : No. of vertical Pixels per Graphic Print Pass (DIABLO = 4) * ; * ; Nuline: Offset size (bytes) to start of next Print Line in BITMAP * ; * ; NSTRIP: No. of Plot Strips to Raster Scan per Plot * ; * ; YSIZE : No. of Vertical Pixels per Plot strip (PLINE * WIRE) * ; * ; MAPEND: End of BITMAP buffer address * ; * ; PSIZE : Actual Buffer Size used for each Plot Strip * ; * ; MPTY : Bitmap Buffer Empty Flag, Set by SETBIT, Cleared by CLRBUF * ; * ;----------------------------------------------------------------------------+ PUBLIC SETUPS, CLRBUF EXTRN GSETUP:near EXTRN NEGHL:near, CMPDH:near, MIDH:near, DIDH:near DSEG PUBLIC MAPEND, MPTY, BYTEND PUBLIC XW, YW, PLINE, NSTRIP, YSIZE PUBLIC XMAX, YMAX, XMIN, YMIN, OBJCNT PUBLIC BMIN Extrn cormap_size:word EXTRN zxmax:word, OBJLST:word, LASTBAND:WORD EXTRN PIXL:word, WIRE:word, BSIZE:word EXTRN BITMAP:word, MAP1:word, MAP2:word, MAP3:word Extrn 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 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 xw NSTRIP RS 01 ;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 4 Microlines 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 04 ;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: ; Figure out the single colot bit map buffer size ; cormap_size = Bitmap_size / 4 Mov Ax, Word Ptr Bitmap_size Mov Dx, 0 Mov Bx, 4 Div Bx Mov Word Ptr Cormap_size, Ax ; 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 ; For DIABLO, each pass prints four (WIRE) lines ; bmin = Mimimum bitmap buffer size in Bytes = xw * wire mov cx, word ptr WIRE ; No. of Pixels per print 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 cormap_size MOV DX,0 ; buffer size = bsize / 4 DIV Word Ptr BMIN ;pline = buffer size / bmin MOV Word Ptr PLINE,AX ;Stack pline Mul Word Ptr WIRE ; for DIABLO, there are 4 pixel lines per print pass ; PDOTS: the No. of lines (Vertical Pixels) per pline is (PLINE x 4) Mov Word Ptr PDOTS, Ax ; yw = ymax + 1 No. of vertical pixels for this plot mov ax, word ptr ymax CMP ax, 0 JBE SETJ05 ;HANDLE Y <= 0 CONDITION ;yw = ymax + 1 inc ax jmp setj01 SETJ05: MOV AX,1 MOV Word Ptr YMAX,AX SETJ01: MOV Word Ptr YW, AX ; = yw ; PDOTS = No. of Print Lines per Plot Strip ; If yw < pdots, Plot needs less than one Strip ; nstrip = yw / Pdots SETJ03: mov bx, word ptr pline mov word ptr lastband, bx Mov Bx, Word Ptr PDOTS MOV AX, word ptr yw ; = yw MOV DX,0 DIV bx ;nstrip = yw / PDOTS ; Is yw a multiple of pline ? CMP DX,0 ;remainder in JE SETJ02 ;Add one strip for non-zero remainders Inc Ax Mov Word Ptr NSTRIP, Ax Mov Ax, Dx Mov Dx, 0 Mov Bx, Word Ptr WIRE Div Bx Cmp Dx, 0 Je SETJJ2 Inc Ax SETJJ2: Mov Word Ptr LASTBAND, Ax Jmps SETJJ3 SETJ02: MOV Word Ptr NSTRIP,AX ; = nstrip SETJJ3: MOV AX, WORD PTR bmin MUL Word Ptr PLINE ; = pline * bimn MOV Word Ptr PSIZE,AX ;Actual Buffer size in Bytes ; Adjust the Relative Address pointer to bitmap buffers later ;;;;;; ADD AX,(Offset BITMAP) ; = (pline * xw) + bitmap Add Ax, Word Ptr Bitmap_offset mov word ptr bytend, ax ; Ysize = -(Wire * Pline) + 1 ; No. of vertical dots plotted in each plot strip ; used to compute the starting y value for the next strip MOV AX,Word Ptr PLINE mov bx, Word ptr WIRE neg bx mul bx INC AX MOV Word Ptr YSIZE,AX ; = Ysize ; Get the starting byte address for the bit map ; 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, Word Ptr Bitmap_offset ; Get buffer address 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 Mov Word Ptr Mpty+2, Ax RET END