: How do I change the VGA start address? I want to create some sort of page flipping. I understand that I can do this throu the CRTC index but I do not know how. Is there some sort of reference I can use or can someone of you help me out?<p>
Well, it involves using ModeX, which is very different from Mode 13. If you've never used it, I suggest getting a book on it.<p>
If you have, and have gotten the mode setup and understand how the memory is accessed, then here is how to page-flip (From "PC Game Programming Explorer" by Dave Roberts).<p>
void SetScreenStart(unsigned short offset)<br>
{<br>
unsigned char offsetLow, offsetHigh;<p>
offsetLow = offset & 0x00FF;<br>
offsetHigh = (offset >> 8) & 0x00FF;<p>
asm cli; // disable interrupts<br>
outportb(CRTC_INDEX_REG, START_ADDRESS_HIGH_INDEX);<br>
outportb(CRTC_DATA_REG, offsetHigh);<p>
outportb(CRTC_INDEX_REG, START_ADDRESS_LOW_INDEX);<br>
outportb(CRTC_DATA_REG, offsetLow);<p>
asm sti; // enable ints<br>
}<p>
The offset you pass in the offset in video memory where the screen will be drawn next frame, allowing page flipping and hardware scrolling.<p>
define CRTC_INDEX_REG 0x3D4<br>
define CRTC_DATA_REG 0x3D5<br>
define START_ADDRESS_HIGH_INDEX 0xC<br>
define START_ADDRESS_LOW_INDEX 0xD<p>
Rock