Re: VGA programming problems
Posted: Thu Sep 17, 2020 9:14 am
I did a search on my archives, and I've found this code (see attachment). It sets VGA modes without using the BIOS.
Just for the records, the only standard resolution with 256 colors on VGA is 320x200. There's a trick to use 320x240, but that's all. The reason is because there's no more video RAM to handle larger resolutions. 640x480 and 800x600 are 16 colors only to fit into 64k. (320 * 200 * 8 bit = 64k, and the standard 80x25 text mode is 9*80x16*25 = 720x400 pixels)
To support higher resolutions with 256 colors, you'll need SVGA. There you can only access 64k at once too, but you have a so called "bank" function which selects a window on a larger video RAM (meaning you can access different segments at 0xA0000 depending which bank is used). Unfortunately the banking function is manufacturer specific and not standardized as the other VGA registers.
For higher resolutions and packed pixels (hicolor or truecolor), you'll need VESA which is not VGA. VESA is only standardized at BIOS int interface level, so either you write a native video card driver or you need to use the BIOS. This mode uses so called linear framebuffer, which is not mapped at 0xA0000, therefore it's not limited to 64k. The buffer is contiguous, and can be arbitrary large.
Cheers,
bzt
Just for the records, the only standard resolution with 256 colors on VGA is 320x200. There's a trick to use 320x240, but that's all. The reason is because there's no more video RAM to handle larger resolutions. 640x480 and 800x600 are 16 colors only to fit into 64k. (320 * 200 * 8 bit = 64k, and the standard 80x25 text mode is 9*80x16*25 = 720x400 pixels)
To support higher resolutions with 256 colors, you'll need SVGA. There you can only access 64k at once too, but you have a so called "bank" function which selects a window on a larger video RAM (meaning you can access different segments at 0xA0000 depending which bank is used). Unfortunately the banking function is manufacturer specific and not standardized as the other VGA registers.
For higher resolutions and packed pixels (hicolor or truecolor), you'll need VESA which is not VGA. VESA is only standardized at BIOS int interface level, so either you write a native video card driver or you need to use the BIOS. This mode uses so called linear framebuffer, which is not mapped at 0xA0000, therefore it's not limited to 64k. The buffer is contiguous, and can be arbitrary large.
Cheers,
bzt