M EQU Byte Ptr 0[BX] TITLE 'zpm : POLYMAKER ' ;***************************************************************************** ; * ; POLYMARKER : Increment Object Count, Update XMAX and YMAX and * ; Store Opcode, Npt, Px and Py in Object List Buffer * ; * ;***************************************************************************** ; * ; REVISION : May 01, 1983 File "ZPM.A86" Version 1.0 * ; * ; Zpm (npt, px, py) * ; * ; Description : * ; * ; 1) Get Opcode and Npt from Contrl array and store in OBJLST Buffer * ; * ; 2) Increment OBJCNT * ; * ; 3) Get Points from PTSIN array, Update Max/Min Plot extent XMAX,YMAX * ; * ; 4) Store the Points in OBJLST Buffer, Update the BNEXT * ; * ; 5) Store the New BNEXT when all points are stored * ; * ; * ; Input : * ; contrl(1) - opcode = 6 * ; contrl(2) - no. of (x,y) pairs in polymarker (npt) * ; ptsin - array of coordinates of polymarker in pixel space * ; ptsin(1,2) = x1,y1 * ; ptsin(3,4) = x2,y2 * ; . * ; . * ; ptsin(2npt-1,2npt) = x,y of last point * ; * ; Output : * ; contrl(3) - 0 * ; * ; CALL ZPM * ; SS:BP -> Parameter Block Pointers * ; ES:DI -> Contrl(1) * ; * ; 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 * ; BNEXT - NEXT OBJLST Buffer location pointer * ; * ; Calls : * ; GETPT - Get coord. from PTSIN array * ; PUTPT - Put coord. into OBJLST buffer * ; GETMAX - Returns the larger value of the , in * ; * ;***************************************************************************** PUBLIC ZPM dseg EXTRN XMAX:word, YMAX:word, OBJCNT:word, OBJLST:word, BNEXT:word EXTRN PMKSZ:byte, dmark:byte cseg EXTRN PUTPT:near, SUBDH:near EXTRN GETMAX:near, PUTBYT:near ;----------------------------------------------------------------------------+ ; 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 ;----------------------------------------------------------------------------+ ; Increment OBJCNT + ; Store Opcode and Npt in OBJLST + ;----------------------------------------------------------------------------+ ZPM: ; draw flag dmark is set by set color routine zmkco ; 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 dmark, 0 jne zmdo ; do nothing if draw flag = 0 ret zmdo: INC Word Ptr OBJCNT ;Increment OBJCNT MOV AL,7 ;Store Opcode CALL PUTBYT ;ES:DI -> CONTRL(1) MOV AX,ES:W_2[DI] ; = Npt PUSH AX CALL PUTBYT ;----------------------------------------------------------------------------+ ; Get the vertices from PTSIN array + ; Update XMAX,YMAX and store the points in OBJLST + ;----------------------------------------------------------------------------+ LES DI,PTSIN[BP] ;Address of PTSIN array POP AX ;Get no. of Points ZPML01: ;Save Npt on stack PUSH AX ; = X-coord. from PTSIN MOV DX,ES:W_1[DI] ADD DI,2 ;----------------------------------------------------------------------------+ ; Adjust X, Y to Lower Left Corner position + ; Update XMAX, YMAX + ;----------------------------------------------------------------------------+ MOV BL,Byte Ptr PMKSZ ROR BL,1 ;Half Marker size MOV BH,0 PUSH BX PUSH DX SUB DX,BX ;X = X - (PMKSZ / 2) CALL PUTPT ;Store x-coord. into OBJLST POP DX ; = X POP BX ; = PMKSZ ;X2 = X + (PMKSZ / 2) ADD DX,BX CMP DX,Word Ptr XMAX JLE ZPMJ01 MOV Word Ptr XMAX,DX ZPMJ01: ; = Y-coord. from PTSIN MOV DX,ES:W_1[DI] ADD DI,2 MOV BL,Byte Ptr PMKSZ ROR BL,1 ;Half Marker size MOV BH,0 PUSH BX PUSH DX SUB DX,BX ;Y = Y - (PMKSZ / 2) CALL PUTPT ;Store Y-coord. into OBJLST POP DX ; = Y POP BX ; = PMKSZ / 2 ;Y2 = Y + PMKSZ / 2 ADD BX,DX CMP BX,Word Ptr YMAX JLE ZPMJ02 MOV Word Ptr YMAX,BX ;YMAX = ZPMJ02: POP AX DEC AL JZ L@1 JMP ZPML01 ;There are more points in PTSIN L@1: RET END