Page 1 of 1

Determing the OEM string[SOLVED]

Posted: Wed Oct 27, 2010 2:35 am
by Chandra
I've been facing difficulty while determing the OEM string for my grpahics card. I've read the Vesa 2.0 specification which clearly states that the pointer to the OEM string is a far pointer which resides somewhere below 1MB ( I'm not talking about the OEM Vendor Name just the OEM string).But i don't seem to find any string at all. Since I do this stuff in my bootloader, here's the code in assembly:

Code: Select all

mov DI, VESAINFO 
mov ax,4F00h
int 10h

mov eax, DWORD [VESAINFO+6]
mov [oem_string_ptr],eax
The value oem_string_ptr is passed to the kernel as the packed structure in the memory(with other values such as memory size, adress of frame buffer etc. all packed as a table in memory). I retrieve the oem_string_ptr from the memory from my kernel but the oem_string_ptr seems to point to the location where no string exists. Have I missed something?

Re: Determing the OEM string

Posted: Wed Oct 27, 2010 2:44 am
by Combuster
are you actually using it as a segment:offset address, and not a 32-bit address?

Re: Determing the OEM string

Posted: Wed Oct 27, 2010 3:24 am
by TylerH

Code: Select all

mov DI, VESAINFO
mov ax,4F00h
int 10h

mov eax, DWORD [VESAINFO+6]

; Convert to near ptr
shr eax, 16
shl eax, 4
add eax, WORD [VESAINFO+8]

mov [oem_string_ptr],eax
I think this'll work...

Re: Determing the OEM string

Posted: Wed Oct 27, 2010 5:52 am
by Owen
TylerAnon wrote:

Code: Select all

mov DI, VESAINFO
mov ax,4F00h
int 10h

mov eax, DWORD [VESAINFO+6]

; Convert to near ptr
shr eax, 16
shl eax, 4
add eax, WORD [VESAINFO+8]

mov [oem_string_ptr],eax
I think this'll work...
In real mode?! I think not...

Re: Determing the OEM string

Posted: Wed Oct 27, 2010 8:24 pm
by Chandra
I tried changing the far ptr to near ptr and now the oem_string_ptr points to 0xC0000;
But still no string seems to exist there. Please help.

Re: Determing the OEM string

Posted: Thu Oct 28, 2010 4:03 am
by Combuster

Code: Select all

add eax, WORD [VESAINFO+8]
You folks realize that this is not valid assembly?

Have you tried to print the original value (what is it?) and determine for yourself what the correct physical address should be?

Re: Determing the OEM string

Posted: Thu Oct 28, 2010 5:34 am
by Chandra
Combuster wrote:

Code: Select all

add eax, WORD [VESAINFO+8]
You folks realize that this is not valid assembly?
I know that very well. Its not worth mentioning it that the assembler reports it as a 'mismatch in operand sizes'.It should be mov ax,WORD [VESAINFO+8]. Anyway, that's not what I am having problem with. Any more help please?

Re: Determing the OEM string

Posted: Thu Oct 28, 2010 8:05 am
by Combuster
Anyway, that's not what I am having problem with.
*cough*
add eax, WORD [VESAINFO+8]
(...)
mov ax,WORD [VESAINFO+8]
Start with finding a substitute that actually does what the original intended to do. This one is plain broken. No wonder you got the wrong values. (hint: you need more than one instruction)

Re: Determing the OEM string

Posted: Thu Oct 28, 2010 8:42 am
by Gigasoft
Sigh.

Code: Select all

movzx eax,WORD [VESAINFO+6]
movzx ecx,WORD [VESAINFO+8]
shl ecx,4
add eax,ecx

Re: Determing the OEM string

Posted: Thu Oct 28, 2010 7:49 pm
by Brendan
Hi,
Chandra wrote:Anyway, that's not what I am having problem with. Any more help please?
In real mode, you need a far pointer. It should be something like:

Code: Select all

    mov ax, [VESAINFO+6]
    mov si, [VESAINFO+8]
    mov es,ax                                    ;es:si = far pointer to OEM string
If this doesn't work, check that the routine you're using to print strings can handle far pointers (and if it doesn't, maybe consider writing an alternative version of it that uses "es lodsb" instead of just "lodsb", or "mov al,[es:si]" instead of just "mov al,[si]").

Of course it's also possible that the video card doesn't bother with the OEM string - it's not like it serves any practical purpose (and not like video card manufacturers actually implement everything VBE says they should correctly).


Cheers,

Brendan

Re: Determing the OEM string

Posted: Fri Oct 29, 2010 6:00 am
by Chandra
Thank you Gigasoft. I need to retrieve the OEM string in protected mode(from my kernel) and your code to change far ptr to near ptr works awesome. Thank you Brendan too for real mode code. And thank you all.

Great!

Re: Determing the OEM string

Posted: Sat Oct 30, 2010 6:55 am
by Owen
Brendan wrote:

Code: Select all

    mov ax, [VESAINFO+6]
    mov si, [VESAINFO+8]
    mov es,ax                                    ;es:si = far pointer to OEM string
I can't help but think that

Code: Select all

  les ax, [VESAINFO+6]
would be shorter, and show some love for the little-used LxS instructions ;-)