M EQU Byte Ptr 0[BX] TITLE 'ZBAR - GENERALIZED DRAWING PRIMIVITES' ;***************************************************************************** ; * ; ZBAR : Increment Object Count, Update XMAX and YMAX and * ; Store Opcode, Npt, Px and Py in Object List Buffer * ; * ;***************************************************************************** ; * ; REVISION : Aug. 25, 1983 File "ZBAR.A86" Version 1.0 * ; * ; Zgdp * ; * ; Description : * ; * ; 1) Get Opcode from Contrl array, Check Opcode * ; 1b) Check the Draw Flag, do nothing if it is zero * ; 2) Increment OBJCNT * ; * ; 3) Get Points from PTSIN array, Update Max/Min Plot extent XMAX,YMAX * ; * ; 4) Setup Object List Buffer with a Polygon Function for Bar Fill * ; Opcode = 9, Npt = 4, four Corners : x1,y1,x2,y1,x2,y2,x1,y2 * ; add the first point to close the polygon x1,y1 * ; the Min. extent x1, y1 and the Max extent : x2,y2 * ; * ; * ; Input : * ; contrl(1) - opcode = 11 * ; contrl(2) - no. of (x,y) pairs in polyline (npt) * ; ptsin - corners of the bar in pixel space * ; ptsin(1,2) = x1,y1 * ; ptsin(3,4) = x2,y2 * ; * ; Output : * ; contrl(3) - 0 * ; * ; CALL ZGDP * ; * ; Program Variables : * ; XMAX - Maximum Plot extent x-axis * ; YMAX - Maximum Plot extent y-axis * ; OBJCNT - Count of Object in the Object List Buffer * ; OBJLST - Object List Buffer * ; * ; Calls : * ; GETPT - Get coord. from PTSIN array * ; PUTPT - Put coord. into OBJLST buffer * ; PUTBYT - Puts byte into the OBJLST buffer * ; GETMAX - Returns the larger value of the , in * ; * ;***************************************************************************** PUBLIC ZGDP, ZBAR, zcell EXTRN PUTPT:near, CMPDH:near, GETMAX:near EXTRN PUTBYT:near, msgout:near dseg EXTRN XMAX:word, YMAX:word, OBJCNT:word, OBJLST:word extrn dfill:byte, dline:byte ;----------------------------------------------------------------------------+ ; EQUATES FOR ARGUMENTS ADDRESSING + ;----------------------------------------------------------------------------+ CONTRL EQU Dword ptr 2 ; Control Parameter Block INTIN EQU Dword ptr 6 ; Integer Input Parameter Block PTSIN EQU Dword ptr 10 ; Point Coordinates Input Array INTOUT EQU Dword ptr 14 ; Integer output Parameter Block PTSOUT EQU Dword ptr 18 ; Point Coordinates Output Array ;----------------------------------------------------------------------------+ ; Define Word Displacements to Successive Entries in a Word Array + ;----------------------------------------------------------------------------+ W_1 EQU Word ptr 0 W_2 EQU Word ptr 2 W_3 EQU Word ptr 4 W_4 EQU Word ptr 6 W_5 EQU Word ptr 8 W_6 EQU Word ptr 10 W_7 EQU Word ptr 12 W_8 EQU Word ptr 14 W_9 EQU Word ptr 16 W_10 EQU Word ptr 18 barx1 rw 1 bary1 rw 1 barx2 rw 1 bary2 rw 1 barpts rw 14 ix rw 1 cseg ;----------------------------------------------------------------------------+ ; Increment OBJCNT + ; Store Opcode and Npt in OBJLST + ;----------------------------------------------------------------------------+ ZGDP: ; Get Opcode, Contrl = Address of Contrl array on Stack LES DI,CONTRL[BP] ;MOV DX,ES:W_1[DI] ; = Opcode MOV AX,ES:W_6[DI] ; Determine GDP opcode CMP AX,1 ; See if it is a bar JE L@1 RET ; Primitive was not a bar L@1: call zbar ret eject zcell: ; draw flag dline is set by set color routine zlnco ; if color = 0 and mode is not replace then drawing this object = nop ; so, no data is stored in the object list buffer for this object cmp dline, 0 jne zcdo ; do nothing if draw flag = 0 ret zcdo: mov al, 10 ; Use Polyline Routine to outline the ; Cell Array call putbyt mov al, 05 ; 5 points call putbyt mov ix, 10 ; Set up 10 coordinates in OBJLST call zbox ; Get the Cell Corner points and put ; in OBJLST ret zbar: ; draw flag dfill is set by set color routine zfico ; if color = 0 and mode is not replace then drawing this object = nop ; so, no data is stored in the object list buffer for this object cmp dfill, 0 jne zbdo ; do nothing if draw flag = 0 ret zbdo: ;;;; mov ax, 06 ; I'm here ;;;; call msgout ; use Polygon Fill Routine for Bar Fills MOV al,11 ; Setup GDP Bar Fill Opcode CALL putbyt ; Store opcode in OBJLST mov al, 01 ; GDP Bar id call putbyt ; Object List Buffer for Bar Fill is the same as for Fill area except the ; 2 Opcode Bytes, no. of vertices = 4 for bar mov al, 04 ; Set up Parameter List in Object List call putbyt ; Buffer for Fill Area to do Bar Fill mov ix, 14 ; put 14 Coordinates in OBJLST zbox: INC Word Ptr OBJCNT ; Increment OBJCNT ;----------------------------------------------------------------------------+ ; Get the vertices from PTSIN array + ; Update XMAX,YMAX and store the points in OBJLST + ;----------------------------------------------------------------------------+ ; Get the Address of PTSIN array ; = No. of points in PTSIN LES DI,PTSIN[BP] MOV AL,2 ; Get lower left and Upper Right points mov bx, offset barx1 BARL01: ;Save Npt on stack PUSH AX MOV DX,ES:W_1[DI] ADD DI,2 CMP DX,Word Ptr XMAX JLE BARJ01 MOV Word Ptr XMAX,DX ; Update Xmax BARJ01: mov w_1[bx], dx add bx,2 MOV DX,ES:W_1[DI] ADD DI,2 CMP DX,Word Ptr YMAX JLE BARJ02 MOV Word Ptr YMAX,DX ;Update Ymax BARJ02: mov w_1[bx], dx add bx, 2 POP AX DEC AL JNZ BARL01 ;There are more points in PTSIN mov bx, offset barpts mov ax, barx1 mov w_1[bx], ax mov w_7[bx], ax mov w_9[bx], ax mov word ptr 20[bx], ax mov ax, bary1 mov w_2[bx], ax mov w_4[bx], ax mov w_10[bx], ax mov word ptr 22[bx], ax mov ax, barx2 mov w_3[bx], ax mov w_5[bx], ax mov word ptr 24[bx], ax mov ax, bary2 mov w_6[bx], ax mov w_8[bx], ax mov word ptr 26[bx], ax mov bx, offset barpts zbar01: mov dx, w_1[bx] add bx,2 push bx call putpt pop bx dec ix jnz zbar01 RET END