A20 question

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
none

A20 question

Post 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)
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:A20 question

Post 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 ...
Post Reply