Category : Word Processors
Archive   : HP22D5.ZIP
Filename : SETPAL.ASM

 
Output of file : SETPAL.ASM contained in archive : HP22D5.ZIP
DOSSEG
.MODEL LARGE

include extern.inc

EXTRN htoi:FAR
EXTRN itoh:FAR
EXTRN _sprintf:FAR
EXTRN ReturnValue:FAR
EXTRN stoh:FAR

.DATA

setreg_name db 'setreg',0
setpal_name db 'setpal',0
getpal_name db 'getpal',0
getreg_name db 'getreg',0
format db "%d,%d,%d",0
buffer db 20 dup (' ')

Pool PoolStruct
PoolStruct
PoolStruct
PoolStruct
PoolStruct <> ;END

.CODE

setpal:
push bp
mov bp,sp
push di

cmp byte ptr [bp+6],4 ;Need color and value
jne SP2
mov di,20 ;stack offset of blue

SP1: push di ;save stack offset
les di,[bp+di] ;ES:DI = hColorValue
push es
push di
call htoi ;AX = color value
pop di ;get original stack offset
push ax ;save color value on stack
sub di,4 ;next parameter
cmp di,8 ;done yet?
jae SP1

;there are now four colors on the stack

pop bx ;Color Number
pop ax ;red
mov dh,al
pop ax ;green
mov ch,al
pop ax ;blue
mov cl,al
mov ax,1010h ;Set 1 DAC Color
int 10h

SP2:
pop di
pop bp
mov ax,STOP ;terminate this message
retf

;
; This routine sets a color in the palette to another value. For example,
; if you wanted all of the red to become blue, use the command:
;
; setreg red,blue;
;
setreg:
push bp
mov bp,sp

mov ax,[bp+6] ;NUMARGS
cmp ax,2
jne SR1

les bx,[bp+8] ;color
push es
push bx
call htoi
push ax ;AX = color

les bx,[bp+12]
push es
push bx
call htoi
pop bx ;AX = value, BX = color

mov bh,al
mov ax,1000h
int 10h

SR1:
mov ax,STOP
pop bp
retf

getpal:
push bp
mov bp,sp
cmp byte ptr [bp+6],1
jne GP1

les bx,[bp+8] ;ES:BX = hColorValue
push es
push bx
call htoi ;AX = color value

mov bx,ax
mov ax,1015h
int 10h

xor ah,ah ;AH = 0
mov al,cl ;AX = blue
push ax

mov al,ch ;AX = green
push ax

mov al,dh ;AX = red
push ax

push ds
mov ax,offset format
push ax

push ds
mov ax,offset buffer
push ax

call _sprintf
add sp,14

push ds
mov ax,offset buffer
push ax
call stoh

push dx
push ax
call ReturnValue

GP1:
mov ax,STOP
pop bp
retf

getreg:
push bp
mov bp,sp
cmp byte ptr [bp+6],1
jne GR1

les bx,[bp+8] ;ES:BX = hColorValue
push es
push bx
call htoi ;AX = color value

mov bx,ax
mov ax,1007h
int 10h

mov bl,bh
xor bh,bh
push bx

call itoh
push dx
push ax
call ReturnValue

GR1:
mov ax,STOP
pop bp
retf

END




  3 Responses to “Category : Word Processors
Archive   : HP22D5.ZIP
Filename : SETPAL.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/