M EQU Byte Ptr 0[BX] TITLE 'SET ATTRIBUTES Functions' DGROUP GROUP DATA ; **************************************************************************** ; * * ; * ZSATTRC : Printer GIOS Set Attributes, Support Color * ; * * ; **************************************************************************** ; Digital Research, Inc. * ; Revision : Nov. 08, 1983 File "ZSATTRC.A86" Version 1.0 * ; * ;***** MODE NOTES : ********************************************************* ; * ; 11/14 1. Use 6x8 Font Table, Character Width = NDTXSZ * 6 pixels (CHRSZ) * ; Character Height= NDTXSZ * 8 pixels (CHRHT) * ; 12/09 2. XLT86 * ; May-04-83 rhk * ; add set color and set writing mode support * ; Oct-31-83 rhk * ; 8 Colors Printer Support: Modules GETCOR, PUTCOR * ; XCOR = No. of predefined colors * ;***** MODE NOTES : ********************************************************* ; * ; Input : * ; * ; PBPTR : Parameter Block Address Pointers * ; * ; PB Address of Control Array (CONTRL) * ; PB+2 Address of Input Parameter Array (INTIN) * ; PB+4 Input Point Coordinate Array (PTSIN) * ; PB+6 Output Parameter Array (INTOUT) * ; PB+8 Output Point Coordinate Array (PTSOUT) * ; * ; Output : * ; * ; Opcode Dependent, Output returned to GSX in Array CONTRL, INTOUT, * ; and PTSOUT * ; * ;***************************************************************************** cseg PUBLIC ZCHSZ, ZCHRT, ZLNTY, ZLNCO, ZMKCO, ZMKTY, ZMKSZ PUBLIC ZFITY, ZINTY, ZTXCO, ZFICO, ZESCAP, zrite EXTRN PUTBYT:near, PUTPT:near dseg EXTRN NDLNSZ:word, NDTXSZ:word, NDMKSZ:word, NDTXRT:word EXTRN WKID:word, NDLNTY:word, NDLNCO:word, NDMKTY:word EXTRN NDMKCO:word, NDTXTY:word, NDTXCO:word EXTRN NDINTY:word, NDFITY:word, NDFICO:word EXTRN XCOR:word extrn bmask:byte, rflg:byte, nopflg:byte extrn dline:byte, dmark:byte, dtext:byte, dfill:byte, dcell:byte EXTRN CHRSZ:word, CHRHT:word, PMKSZ:word EXTRN OBJCNT:word, OBJLST: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 mrkcap equ 5 lincap equ 6 patcap equ 6 ;----------------------------------------------------------------------------+ ; Escape Function Opcode = 5 + ;----------------------------------------------------------------------------+ ZESCAP: ; Determine which opcode is desired LES DI, CONTRL[BP] ; Determine which Escape code is desired MOV AX,ES:W_6[DI] ; Get the opcode from the contrl array DEC AL JZ L@1 RET ; Code 1 is the only one that is processed L@1: LES DI, INTOUT[BP] MOV ES:W_1[DI],-1 ;Return -1, -1 in intout indicating no ;Character cell addressing MOV ES:W_2[DI],-1 RET ;----------------------------------------------------------------------------+ ; Set Char Height Opcode = 12 + ;----------------------------------------------------------------------------+ ZCHSZ: INC Word Ptr OBJCNT ; Increment Object Count MOV AL,12 CALL PUTBYT ; Store Opcode into OBJLST LES DI,PTSIN[BP] ; requested height in device units MOV AX,ES:W_2[DI] ; -> Requested height in Device Units CMP AX,TXSZ9 JB notbig MOV AX,TXSZ9 ; max height notbig: ; round to nearest 8 pixel size ;;;;; ADD AX,4 ; Rounding DOWN AND AX,0f8H ; Rounding Down to the Nearest modulo 8 dots JNZ notsml MOV AX,TXSZ0 notsml: MOV Word Ptr CHRHT,AX ; Store pixel height ROR AL,1 ROR AL,1 ;NDTXSZ = CHRHT / 8 ROR AL,1 ; repeat factor (1-12) MOV Word Ptr NDTXSZ,AX CALL PUTBYT ; Store Chracter size factor into OBJLST MOV CX,Word Ptr NDTXSZ MOV AX,Word Ptr CHRHT SUB AX,CX SUB AX,CX MOV Word Ptr CHRSZ,AX ;----------------------------------------------------------------------------+ ; Output Character size in device units + ;----------------------------------------------------------------------------+ LES DI,PTSOUT[BP] MOV AX,Word Ptr CHRSZ ; = NDTXSZ * 6 MOV ES:W_3[DI],AX ; PTSOUT(3) = NDTXSZ * 6 SUB AX,Word Ptr NDTXSZ ; = NDTXSZ * 5 MOV ES:W_1[DI],AX ; PTSOUT(1) = NDTXSZ * 5 ; PTSOUT(2) and (4) = NDTXSZ * 8 MOV AX,Word Ptr CHRHT schlp: MOV ES:W_2[DI],AX MOV ES:W_4[DI],AX ;----------------------------------------------------------------------------+ ; contrl(3) = 2 + ;----------------------------------------------------------------------------+ LES DI,CONTRL[BP] MOV ES:W_3[DI],2 ; return 2 vertices RET ;----------------------------------------------------------------------------+ ; Set Char Up Vector Opcode = 13 + ;----------------------------------------------------------------------------+ ZCHRT: INC Word Ptr objcnt MOV AL,13 CALL PUTBYT ; Store OPCODE into OBJLST LES DI,INTIN[BP] MOV BX,ES:W_1[DI] ; round requested angle to nearest 90 ; ;0 0 - 450, rotation = 0, SET NDTXRT : 1, do 90 rotation ;4 3150 - 4050, rotation = 0, SET NDTXRT : 1, do 90 ;1 450 - 1350, rotation = 90, SET NDTXRT : 2, do 180 rotation ;2 1350 - 2250, rotation = 180, SET NDTXRT : 3, do 270 ;3 2250 - 3150, rotation = 270, SET NDTXRT : 0, do 0 ; * ;** 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 * ;** * ADD BX,450 ; add 450 MOV CX,4 dirlp: SUB BX,900 JB gotdir DEC CX JNZ dirlp ; STORE NDTXRT gotdir: PUSH CX MOV AX,5 SUB AX,CX AND AX,3 MOV Word Ptr NDTXRT,AX CALL PUTBYT ; Store rotation factor into OBJLST ; Return in intout(1) - rotation angle : angle indicator in POP BX ADD BX,BX ;Return Rotation Angle in INTOUT MOV AX,SELDIR[BX] LES DI,INTOUT[BP] MOV ES:W_1[DI],AX RET ;----------------------------------------------------------------------------+ ; Set Color Rep Opcode = 14 + ;----------------------------------------------------------------------------+ ;----------------------------------------------------------------------------+ ; Set Polyline Type Opcode = 15 + ;----------------------------------------------------------------------------+ ZLNTY: INC Word Ptr OBJCNT MOV AL,15 CALL PUTBYT ;Store OPCODE into OBJLST LES DI,INTIN[BP] MOV AX,ES:W_1[DI] ;LINE STYLE REQUESTED CMP AX,0 ;If type out of range (<0), then type = 1 JBE ZLNJ00 CMP AX,lincap ;If type out of range (>6), then type = 1 JBE ZLNJ01 zlnj00: MOV AX,1 ZLNJ01: LES DI,INTOUT[BP] MOV ES:W_1[DI],AX ;Return Line style DEC AL CALL PUTBYT ;Store Line Style flag in OBJLST RET ;----------------------------------------------------------------------------+ ; Set Polyline Width Opcode = 16 ;----------------------------------------------------------------------------+ ;----------------------------------------------------------------------------+ ; Set Polyline Color Opcode = 17 ;----------------------------------------------------------------------------+ ZLNCO: call getcor ; returns draw flag = 1 if color = 1 ; draw flag = 0, if color = 0 ; and the writing mode is not replace mov byte ptr dline, al ; if draw flag is 0, the object is not ; stored in the list to be drawn ;++ cmp al, 0 ;++ je zli99 mov al, 17 call putcor zli99: ret ;----------------------------------------------------------------------------+ ; Set Polymarker Typ Opcode = 18 + ;----------------------------------------------------------------------------+ ZMKTY: INC Word Ptr OBJCNT MOV AL,18 CALL PUTBYT ;Store OPCODE into OBJLST LES DI,INTIN[BP] MOV AX,ES:W_1[DI] ;MAKER TYPE REQUESTED CMP AX,0 ;If type out of range (<1), then type = 3 JBE ZMKJ00 CMP AX,mrkcap ;If type out of range (>5), then type = 3 JBE ZMKJ01 zmkj00: MOV AX,3 ; Set to Marker type 3, "*" ZMKJ01: LES DI,INTOUT[BP] MOV ES:W_1[DI],AX ;Return Maker type DEC AX MOV Word Ptr NDMKTY,AX CALL PUTBYT ;Store ASCII Maker symbol in OBJLST RET ;----------------------------------------------------------------------------+ ; Set Polymarker Scl Opcode = 19 + ;----------------------------------------------------------------------------+ ZMKSZ: INC Word Ptr OBJCNT MOV AL,19 CALL PUTBYT ; Store Opcode into OBJLST LES DI,PTSIN[BP] MOV AX,ES:W_2[DI] ; requested height in device units ; = Requested height in Device Units CMP AX,MKSZ9 JB ZMKJ02 ; Size is Not too big MOV AX,MKSZ9 ; set to max height ZMKJ02: ADD AX,4 ; round to nearest 8 pixels AND AX,0f8H JNZ ZMKJ03 ; Size is not too small MOV AX,MKSZ0 ; Set to minimal height ZMKJ03: MOV Word Ptr PMKSZ,AX ; Store pixel height ROR AL,1 ROR AL,1 ;ndmksz = size / 8 ROR AL,1 ; repeat factor (1-12) MOV Word Ptr NDMKSZ,AX CALL PUTBYT ; Store Character size factor into OBJLST ;----------------------------------------------------------------------------+ ; Output Maker size in device units + ;----------------------------------------------------------------------------+ LES DI,PTSOUT[BP] ; Return NDMKSZ : MAKER SIZE FACTOR MOV ES:W_1[DI],0 ; PTSOUT(1) = 0 MOV AX,Word Ptr Pmksz MOV ES:W_2[DI],AX ;PTSOUT(2) = NDMKSZ * 8 ;----------------------------------------------------------------------------+ ; contrl(3) = 1 + ;----------------------------------------------------------------------------+ LES DI,CONTRL[BP] MOV ES:W_3[DI],1 ; return 1 vertices RET ;---------------------------------------------------------------------------+ ; Set Polymarker Clr Opcode = 20 + ;---------------------------------------------------------------------------+ ZMKCO: call getcor ; returns draw flag = 1 if color = 1 ; draw flag = 0, if color = 0 ; and the writing mode is not replace mov byte ptr dmark, al ; if draw flag is 0, the object is not ; stored in the list to be drawn ;++ cmp al, 0 ;++ je zmi99 mov al, 20 call putcor zmi99: ret ;----------------------------------------------------------------------------+ ; Set Text Font Opcode = 21 ;----------------------------------------------------------------------------+ ;----------------------------------------------------------------------------+ ; Set Text Color Opcode = 22 ;----------------------------------------------------------------------------+ ZTXCO: call getcor ; returns draw flag = 1 if color = 1 ; draw flag = 0, if color = 0 ; and the writing mode is not replace mov byte ptr dtext, al ; if draw flag is 0, the object is not ; stored in the list to be drawn ;++ cmp al, 0 ;++ je zti99 mov al, 22 call putcor zti99: ret ;----------------------------------------------------------------------------+ ; Set Fill Int Style Opcode = 23 ;----------------------------------------------------------------------------+ ZFITY: INC Word Ptr OBJCNT MOV AL,23 CALL PUTBYT ;Store OPCODE into OBJLST LES DI,INTIN[BP] MOV AX,ES:W_1[DI] ;FILL STYLE REQUESTED CMP AX,0 ;If type out of range (<0), then type = 0 JB ZFIJ00 CMP AX,3 ;If type out of range (>3), then type = 0 JBE ZFIJ01 zfij00: MOV AX,0 ZFIJ01: LES DI,INTOUT[BP] MOV ES:W_1[DI],AX ;Return Fill style CALL PUTBYT ;Store Fill Style flag in OBJLST RET ;----------------------------------------------------------------------------+ ; Set Fill Sty Index Opcode = 24 ;----------------------------------------------------------------------------+ ZINTY: INC Word Ptr OBJCNT MOV AL,24 CALL PUTBYT ;Store OPCODE into OBJLST LES DI,INTIN[BP] MOV AX,ES:W_1[DI] ;FILL PATTERN REQUESTED CMP AX,0 ; If index out of range, then Index mapped JBE ZINJ00 ; to the highest Index CMP AX,patcap ; If index out of range, then Index mapped JBE ZINJ01 ; to Index 1 pattern zinj00: MOV AX, 1 ZINJ01: LES DI,INTOUT[BP] MOV ES:W_1[DI],AX ;Return Fill style CALL PUTBYT ;Store Fill Style flag in OBJLST RET ;----------------------------------------------------------------------------+ ; Set Fill Color Opcode = 25 ;----------------------------------------------------------------------------+ ZFICO: call getcor ; returns draw flag = 1 if color = 1 ; draw flag = 0, if color = 0 ; and the writing mode is not replace ;++ mov byte ptr dfill, al ; if draw flag is 0, the object is not ;++ ; stored in the list to be drawn ;++ cmp al, 0 ;++ je zfi99 Mov Byte Ptr Dfill, Al mov al, 25 call putcor zfi99: ret getcor: les di, intin[bp] mov ax, es:w_1[di] ; get color cmp ax, word ptr xcor ; No. of predefined colors :8 jb zcor1 ; is color out of range ? mov ax, 7 ; set to default color 7: black zcor1: LES DI,INTOUT[BP] MOV ES:W_1[DI],ax ; return color set mov newcor, ax ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; if color is 0, check the current writing mode ; set the draw flag so if the writing mode is not replace, the ; object will not be drawn ; cmp ax, 0 ; je zcor2 ; mov al, 1 ; color is not zero, set draw flag to 1 ; jmp zcor9 ; color is zero, is the writing mode replace ? ;zcor2: ;check the writing mode flag ; cmp nopflg, 0 ; jne zcor9 ; nopflg not 0, set/xor/clear mode, set draw ; ; flag to 0 ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mov al, 1 ; nopflg = 0, replace mode, set draw flag to 1 ; jmp zcor9 zcor9: RET putcor: ; if the set color command was setting to color zero, the objects ; will not be stored in the objlst (not drawn) unless the current ; writing mode is replace mode call putbyt ; store the set color opcode in objlst mov ax, newcor call putbyt ; the color index inc word ptr objcnt ret ;----------------------------------------------------------------------------+ ; Set Writing Mode Opcode = 32 ;----------------------------------------------------------------------------+ zrite: INC Word Ptr OBJCNT MOV AL,32 CALL PUTBYT ;Store OPCODE into OBJLST LES DI,INTIN[BP] MOV AX,ES:W_1[DI] ;Writing Mode cmp ax, 0 je zrite0 CMP AX,4 ;If mode out of range (>4), then type = 1 JBE zrite1 zrite0: MOV AX,1 zrite1: LES DI,INTOUT[BP] MOV ES:W_1[DI],AX ;Return Fill style dec ax ; mode 0/1/2/3 for replace/set/xor/clear mov cl, 0 ; nopflg = 0, mode = replace jz zrite2 mov cl, 1 ; nopflg = 1, mode=set/xor/clear zrite2: mov byte ptr nopflg, cl CALL PUTBYT ;Store writing mode in objlst ret ;----------------------------------------------------------------------------+ ; No Action Opcode Supports + ;----------------------------------------------------------------------------+ NOACT: NOTYET: RET LNSZ0 EQU 1 LNSZ9 EQU 1 MKSZ0 EQU 8 MKSZ9 EQU 96 TXSZ0 EQU 8 TXSZ9 EQU 96 dseg newcor dw 1 ; ; Angle of Rotation selected ; SELDIR DW 0 DW 2700 DW 1800 DW 900 DW 0 cseg END