Hi,
For the Return VBE Mode Information function, the ModeInfoBlock is copied to your buffer at ES:DI. This isn't just "DI" and isn't DS:DI. You haven't shown code that sets up segment registers (or stack, or...) so you'll need to check that ES is sane yourself.
The Return VBE Mode Information function may return "AX = 0x 4F00" (OK) to tell you it successfully filled your buffer with a ModeInfoBlock. This does not mean that the video mode is supported by the video card (only that a ModeInfoBlock was returned), and you need to check bit 0 in the ModeAttributes field to determine if the mode is supported by the video card. While doing this you should also check bit 7 in the ModeAttributes field to determine if the video mode supports LFB. If the video card doesn't support this video mode (and there's lots of video cards that don't support any 24-bpp modes) and bit 0 in the ModeAttributes field is clear, then you can't rely on any of the other fields (and can't assume the PhysBasePtr field is valid).
If the Return VBE Mode Information function doesn't return "AX = 0x 4F00" (OK), then setting DX to 1 and attempting to set the video mode anyway won't help. If the Set VBE Mode function doesn't return "AX = 0x 4F00" (OK), then ignoring the error and pretending the mode was set won't help.
For the VBE ModeInfoBlock, the PhyBasePtr field is a 32-bit physical address. It is not a 64-bit physical address, and you can't pretend that the Reserved field that follows it is the upper 32-bits of a 64-bit address (and shouldn't assume that the following Reserved field will contain zero either).
You do need to determine if the video card is VBE 1, VBE 2 or VBE 3 (by using the Return VBE Controller Information function). If the video card is VBE 1 then LFB isn't supported (and some of the fields in the ModeInfoBlock, including the PhyBasePtr field, shouldn't be relied on). For VBE 2 you need to use the BytesPerScanLine field in the ModeInfoBlock (for both bank switched and LFB modes). For VBE 3 the BytesPerScanLine field in the ModeInfoBlock is only used for bank switched video modes, and you have to use the LinBytesPerScanLine field in the ModeInfoBlock for LFB modes. In the same way, for VBE 3 the RedMaskSize, RedFieldPosition, etc fields should only be used for bank switched modes and you should use the LinRedMaskSize, LinRedFieldPosition, etc fields instead for LFB modes.
usb2killer wrote:what to do?
Did you use a debugger (e.g. like the one built into Bochs) to check that the address of the LFB you're using is sane, or see if the ModeInfoBlock is being returned, or do any simple checks to see what is going wrong?
Cheers,
Brendan