Page 1 of 1

FP and BIOS RAM

Posted: Sat Aug 18, 2007 4:04 am
by inflater
Hello,
I'm trying to access bios ram in protected mode. As the selector 0x8 in ES is "linear data segment" and I can access video ram through es:0xB8000 (notice the number of zeros, one added), I would like to access BIOS RAM as in real mode. So, in protected mode, if I want to access video ram, i just put into ES the 0x8 and then, I can put in es:0xB8000 plus the "offset" known from real mode, for example if real mode address was B800:009C, the protected-mode address is es:B809C. This works fine, but if I want to access BIOS ram using this code:

Code: Select all

mov ax,8
mov es,ax
mov ax,0x40
mov bx,0x10
mul bx          ;from B800 to B8000 I would multiply it by 0x10 (16)
add ax,0x4A  ;the "offset" 0x4A
and with this metod I would read the screen width, like this:

Code: Select all

push es
push eax
mov ax,8
mov es,ax
mov eax,dword[es:44Ah]    ;got from 0x40 * 0x10 + 0x4A
mov TheResult,eax
pop eax
pop es
FP would end with error like this:
crt386.pas(110,17) Error: Invalid reference syntax
crt386.pas(110,22) Error: Asm: 16 Bit references not supported


But if I can access video RAM with this code, why i cant access BIOS RAM?
The code uses DexOS's GDT, and 0x8 is, as mentioned, linear data segment, read/write allowed, expanding down. Declaration:

Code: Select all

linear_sel_1:	
       dw 0xFFFF		           ; (8h) linear Data segment, read/write, expand down
       dw 0			                   
       db 0
       db 10010010b		                   
       db 11001111b                               
       db 0 
Why FP thinks I am trying to access real mode? Yes I know, that syntax above looks a little from realmode segmentation... but it isnt.

Thanks in advance.
Regards
inflater

Posted: Sat Aug 18, 2007 6:15 am
by Pavia
crt386.pas(110,17) Error: Invalid reference syntax
crt386.pas(110,22) Error: Asm: 16 Bit references not supported
Try this code.

Code: Select all

push es 
push eax 
mov ax,8 
mov es,ax 
mov eax,dword es:[44Ah]    //got from 0x40 * 0x10 + 0x4A 
mov TheResult,eax 
pop eax 
pop es
Symbol ";" used for declaration next instruction, in Pascal.

Code: Select all

push es ; push eax ; mov ax,8 ; mov es,ax 
mov eax,dword es:[44Ah]    //got from 0x40 * 0x10 + 0x4A 
mov TheResult,eax 
pop eax 
pop es

Posted: Sat Aug 18, 2007 6:46 am
by inflater
Thanks a lot Pavia, i see that NASM is a bit different from FASM... :P
A simple bracketing confuse can generate up to 26 errors in compiling :D

Regards
inflater