bewing wrote:If you load from that location into a 16 bit register, it will work, of course -- but you will only get the bottom 16 bits of the value.
You are also free to use 32 bit registers in 16 bit mode. The assembler just has to add one byte to the opcode to tell the CPU that the opcode is for a 32 bit instruction.
Please be careful telling people unfamiliar with assembly that they can use 32-bit registers for memory access, this is only viable in unreal mode, internally the CPU checks whatever the limit is in the selector cache, if you are in real mode, it's 65k (16-bits), and will clip a 32-bit value against this if that's how the limit is setup (same as just using a 16-bit register, except you used an extra byte infront telling it to use a 32-bit register)! Also, if you read the 32-bit value returned by the bios function for vesa, it is a segment/register pair, which would have to be converted to a linear address, so attempting to use it directly will not work even in unreal mode. Just because it's "using" a 32-bit register, which can hold a 32-bit value, doesn't mean you can read a 32-bit address if the segment cache limit is still at 64k.
johnl87: I would keep the query in there, and switch the modes, get the frame buffer pointer, and convert it to a linear address so you know where it's located in pmode. You can easily access the information in your vesa structure as well, either in pmode after converting the pointer to linear, or from real mode by using a segment register pair. I only know intel syntax (not a big fan of ATT syntax), but here is a short description on how to access the data of the Video Mode Ptr if returned as a dword (.long).
Code: Select all
;Inputs, eax = far pointer returned by bios
;Outputs, es = segment, bx = offset
;This can be simplified, but for readability, here is the function
PointerToSegOff:
mov ebx, eax
shr ebx, 16
mov es, bx
mov bx, ax
ret
;Lets assume we already filled our structure in at this point:
mov eax, VideoModePtr
call PointerToSegOff ;Converts us to a seg:offset [es:bx]
;es:bx is now a pointer to VideoModePtr data... so, we can now read it..
mov al, [es:bx] ;byte from offset + 0
mov ah, [es:bx+1] ;byte from offset + 1
mov ecx, [es:bx+4] ;dword at offset + 4
I don't recall what the format of the pointer is, but you would simply check whatever values you needed reading them as shown above.