M EQU Byte Ptr 0[BX] DGROUP GROUP DATA TITLE 'zpl - POLYLINE' ;***************************************************************************** ; * ; POLYLINE : Increment Object Count, Update XMAX and YMAX and * ; Store Opcode, Npt, Px and Py in Object List Buffer * ; * ;***************************************************************************** ; * ; REVISION : Aug. 25, 1983 File "ZPL.A86" Version : 1.0 * ; * ; Zpl (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 polyline (npt) * ; ptsin - array of coordinates of polyline 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 ZPL * ; SS:BP -> Parameter Block Pointers * ; ES:DI -> Address of Contrl array * ; * ; 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 : * ; PUTPT - Put coord. into OBJLST buffer * ; GETMAX - Returns the larger value of the , in * ; * ;***************************************************************************** PUBLIC ZPL EXTRN PUTPT:near, GETMAX:near EXTRN PUTBYT:near, msgout:near dseg EXTRN XMAX:word, YMAX:word, OBJCNT:word EXTRN OBJLST:word, BNEXT:word, dline:byte NPT RS 1 cseg ;----------------------------------------------------------------------------+ ; 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 + ;----------------------------------------------------------------------------+ ZPL: ; 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 zldo ; do nothing if draw flag = 0 ret zldo: INC Word Ptr OBJCNT ;Increment OBJCNT ; Get Opcode, Contrl = Address of Contrl array MOV AL,6 ; = Opcode CALL PUTBYT ;;;; mov ax,07 ;;;; call msgout ; I'm here LES DI,CONTRL[BP] MOV AX,ES:W_2[DI] ; = Npt MOV Byte Ptr NPT,AL CALL PUTBYT ;----------------------------------------------------------------------------+ ; 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] ;Address of PTSIN array MOV AL,Byte Ptr NPT ZPLL01: ;Save Npt on stack PUSH AX MOV DX,ES:W_1[DI] ADD DI,2 CMP DX,Word Ptr XMAX JLE ZPLJ01 MOV Word Ptr XMAX,DX ZPLJ01: CALL PUTPT ;Store x-coord. into OBJLST MOV DX,ES:W_1[DI] ADD DI,2 CMP DX,Word Ptr YMAX JLE ZPLJ02 MOV Word Ptr YMAX,DX ZPLJ02: CALL PUTPT ;Store y-coord. into OBJLST POP AX DEC AL JNZ ZPLL01 ;There are more points in PTSIN RET END