Page 1 of 1

A20 question

Posted: Thu Oct 23, 2003 12:10 am
by none
Hello

I have written some code to enable the A20 gate but somehow it seems to be on when I boot my computer. Here's the code that checks if A20 is enabled.

Code: Select all

_enable_a20:
   ; THIS IS FOR TESTING IF A20 IS ENABLED
   xor   ax, ax
   mov   bx, 0xFFFF
   mov   fs, ax
   mov   gs, bx
   mov   di, 0x0500
   mov   si, 0x0510
   mov    byte [fs:di], 0x00

   ; TRY TO ENABLE A20 THROUGH PORT 0x92
;       call   _a20_92
   mov   byte [gs:si], 0x01   ; TEST
   cmp   byte [fs:di], 0x01   ; TEST
   mov   si, msg_a20_92
   jne   _a20_on
As you can see the call that should enable A20 (_a20_92) is commented out so A20 shouldn't be enabled but it jumps to _a20_on so it looks like it is on.

Maybe it's me who can't think but 0000:0500 is the same as FFFF:0510 in real mode right?

Anyway I don't see how A20 can be enabled when I boot but maybe you can....

(BTW I'm using bochs when I test it so maybe it is bochs that enable A20 or something)

Re:A20 question

Posted: Thu Oct 23, 2003 3:14 am
by Pype.Clicker
there are bioses that enable the A20 gate by default, there are bioses that doesn't and there are bioses that let the user select through options in a menu.

This is one of the reasons why writing good code for enabling A20 gate is tricky (i.e. many do the assumption their code work while actually the BIOS did the job), and one of the reasons why i'd advocate for studying an existing bootloader / pmode launcher rather than trying to write your own from scratch ...