Category : OS/2 Files
Archive   : PMPAL.ZIP
Filename : OS2PAL.ASM

 
Output of file : OS2PAL.ASM contained in archive : PMPAL.ZIP
.model large,pascal
.code PALETTE
.286
readpal:
mov dx,3DAh
cli
in al,dx
push dx
mov dl,0C0h
mov al,bl ; pal register
out dx,al
jmp yyyy
yyyy:
inc dx
in al,dx
xor ah,ah
mov si,ax
pop dx
in al,dx
mov dl,0C0h
mov al,20h
out dx,al
sti
ret

SETPAL_EGA proc near
push bp
mov bp,sp
mov bx,[bp+8] ; color value
mov cx,[bp+6] ; palette
mov dx,3DAh
push dx

cli
in al,dx
mov dl,0C0h
mov al,bl
out dx,al
mov al,cl
out dx,al
pop dx
in al,dx
mov dl,0C0h
mov al,20h
out dx,al
sti

pop bp
retf 4
SETPAL_EGA endp

SETPAL_VGA proc near
push bp
mov bp,sp
push si


mov bx,word ptr [bp+10] ; color value to remap

test byte ptr [bp+9], 1 ; 256 colors mode ?
jnz noreadpal
call readpal
mov bx,si
noreadpal:
mov dh,byte ptr [bp+ 8] ; red
mov ch,byte ptr [bp+ 7] ; green
mov cl,byte ptr [bp+ 6] ; blue

shr dh,2
shr ch,2
shr cl,2

push cx
push dx
jmp okay
xor cx,cx
loop1: mov dx,3DAh
in al,dx
and al,8
jnz okay
loop loop1
okay:
pop dx
pop cx
mov ah,dh

mov al,bl
mov dx,3C8h ; palette register
pushf
cli
out dx,al ; palette register number
inc dx
mov al,ah
out dx,al ; update red register
mov al,ch
out dx,al ; update green register
mov al,cl
out dx,al ; update blue register
sti
popf

jmp retrn

retrn:
mov ax,si
xor ah,ah
pop si
pop bp
retf 6
SETPAL_VGA endp
end



  3 Responses to “Category : OS/2 Files
Archive   : PMPAL.ZIP
Filename : OS2PAL.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/