I've been trying to implement a blitter in MS-DOS, but before I do that I wanted to test the various graphics modes of the VGA graphics card. (I'm emulating using DOSBox.) According to this paper on VGA, normal drawing to the bitmap screen is done in "replace mode," where data written to VRAM simply overwrites what is currently stored there. There are three other modes which are supposedly accessed by
OUTing the correct control code to port
03CEh, but I can't get them to work. From the website:
mov ax,1803h mov dx,03CEh out dx,ax
will set the VGA card write mode to
Unfortunately I can't get this to work. The code below fills the screen with VGA color 09 in replace mode, then in
XOR mode, which should result in a black screen since any number
XORed with itself equals 0. Yet, the screen just ends up filled with the color I chose at the start. I turned to the OSDev wiki for further guidance but all I could find was this chart which I have trouble understanding.
Is the quote from the first link correct on changing modes? If so, what am I doing wrong? If the reference material is wrong, how do I invoke the other drawing modes?
I've provided the source code below in case I made a mistake and just can't see it:
mov ax,@data mov ds,ax mov ax,0A000h mov es,ax ;vga vram mov ax,13h int 10h mov al,09h mov cx,VGA_VRAMSIZE mov di,0 rep stosb mov di,0 push ax push dx mov ax,1803h mov dx,03CEh out dx,ax ;VGA "XOR" MODE pop dx pop ax mov al,09h mov cx,VGA_VRAMSIZE mov di,0 rep stosb mov di,0