home *** CD-ROM | disk | FTP | other *** search
- ;════════════════════════════════════════════════════════════════════════════╗
- ; PALETTE() ║
- ; Paul V. Slabowski ║
- ; October 28, 1988 ║
- ; ║
- ; Set the current palette on an EGA machine to make use of all 64 of those ║
- ; pretty colors...16 at a time, of course. ║
- ; ║
- ; PALETTE(Color_attribute_to_replace, EGA_color_to_replace_it_with) ║
- ; ║
- ; ex: PALETTE(3,27) ║
- ;════════════════════════════════════════════════════════════════════════════╝
-
- PUBLIC PALETTE ; Declare this function public
-
- EXTRN __PARINFO:FAR ; Declare far functions
- EXTRN __PARNI:FAR ; ·
- EXTRN __RET:FAR
-
- DGROUP GROUP DATASG ; Combine data with Clipper's
-
- DATASG SEGMENT 'DATA' ; Start of Data segment
-
- attrb DB 0 ; Color parm 1 as-sent <Integer>
- colr DB 0 ; Color parm 2 as-sent <Integer>
-
- DATASG ENDS ;End of Data
-
- _PLETT segment byte 'PROG'
- ASSUME cs:_PLETT, ds:DGROUP
-
- PALETTE PROC FAR
-
- setup: push bp ; Save registers
- mov bp,sp ; ·
- push ds ; ·
- push es ; ·
- push si ; ·
- push di ; ·
-
- parnumb: mov ax, 0 ; Set up call for # of params
- push ax ; ·
- call __PARINFO ; Call Clipper function to get
- ; # of params into ax
- add sp, 2 ; restore stack
- cmp ax, 2 ; If # of parameters sent was,
- jne quit ; not 2, then quit here,
- ; otherwise...
-
- getpar1: mov ax, 1 ; Put 1 in ax to point to 1st parm
- push ax ; Push value of 1 onto stack
- call __PARINFO ; Call Clipper function to test for
- ; numeric parameter
- add sp, 2 ; restore stack
- cmp ax, 2 ; If param is not numeric...
- jne quit ; then quit here, otherwise...
- mov ax, 1 ; Place 1 into ax to get parm 1
- push ax ; Push value of 1 onto the stack
- call __PARNI ; Call Clipper Function to get
- ; actual parameter into ax
- add sp, 2 ; Restore stack
-
- testng1: cmp ax, 0 ; If attrb >= 0 then cont-
- jge testhi1 ; inue, otherwise...
- jmp quit ; quit
-
- testhi1: cmp ax, 15 ; If attrb <= 15 then
- jle getpar2 ; continue, otherwise...
- jmp quit ; quit
-
- getpar2: mov attrb, al ; Save the attrb parameter
- mov ax, 2 ; Put 2 in ax to point to 2nd parm
- push ax ; Push value of 2 onto stack
- call __PARINFO ; Call Clipper function to test for
- ; numeric parameter
- add sp, 2 ; restore stack
- cmp ax, 2 ; If param is not numeric...
- jne quit ; then quit here, otherwise...
- mov ax, 2 ; Place 2 into ax to get parm 2
- push ax ; Push value of 2 onto the stack
- call __PARNI ; Call Clipper Function to get
- ; actual parameter into ax
- add sp, 2 ; Restore stack
-
- testng2: cmp ax, 0 ; If colr >= 0 then cont-
- jge testhi2 ; inue, otherwise...
- jmp quit ; quit
-
- testhi2: cmp ax, 63 ; If colr <= 63 then
- jle doscall ; continue, otherwise...
- jmp quit ; quit
-
- doscall: mov colr, al ; Save the colr parameter
- mov ah, 10h ; Load registers for DOS call
- mov al, 0 ; Set palette register function
- mov bh, colr ; Color to use
- mov bl, attrb ; Attribute to use this color
- int 10h ; Call to BIOS:Video Drivers
-
- quit: pop di ; Restore registers
- pop si ; ·
- pop es ; ·
- pop ds ; ·
- pop bp ; ·
-
- clean: call __RET ; Call Clipper function for return
- ret ; Actual return
-
- PALETTE ENDP ; End of process
-
- _PLETT ENDS
- END
-
- ; eof palette.asm