VESA Video Mode : can't draw on whole screen

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Dave08
Posts: 8
Joined: Mon May 27, 2019 11:32 am
Location: France
Contact:

VESA Video Mode : can't draw on whole screen

Post by Dave08 »

Hello,
I'm developing a small OS in unreal mode using mode 0x112 (640x480 16.8M colors) for a GUI system.

Here's my problem : I'm limited to a block of exactly 64 KB of "VRAM" starting at 0xA0000. Actually, I'm not really limited, I'm setting the pixel values correctly on "presumably" the WHOLE screen, but this is what's actually happening :
Capture.PNG
Capture.PNG (6.3 KiB) Viewed 1040 times
I have no idea what's causing this problem. The video mode is correctly set, I'm using extended registers to access memory...

Any help would be appreciated,
Thanks.
MichaelPetch
Member
Member
Posts: 798
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: VESA Video Mode : can't draw on whole screen

Post by MichaelPetch »

The video hole at 0xa0000 is 64KiB in size. You can only write to a portion of the entire video space for a screen resolution of 640x480x24-bit color. 640x480x24-bit = 921600 bytes. If you write a color to the 64KiB at 0xa0000 you aren't filling the whole display, just the bytes associated with the first 64KiB of 921600 (which is why you only see a fraction of the screen painted). Mode 112h uses 15 banks that you have to switch between 15*64KiB=983040 (most of the last bank is unused) in order to reference all the pixels.

VBE 1.2+ should support mode 640x480x24-bit color. If you have VBE 2+ Have you considered querying VBE for this resolution and getting back a pointer to the video frame buffer (aka linear frame buffer aka LFB). This can be done with Int 10h, AX=4f01h. Since you are in unreal mode you should be able to reference the entire video frame buffer directly (the frame buffer address will be above the 1MiB somewhere). You will also have to ensure you have enabled the A20 line.
User avatar
Dave08
Posts: 8
Joined: Mon May 27, 2019 11:32 am
Location: France
Contact:

Re: VESA Video Mode : can't draw on whole screen

Post by Dave08 »

Ok so my problem is no more!

Basically, what I did was creating a 256 bytes buffer and running the 4f01 command with the video mode 0x112 and started setting pixel colors to the mode's linear buffer (specified as a dword in the 256 bytes info buffer at offset 0x28).

now, these two lines :

Code: Select all

mov ebx, [_vge_info+0x28]
mov byte [ebx+2], 0xFF
made the first pixel red. And making a loop to fill the whole screen works, thanks to MichaelPetch!
Post Reply