From: scott@mycro.UUCP (Scott C. Sadow)
Newsgroups: comp.sys.ibm.pc.hardware,comp.sys.ibm.pc.misc
Subject: Re: Memory addressing in protected mode (specifically address pin A20)
Date: Sat, 02 Jan 93 12:33:32 EST

In article <1992Dec29.193519.13638@verdix.com>, drew@verdix.com (Drew Johnson) writes:
>I am trying to run some code on a 'bare' IBM AT board, ie no DOS.  I have
>everything working fine except for one problem:  I cannot get the board
>to recognize address bit 20.  If I access memory at address 0x100000, it
>is the same memory as at address 0x0.  I am switching the board into protected
>mode 'manually', not by using the BIOS function.  Does anybody out there
>know what I have to do to get a PC board to use bit 20 in protected mode?
>On a PS/2, there is a configuration I/O address that you have to write to
>to turn on gate A20 addressing.  I can find no equivalent for the AT.  
>
>Any help would be greatly appreciated.
>
>Drew Johnson
>drew@verdix.com


   I had the same problem. What I found is that there is a line on the
keyboard that enables/disables A20. I started with the following file from
Simtel: 
   PD1:<MSDOS.SYSUTL>A20TEST.ZIP 4728 901222
      A20 address line enable/disable/status display

   From that program, I wrote a simple test program that queries, enables,
and disables the A20 line. (I use this code to enter & exit 80386
protected mode)

   Here is a uuencoded zip file with A20.ASM and A20.EXE:

begin 400 a20.zip
M4$L#! H    &  QJ2AA#X%R8?@,  ,,,   '    03(P+D%330T" 1(C%!4V
M-VB)FML\!082$T3%]I;W08((KM.2+1N6;4,%SGG;-\^;S?'33>LV+\LQUTFU
M==O"G>.<G$LW[-@USLDQ]3^W[!GH%;RG9&^Y='5H)X<VA7+<MXK-2[<L2*)3
M=>*$B;0K2QC@2:5:CFN@0*/6+2LWS[#0SIL^M7+<@S)EN25_RLA?WC':F/>?
M+'HB&KY(-%[4;5BQ;,O$![=,?!#,!S=+.8"=IQQPEC?1M'.8AYSQ6)]*^:^Q
MLA!>UG#/FHEUEPESZMVT=,>B*1NK9)XH$LX<RX:#$I6M8V ##C*1!(QY8IRP
M!DO$6K\U:P;Q3<?H-YU[QI\F0S;>J1:R)50YG]MTQ*\-$(K!?5F2H5KA9U2!
M.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5
M(&/DCK'33M@\)&Z 3(@/*A,FR+1S019U&E0HTZ)$&RHD 4T233HE&H_JT>!5
MJ[XV=\?>?4,$.,/XX_QS Q0X_Y37CP\(U.O7@Q^S#E\(O*Y(]$BZ?BCLZ.;)
MHC/;=<+N;AXL>AO(QX3]+]I;((]R/4CT)HP/$<X[((\1]K=PIX#\@W"^ #FT
M!.F'6?UPJ%%G)B=/EJ1 \/JS8AWV:8#_^T3 _WU<P/\% P#<+Q7@0 ;'+A#@
MA6@RP#<T> /OD *.!BH!?-8]($3^_Y]G+Z#.J@V:-,#,F&;1',$[1[#/_PU[
M@G>NX)G^E\S>G<$S$7R#G$4^H"<AL),.J"91X$4R..83KD8?>"<7'),K[HE#
MZ"Z#3FURK !02P$""P *    !@ ,:DH80^!<F'X#  ###   !P         !
M "          03(P+D%335!+ 0(+  H    & $1E(AJ7Q4THA@$  .0'   '
M            (    *,#  !!,C N15A%4$L%!@     "  ( :@   $X%    
!    
 
end


   Scott C. Sadow
   scott@mycro.UUCP
   ...gatech!nanovx!mycro!scott
Xref: sparky comp.sys.ibm.pc.hardware:34343 comp.sys.ibm.pc.misc:16177