M EQU Byte Ptr 0[BX] TITLE 'ZTX : OUTPUT TEXT STRING' DGROUP GROUP DATA ;***************************************************************************** ; * ; TEXT : Increment Object Count, Update Plot Minimum and Maximum * ; Extent, Store Opcode, Nchr, Rotation flags, chrsiz, x1, * ; y1, and Text String in the Object List Buffer. * ; * ;***************************************************************************** ; * ; REVISION : Aug. 24, 1983 File : "ZTX.A86" Version 1.0 * ; * ;***** MODE NOTES : ********************************************************* ; * ; 11/14 1) Text String Size Extent = CHRSZ * Nchr : (6 pixels wide)/char. * ; 2) Character Size Extent = CHRHT : (8 pixels high)/char. * ; 3) Update XMAX, YMAX using both the TEXT and CHAR. Size Extents * ; 12/09 1) XLT86 * ;***** MODE NOTES : ********************************************************* ; ; ; * ; ZTX (nchr, x1, y1, ndtxrt, ndtxsz, character string) * ; * ; Description : * ; * ; 1) Get Opcode and Nchr from Contrl array and store in OBJLST Buffer * ; * ; 2) Increment OBJCNT * ; * ; 3) Get X1, Y1 from PTSIN array * ; * ; 4) Get Text Rotation flags and store in OBJLST * ; * ; 5) Compute the Text String size to Update Max/Min Plot extent XMAX,YMAX * ; * ; 6) Store the Chracter size and x1, y1 in the OBJLST buffer * ; * ; 7) Store the Character string in OBJLST * ; * ; * ; Input : * ; contrl(1) - opcode = 8 * ; contrl(4) - no. of chracters in text string (nchr) * ; ptsin - location of text string * ; ptsin(1,2) = x1,y1 * ; intin - character string, 1 char/word, char. in low byte * ; * ; Output : * ; contrl(3) - 0 * ; OBJLST - Object List Buffer Contains : * ; byte 1 : Opcode * ; 2 : Nchr * ; 3 : Rotation Flag * ; 4,5 : X * ; 6,7 : Y * ; 8,...: Character String, 1 Char. / Byte * ; * ; bnext - points to next location in OBJLST * ; * ; CALL ZTX * ; ES:DI -> Address of Contrl array * ; SS:BP -> Parameter Block Pointer * ; * ; Program Variables : * ; NDTXSZ - Current Character size * ; NDTXRT - Current Character rotation * ; CHRSZ - Current Character size based on NDTXSZ * 8 * ; CHRBOX - Character cell size 8 x 8 pixels * ; XMAX - Maximum Plot extent x-axis * ; YMAX - Maximum Plot extent y-axis * ; X2 - Min/Max Text extent * ; Y2 - Min/Max Text extent * ; OBJCNT - Count of Object in the Object List Buffer * ; OBJLST - Object List Buffer * ; bnext - Next OBJLST Buffer location pointer * ; * ; ROTATE - BIT 1=CHGXY, 2=CUP, 3=ROWINC, 4=COLINC * ; CHGXY = Change row, column flag due to character rotation * ; CUP = Character up flag, 90, 180 rotation * ; ROWINC= row increment flag, +/- 1 * ; COLINC= column increment flag * ; * ; FLGS - +-----------------------------+ * ; | rotate | 0 | 90 | 180 | 270 | * ; +--------+---+----+-----+-----+ * ; | chgxy | 1 | 0 | 1 | 0 | * ; +--------+---+----+-----+-----+ * ; | cup | 0 | 1 | 1 | 0 | * ; +--------+---+----+-----+-----+ * ; | rowinc | 1 | 1 | -1 | -1 | * ; +--------+---+----+-----+-----+ * ; | colinc |-1 | 1 | 1 | -1 | * ; +--------+---+----+-----+-----+ * ; * ;** NOTE ** * ;** The Character Cell is mapped using Character Up Vector, NOT * ;** The Character Base Vector -- this translate the angles : * ;** Base vector = Up vector * ;** 0 = 90 * ;** 90 = 180 * ;** 180 = 270 * ;** 270 = 0 * ;** * ; * ; Calls : * ; PUTPT : Put pt. coord. into OBJLST buffer (2 bytes) * ; PUTBYT : Put 1 byte into OBJLST buffer * ; GETMIN : Returns in the smaller of , values * ; GETMN0 : Returns in the smaller of , or zero if * ; the smaller value < 0 * ; GETMAX : Retruns in the larger of Values in and * ; MUL8 : = * 8 * ; * ;***************************************************************************** PUBLIC ZTX EXTRN MIDH:near, MUL8:near, NEGHL:near EXTRN PUTPT:near, PUTBYT:near EXTRN GETMIN:near, GETMAX:near, GETMN0:near dseg EXTRN NDTXSZ:byte, NDTXRT:byte, CHRSZ:byte, CHRHT:byte, dtext:byte EXTRN XMAX:word, YMAX:word, OBJCNT:word, OBJLST:word, bnext:word EXTRN XMIN:word, YMIN:word 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 Nchr in OBJLST + ;----------------------------------------------------------------------------+ ZTX: ; draw flag dtext is set by set color routine ztxco ; 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 dtext, 0 jne ztdo ; do nothing if draw flag = 0 ret ztdo: ;Contrl(4) = Nchr MOV AX,ES:W_4[DI] cmp al, 0 jne ztxj1 jmp ztxend ztxj1: MOV Byte Ptr NCHR,AL INC Word Ptr OBJCNT ;Increment OBJCNT mov ax, 08 ;opcode = 8 CALL PUTBYT mov al, Byte Ptr nchr CALL PUTBYT ;----------------------------------------------------------------------------+ ; Compute Character size CHRHT = NDTXSZ * 8 + ; and Text string TXTSZ = NCHR * CHRSZ (CHRSZ = NDTXSZ * 6) + ;----------------------------------------------------------------------------+ MOV Word Ptr ADJX,0 MOV Word Ptr ADJY,0 MOV cx,Word Ptr NDTXSZ MOV Word Ptr ADJSZ,cx MOV AX,Word Ptr CHRSZ ;----------------------------------------------------------------------------+ ; Extent of Text string updating XMAX, YMAX + ; If rotation = 0, X2 = X1 + CHRSZ, Y2 = Y1 - TXTSZ, ADJX = -NDTXSZ + ; 90, X2 = X1 + TXTSZ, Y2 = Y1 + CHRHT, ADJY = -NDTXSZ + ; 180, X2 = X1 - CHRSZ, Y2 = Y1 + TXTSZ, ADJX = +NDTXSZ + ; 270, X2 = X1 - TXTSZ, Y2 = Y1 - CHRHT, ADJY = +NDTXSZ + ;----------------------------------------------------------------------------+ MUL Byte Ptr NCHR MOV Word Ptr TXTSZ,AX ;Store txtsz ; Set up TXTSZ, CHRSZ for computing X2, Y2 : the Text width and height ; depending on the Rotation ; = TXTSZ MOV DX,AX MOV BX,Word Ptr CHRHT ; = CHRHT ;----------------------------------------------------------------------------+ ; Setup Character Rotation flags + ;----------------------------------------------------------------------------+ ;Initialize bit3 = rowinc, bit2 = colinc ; bit0 = chgxy, bit1 = cup MOV AL,Byte Ptr NDTXRT ;0=0,1=90,2=180,3=270 rotation ROR AL,1 JB ZTXJ01 ;carry set, rotate = 90, 270 ; Ist bit off, rotate = 0, 180 ROR AL,1 ;check 2nd bit JB ZTXJ03 ;2nd bit ON, rotate = 180 ; carry OFF, rotate = 0 NEG DX ;Negate String Height, TXTSZ neg cx mov word ptr adjx, cx MOV AL,05H ;0 rotation FLAG : 0101 JMPS ZTXJ04 ZTXJ01: ; First bit set, 90, 270 rotation ROR AL,1 JB ZTXJ02 ;2nd bit set, 270 rotation FLAG : 0000 ; 2nd bit off, rotate = 90 XCHG BX,DX ;Move = TXTSZ (Width,x) ; = CHRHT (Height,y) neg cx mov word ptr adjy,cx MOV AL,0EH ;SET FLAG : 1110 JMPS ZTXJ04 ZTXJ02: ;rotation = 270 NEG BX ;Negate Height, y = CHRHT NEG DX ;Negate Width, x = TXTSZ mov word ptr adjy,cx MOV AL,00H ;270 rotation FLAG : 0000 JMPS ZTXJ04 ZTXJ03: ;rotation = 180 NEG BX ;Negate Width, x = CHRHT mov word ptr adjx,cx MOV AL,0BH ;set chgxy, 180 rotation FLAG : 1011 ZTXJ04: MOV Word Ptr XTEXT,BX ;Text string Width in pixels MOV Word Ptr YTEXT,DX ;Text string Height in Pixels MOV Byte Ptr FLGS,AL CALL PUTBYT ;Store rotation flag in OBJLST ;----------------------------------------------------------------------------+ ; Get text location from PTSIN array + ; Update Maximum/Minimum extents + ; Store x1, y1, in OBJLST + ;----------------------------------------------------------------------------+ ; Get the Address of PTSIN array LES DI,PTSIN[BP] MOV DX,ES:W_1[DI] ADD DI,2 ; Update xmax/xmin add dx,word ptr adjx ;adjust x-position CMP DX,Word Ptr XMAX JLE ZTXJ05 MOV Word Ptr XMAX,DX ZTXJ05: CMP DX,Word Ptr XMIN ;Minimum Plot X extent JGE ZTXJ06 MOV Word Ptr XMIN,DX ZTXJ06: PUSH DX ;Stack x1 CALL PUTPT ;Store x-coord. in into OBJLST ; = Y-coord. from PTSIN MOV DX,ES:W_1[DI] ADD DI,2 ; Update ymin/ymax add dx,word ptr adjy ;adjust y position CMP DX, 0 ;don't do outside plot space jge ZTXJ7 xor dx, dx ; if base line is below 0, make it 0 ztxj7: CMP DX,Word Ptr YMAX JLE ZTXJ07 MOV Word Ptr YMAX,DX ZTXJ07: CMP DX,Word Ptr YMIN ;Minimum Plot Y extent JGE ZTXJ08 MOV Word Ptr YMIN,DX ZTXJ08: PUSH DX ;Stack Y1 CALL PUTPT ;Store y-coord. into OBJLST ;----------------------------------------------------------------------------+ ; USE Text Extent : XTEXT, YTEXT to Update XMAX, YMAX + ;----------------------------------------------------------------------------+ POP DX ;UNstack Y1 ADD DX,Word Ptr YTEXT ; = Text Height ; Update ymax/ymin CMP DX,Word Ptr YMAX JLE ZTXJ09 MOV Word Ptr YMAX,DX ZTXJ09: CMP DX,Word Ptr YMIN JGE ZTXJ10 MOV Word Ptr YMIN,DX ZTXJ10: POP DX ;Unstack X1 ADD DX,Word Ptr XTEXT ;Get Text Width ; Update Xmax/Xmin extent, = TEXT WIDTH CMP DX,Word Ptr XMAX JLE ZTXJ11 MOV Word Ptr XMAX,DX ZTXJ11: CMP DX,Word Ptr XMIN JGE ZTXJ12 MOV Word Ptr XMIN,DX ;----------------------------------------------------------------------------+ ; Get Text string from INTIN and store in OBJLST + ;----------------------------------------------------------------------------+ ZTXJ12: LES DI, INTIN[BP] MOV AL,Byte Ptr NCHR ;Get the No. of Characters ZTXL01: PUSH AX ;Get next character MOV AX,ES:W_1[DI] ADD DI,2 CALL PUTBYT ;Store in OBJLST POP AX DEC AL JNZ ZTXL01 ztxend: RET dseg NCHR RS 02 ;No. of characters in text string FLGS RS 01 ;Rotation flag TXTSZ RS 02 ;Character Extents in Pixels XTEXT RS 02 ;Text String Width YTEXT RS 02 ;Text String Height adjx rs 02 adjy rs 02 adjsz rs 02 cseg END