VESA Video Modes: Difference between revisions

m
Convert to standard ISO data types
[unchecked revision][unchecked revision]
m (→‎VESA Functions: 0x400 is bit 10, which is reserved. should be bit 14 (hence 0x4000) instead.)
m (Convert to standard ISO data types)
Line 8:
struct VbeInfoBlock {
char VbeSignature[4]; // == "VESA"
shortuint16_t VbeVersion; // == 0x0300 for VBE 3.0
shortuint16_t OemStringPtr[2]; // isa vbeFarPtr
unsigned charuint8_t Capabilities[4];
shortuint16_t VideoModePtr[2]; // isa vbeFarPtr
shortuint16_t TotalMemory; // as # of 64KB blocks
};
 
Line 25:
<source lang="c">
struct ModeInfoBlock {
worduint16_t attributes;
byteuint8_t winA,winB;
worduint16_t granularity;
worduint16_t winsize;
worduint16_t segmentA, segmentB;
VBE_FAR(realFctPtr);
worduint16_t pitch; // bytes per scanline
 
worduint16_t Xres, Yres;
byteuint8_t Wchar, Ychar, planes, bpp, banks;
byteuint8_t memory_model, bank_size, image_pages;
byteuint8_t reserved0;
 
byteuint8_t red_mask, red_position;
byteuint8_t green_mask, green_position;
byteuint8_t blue_mask, blue_position;
byteuint8_t rsv_mask, rsv_position;
byteuint8_t directcolor_attributes;
 
dworduint32_t physbase; // your LFB (Linear Framebuffer) address ;)
dworduint32_t reserved1;
shortuint16_t reserved2;
};
</source>
Line 63:
 
<source lang="c">
UInt16uint16_t findMode(int x, int y, int d)
{
struct VbeInfoBlock *ctrl = (VbeInfoBlock *)0x2000;
struct ModeInfoBlock *inf = (ModeInfoBlock *)0x3000;
UInt16uint16_t *modes;
int i;
UInt16uint16_t best = 0x13;
int pixdiff, bestpixdiff = DIFF(320 * 200, x * y);
int depthdiff, bestdepthdiff = 8 >= d ? 8 - d : (d - 8) * 2;
Line 75:
strncpy(ctrl->VbeSignature, "VBE2", 4);
intV86(0x10, "ax,es:di", 0x4F00, 0, ctrl); // Get Controller Info
if ( (UInt16uint16_t)v86.tss.eax != 0x004F ) return best;
 
modes = (UInt16uint16_t*)REALPTR(ctrl->VideoModePtr);
for ( i = 0 ; modes[i] != 0xFFFF ; ++i ) {
intV86(0x10, "ax,cx,es:di", 0x4F01, modes[i], 0, inf); // Get Mode Info
 
if ( (UInt16uint16_t)v86.tss.eax != 0x004F ) continue;
 
// Check if this is a graphics mode with linear frame buffer support
Anonymous user