🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc
Article #42230

Re: 4 gigs in Real Mode

#42230
From: Dr Yeung-Cho Ip
Date: Mon, 12 Feb 1990 12:09
62 lines
2082 bytes
In article <1990Feb5.153408.15670@umn-cs.cs.umn.edu> kemp@umn-cs.cs.umn.edu (Stuart R. Kemp) writes:
>
>If anyone gets the A20 addressing line problem solved post it to
>comp.sys.ibm.pc and send me some mail.
>

Now here is a small program written in TURBO C, which toggels
the state of the A20 bit every time it is called. I can't
test it with Koenigs program, since I don't have a 386 box.
I hope it meets
your needs. If you want to set A20 to a constant value, you
only have to change the line before the last one in main().
(  put_dat((ea^0x02) | 0xD1); /* toggel a20 bit */)
(               ^                                 )
(               |                                 )
( This is the bit value of the a20 bit            )

Hope that helps

Michael Franzen, c/o yip@ztivax.uucp, Siemens AG, Munich

------------------------ cut here ---------------------------
#include <dos.h>

#define COMMAND 0x64
#define STATUS  0x64
#define DATA    0x60

put_com(c)
unsigned char c;
{
  if (inportb(STATUS)&0x1) inportb(DATA); /* Datenport loeschen */
  do ;
  while(inportb(STATUS)&0x3);
  outportb(COMMAND, c);
}

put_dat(d)
unsigned char d;
{
  do ;
  while(inportb(STATUS)&0x2);
  outportb(DATA, d);
}

unsigned char get_dat()
{
  while(!(inportb(STATUS)&0x1));
  return(inportb(DATA));
}

main()
{
unsigned char ea;

  disable();
  put_com(0xD0); /* Read EA Port */
  ea = get_dat();
  put_com(0xD1); /* Write EA Port */
  put_dat((ea^0x02) | 0xD1); /* toggel a20 bit */
  enable();
}
Technical Details
Message-ID: <896@ztivax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!mcsun!unido!ztivax!yip
References: <1990Feb5.153408.15670@umn-cs.cs.umn.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!mcsun!unido!ztivax!yip
From: yip@ztivax.UUCP (Dr Yeung-Cho Ip)
Newsgroups: comp.sys.ibm.pc
Subject: Re: 4 gigs in Real Mode
Summary: Program for toggeling A20
Keywords: A20
Message-ID: <896@ztivax.UUCP>
Date: 12 Feb 90 12:09:55 GMT
References: <1990Feb5.153408.15670@umn-cs.cs.umn.edu>
Reply-To: yip@ztivax.UUCP (Dr Yeung-Cho Ip)
Organization: Siemens AG in Munich, W-Germany
Lines: 62