Palette ProgrammingAssembler/8086

There are many ways to program the videocard palette. You can use BIOS - which is slow or you can use VESA which is a tad better. Or you can do it the hardware way. Here some hardware ways are presented. The BIOS way can be found in any book describing how to use your video card. Since I do not want to write too much, I will also just cover the 256 color modes. If you need to know the basics, please read a good book, or contact me. If I have time, I might write down some things worth to know.
The quite standard way:

        mov     dx,3C8h
        xor     al,al
        out     dx,al
        inc     dl
        mov     si,offset palette
        mov     cx,256*3
        rep     outsb
Nice and easy. But there is a problem, some video cards dislike this combination. Since speed does not matter too much here, rewrite the routine more like this:
        mov     dx,3C8h
	xor	al,al
	out	dx,al

	inc	dl

	mov	si,offset palette
	mov	cx,256*3

loop:	mov	al,[si]
	out	dx,al
	inc	si
	dec	cx
	jnz	loop
The again, IF speed matters, what to do? REP OUTSB is not too fast, and depending on what you can do when you set your palette, you might be able to save in that time anyway.
Gem writer: John Eckerdal
last updated: 1998-03-16