Page 1 of 1

keyboard same port that a20?

Posted: Fri Apr 05, 2002 12:00 am
by blito
hi.
where could i find info on why the keyboard is in
the same port as the a20
wat's the chip interfacing it.
Why should i enable the a20. i don't understand the
need to do this if in protected mode y can acces
32bits of direction.
The a20 is part of the 32bits direction?.
i cant find information on that so please guide me
thank's

RE:keyboard same port that a20?

Posted: Sun Apr 07, 2002 11:00 pm
by Schol-R-LEA
>On 2002-04-05 12:17:47, blito wrote:
>hi.
>where could i find info on why the keyboard is in
>the same port as the a20
>wat's the chip interfacing it.
>Why should i enable the a20. i don't understand the
>need to do this if in protected mode y can acces
>32bits of direction.
>The a20 is part of the 32bits direction?.
>i cant find information on that so please guide me
>thank's

The A20 line gateway is a relic of the 286 days.
When the 286 was first released, there was a
small section of memory - the high memory area -
which the 286 could access even in real mode.
Since it was (correctly) anticipated that this
would break some 8086/8088 code which depended on
the location of the end of memory, the IBM
engineers designed the AT such that it would
block access to the HMA unless it was explicitly
set to.

What they did was force the 21st address bit -
A20 - to be gatewayed through a switch. They
chose to use the keyboard controller as a simple
expedient, as it had functionality that was not
being used and doing so would save a few chips.
When a PC-type computer boots, the A20 address
line is disabled, and memory accesses above 1M
wrap back to (address % 1M). Since this was a
hardware fix, it affected protected mode
addressing as well.

This design, enshrined in the AT, was subsequently copied by all succeeding PC
models, for the sake of backwardness - ahem,
I mean backward compatibility.

The practical upshot is, if you want to access
memory above 1M on any PC, you need to open the
A20 line first.

Any corrections or additions would be
appreciated.

Additional Information

Posted: Sun Apr 07, 2002 11:00 pm
by Schol-R-LEA
The following pages have some useful material
on the A20 line:

http://www.win.tue.nl/~aeb/linux/kbd/A20.html

http://x86.ddj.com/productivity/a20reset.htm

http://www.phys.uu.nl/~mjanssen/control.php?chapter=9
(Part of a larger tutorial on OS development; the
main page is http://www.phys.uu.nl/~mjanssen/)

http://www.mega-tokyo.com/os/os-faq-memory.html
(This is on Dark Fiber's OS site; see
http://www.mega-tokyo.com/os/os-faq.html for more)