Page 1 of 1

vga memory in Long Mode

Posted: Tue Dec 15, 2009 5:51 am
by jcmatias
How to acess video memory in Long Mode using 1024x768 32 bits colors resolution.
There are a 64KB bank limitation ?
How to perform Bank switch ?

Re: vga memory in Long Mode

Posted: Tue Dec 15, 2009 6:01 am
by AJ
Hi,

Firstly, this isn't really VGA if you are using 1024x768x32.

Your best bet is to switch the mode to something that supports a LFB before you enter long mode.

An alternative is to use the VBE PMode interface, but a) you cannot rely on this being present (and have to handle the case where it is not) and b) I'm not sure if it works in compatibility mode.

Of course, you can't rely on a LFB-compatible mode being present either, so you probably still need a basic VGA driver.

Cheers,
Adam

Re: vga memory in Long Mode

Posted: Wed Dec 16, 2009 8:55 am
by djsilence
You have to get VBEModeInfo (read VBE 3.0 Spec from vesa.org). One of the fields is PhysBasePtr - this is pointer to LFB. But your mode number have to be ORed with 0x4000 (if you mode number is 0x11B in Bank switching, so in LFB - 0x411B) and using it you can write dirrectly to the video memory area without bank switching.