luke@mnetor.UUCP (Luke Matthys) (10/22/87)
Does anyone out there know how to change the EGA colour palette quickly. I have used the BIOS call to do this but this approach results in the interrupts being disabled for too long a period of time. My application is written in Microsoft C v. 4 and assembler. -- Luke G. Matthys UUCP: {decvax|allegra|ihnp4|linus|utcsri}!utzoo!mnetor!luke BELL: (416) 475-8980 ext. 332
mcdonald@uxe.cso.uiuc.edu (10/26/87)
Here is the procedure to set all 17 color registers in one vertical retrace period. This takes much less than the whole retrace. If you want to turn off interrupts, do it after the test for retrace beginning. This fragment is from my complete EGA graphics package which will be posted to the net as soon as I find out about video pages in mode 18. Doug McDonald /*C main test program*/ char pal[17] = {0,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0}; main() /*turns ordinary text purple*/ {setpals(pal);} /*use MODE CO80 to return to normal*/ ;SMALL MEMORY MODEL CONST segment word public 'CONST' CONST ends _BSS segment word public 'BSS' _BSS ends _DATA segment word public 'DATA' _DATA ends DGROUP group CONST, _BSS, _DATA _TEXT segment byte public 'CODE' _TEXT ends assume cs:_TEXT, ss:DGROUP, ds:DGROUP _TEXT segment public _setpals _setpals proc near push bp mov bp, sp push si mov bx, word ptr [bp+4] mov dx,03dah spnvr: in al,dx ;wait for NOT vertical retrace test al,8 jnz spnvr spvr: in al,dx ;wait for vertical retrace test al,8 jz spvr xor si,si mov dx,03c0h sp2loop: mov ax,si out dx,al mov al,byte ptr [bx][si] out dx,al inc si cmp si,16 jne sp2loop mov al,011h out dx,al mov al,byte ptr [bx][si] out dx,al mov al,020h out dx,al pop si pop bp ret _setpals endp _TEXT ends END