I am trying to mdevelop my own proof of concept operationg system. Just some basics. I just got into graphics with vbe. One problem I had was to get supported video modes. After intense research I found vbe get bios information (ax=4f00 int 10) and I implemented it as follows
This is real mode
mov ax, 0
mov es, ax
mov ax, [vbe_info_structure]
mov di, ax
mov ax, 0x4f00
int 0x10
cmp ax, 0x004F
jne notOK
and declared vbe_info structure as follows also in real mode
vbe_info_structure:
.signature db "VESA" ; indicate support for VBE 2.0+
.table_data: resb 512-4 ; reserve space for the table below
I then passed its adress to my kernel as a parameter like this (32 BIT !!!)
mov eax, [vbe_info_structure]
push eax
call _kmain
and my simple kernel code is like this (32 BIT)
struct VbeInfoBlock {
char VbeSignature[4]; // == "VESA"
uint16_t VbeVersion; // == 0x0300 for VBE 3.0
uint16_t OemStringPtr[2]; // isa vbeFarPtr
uint8_t Capabilities[4];
uint16_t VideoModePtr[2]; // isa vbeFarPtr
uint16_t TotalMemory; // as # of 64KB blocks
} __attribute__((packed));
int kmain(struct VbeInfoBlock *vbeinfo)
{
init_idt();
SetPITSpeed(100);
init_DTCursor();
printf(vbeinfo->VbeSignature[0]);
while(1);
}
Excepted input from printf should be "V" but I get junk S and some ascii junk only 2 characters.