Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

VGA start address

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?


Epra..


Comments

  • : 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?


    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.


    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).


    void SetScreenStart(unsigned short offset)

    {

    unsigned char offsetLow, offsetHigh;


    offsetLow = offset & 0x00FF;

    offsetHigh = (offset >> 8) & 0x00FF;


    asm cli; // disable interrupts

    outportb(CRTC_INDEX_REG, START_ADDRESS_HIGH_INDEX);

    outportb(CRTC_DATA_REG, offsetHigh);


    outportb(CRTC_INDEX_REG, START_ADDRESS_LOW_INDEX);

    outportb(CRTC_DATA_REG, offsetLow);


    asm sti; // enable ints

    }


    The offset you pass in the offset in video memory where the screen will be drawn next frame, allowing page flipping and hardware scrolling.


    define CRTC_INDEX_REG 0x3D4

    define CRTC_DATA_REG 0x3D5

    define START_ADDRESS_HIGH_INDEX 0xC

    define START_ADDRESS_LOW_INDEX 0xD


    Rock


Sign In or Register to comment.