Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!iuvax!pur-ee!uiucdcs!uxc.cso.uiuc.edu!uxe.cso.uiuc.edu!mcdonald From: mcdonald@uxe.cso.uiuc.edu Newsgroups: comp.sys.ibm.pc Subject: Re: Changing The EGA Palette Message-ID: <45900084@uxe.cso.uiuc.edu> Date: Mon, 26-Oct-87 11:38:00 EST Article-I.D.: uxe.45900084 Posted: Mon Oct 26 11:38:00 1987 Date-Received: Thu, 29-Oct-87 21:29:05 EST References: <4285@mnetor.UUCP> Lines: 66 Nf-ID: #R:mnetor.UUCP:4285:uxe.cso.uiuc.edu:45900084:000:1641 Nf-From: uxe.cso.uiuc.edu!mcdonald Oct 26 10:38:00 1987 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