home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
C-ASM_VI.ARJ
/
PROGASM.ZIP
/
PROG009P.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-04-16
|
1KB
|
53 lines
;************************************************************************
; Write palette registers from a table *
; Set the palette registers to the values in 'table'. *
; The palette registers are contained in the *
; first 16 registers of the attribute controller. *
; Here the 16 registers are loaded using the values from *
; the parameter array. *
; *
; Entry: [BP+6] - offset of register table (16 palette regs) *
; [BP+8] - segment of register table *
; *
;************************************************************************
PUBLIC Write_Palette
Write_Palette PROC FAR
PUSH BP
MOV BP,SP
PUSH DS
PUSH SI
PUSH ES
XOR AX,AX ;Get address of CRT controller
MOV ES,AX ;From segment 0
MOV DX,ES:[BIOS_CRT_Addr]
ADD DX,6 ;Compute address of Attrib Read reg
IN AL,DX ;Reset Attribute flip-flop
MOV DS,[BP+8]
MOV SI,[BP+6] ;Get pointer to the parameter table
MOV DX,03C0H ;Address of Attribute controller
MOV CX,16 ;Number of values to load
XOR AH,AH ;First index to load
PalLoop:MOV AL,AH ;Fetch next index
OUT DX,AL ;Select next index
LODSB ;Fetch next value from the table
OUT DX,AL ;Load register with value
INC AH ;Update index
LOOP PalLoop
MOV AL,20H ;Must turn controller back ON
OUT DX,AL
POP ES
POP SI
POP DS
MOV SP,BP
POP BP
RET 4
Write_Palette ENDP