🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #3414

Re: How can the address line 20 be enabled

#3414
From: aki
Date: Mon, 28 Sep 1992 16:54
50 lines
2822 bytes

[original message asked how to toggle A20 on 286's with 100% IBM
compatible A20-line control (which is not always the case, BTW)]

1. set up an IRQ handler for the keyboard 8042 chip (IRQ 1 i.e. INT 9)
   or DISABLE the 8042 IRQ (just mask it out).  DISABLE the keyboard
   by sending the command Disable Keyboard (0ADH) to the 8042 cmd
   port at I/O 64H.  You are clear to send a cmd when bit 1 of I/O
   64H is 0.
2. send the command Read Output Port (0D0H) to the 8042 command
   port, i.e. I/O 64H.
3. wait a little while for the 8042 to process your request...
   just keep checking I/O 64H bit 0;  when it turns into 1, you
    got your data ready for a read at I/O 60H.
4. BIT 1 of the byte of data you just read from 60H contains
   the state of the A20 gate.  If it's 0,  you can't go beyond 1M.
5. Flip the bit if you want to and write a Write Output Port command
   to the 8042 (0D1H). When bit 1 fof I/O 64H is 0,  you can send
   the updated A20-state byte by writing it to I/O 60H.
6. Remove your IRQ handler/enable the keyboard IRQ.  Enable the
   keyboard by writing 0AEH to I/O 64H.

[original mesage asked about A20 state with HIMEM]

You can ask the XMS driver if A20 is enabled or disabled.
It also will do the bit flipping for you and it supports
far more different MB designs and chip sets than any
mortal programmer can.  For a complete reference of XMS
stuff,  either call the Intel BBS at 503-645 6275 or get
Ralf Brown's interrupt list. (INTER32x.ZIP is the latest
versio with 'x' standing for 'A', 'B' or 'C' to denote the
three files the megasized list is divided into).

PS. When screwing with the A20 line directly be careful to
enable the KBD in all error situations.. it would not be nice
to sit around with no KBD access.  Also,  because the 8042
can be _slow_ it's not a good idea just to clear INT's for
the duration of the transaction. Always check I/O 64H if it's
ok to send or read data to/from the 8042.  Don't change any
other bits in the Output Port Byte... if you do you may get
interesting effects (such as a system reset).  And PLEASE
use the HIMEM.SYS driver if only possible to keep them up
to the standards of the (early) 90's.

Aki.

-- 
/  Phone: 408-662 9664   Fax: 662 9676  |  "Aki" pronounced: Ah-Key. I know  \ 
\  125 Searidge Ct #D, Aptos, CA 95003  |  what I'm doing most of the time.  /
Technical Details
Message-ID: <4372@cruzio.santa-cruz.ca.us>
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!decwrl!csus.edu!netcom.com!netcomsv!cruzio!aki
References: <s921880.717667372@minyos.xx.rmit.OZ.AU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!decwrl!csus.edu!netcom.com!netcomsv!cruzio!aki
From: aki@cruzio.santa-cruz.ca.us
Newsgroups: comp.os.msdos.programmer
Subject: Re: How can the address line 20 be enabled
Message-ID: <4372@cruzio.santa-cruz.ca.us>
Date: Mon, 28 Sep 92 09:54:27 PDT
References: <s921880.717667372@minyos.xx.rmit.OZ.AU>
Sender: aki@cruzio.santa-cruz.ca.us
Reply-To: aki@cruzio.santa-cruz.ca.us
Lines: 50