Game programming

Moderators: None (Apply to moderate this forum)
Number of threads: 2070
Number of posts: 5361

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Edit Report
VGA start address Posted by Epra on 20 Jun 1999 at 2:57 AM
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>
Epra..


Edit Report
Re: VGA start address Posted by Rock on 21 Jun 1999 at 8:07 AM
: 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





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.