Page 1 of 1

A20 and protected mode

Posted: Fri Jan 18, 2008 3:37 am
by Lovmy
Hello,

Sorry me English is not very well.

I don't understand why we must activate A20 line before switch to protected mode. Actually i don't make this and my program work fine.

With A0 to A19 address line we can acces from 0 to FFFFF memory (1Mo).
With A20 activated, we can acces from 0 to 1FFFFF memory (2Mo).

In protected mode adresse are coded on 32 bits, from 0 to FFFFFFFF (4Go).
What's the role of A20 line here ? To acces to memory from 1 to 2Mo if i return to real mode ?

Can you explain me ?
Thank you very much !

Posted: Fri Jan 18, 2008 3:54 am
by AJ
Hi,

It's mainly a compatibility thing. On some machines you will find that if A20 is not activated, you will only be able to access every other MiB of address space in PMode. It may be that emulators/modern PC's don't do this - but better to be safe.

Cheers,
Adam

Posted: Fri Jan 18, 2008 5:42 am
by Zacariaz
so i might not need to enable a20 at all? how do i investigate that?

Posted: Fri Jan 18, 2008 6:14 am
by Combuster
just try if its enabled or not :wink:

Posted: Fri Jan 18, 2008 4:26 pm
by bewing
Ah, c'mon. It's only 30 or 40 lines of cut-and-paste assembly to stuff into your bootloader.

Example

Posted: Mon Jan 21, 2008 1:21 am
by Lovmy
Hello,

Can you write example of code to activate A20 adress line ?

It's code to put before LGDT ? (in real mode) ?

Thank you !

Posted: Mon Jan 21, 2008 3:16 am
by AJ
Please seearch the wiki and google before posting - there are countless examples available.

A20 Line