[comp.sys.ibm.pc.programmer] EMS driver

ctroup@ariel.unm.edu (Charles Troup) (05/09/90)

Reply to: Gunnar Olsson,  University of California, Irvine
RE: EMS driver query

	The first question is, do you really have any EMS?  If you have
an AT with 1 MB of ram, you probably have Extended memory.  That's
memory addressed above 1 Megabyte.

	EMS memory is a stunt for PC's, like PC/XT's, to be able to
have more memory, since they cannot address beyond 1 MB, no way, shape,
or form.  No such higher address lines exist.  EMS memory is usually
mapped to around CC00:0 or D000:0 or there-abouts, by the EMS driver.
Then the EMS driver controls special hardware on the EMS memory board
to swap around 4 each 16-Kbyte-sized blocks of EMS ram, to make them
appear in a 64Kb space there.  If you really have EMS, you should have
gotten the driver with the board.

	 The AT, on the other hand, has 24-bit addressing, for a
16-Megabyte address space.  Most extra memory on them is extended, and
the extra 384 Kb is addressed starting at 1 MB, although I've heard
rumors of a few manufacturers putting EMS hardware on their
motherboards.  You can certainly install an EMS board in an AT:  I've
got both kinds of memory in mine, and it works fine.  The board is an
Everex EV-159, which came with the drivers.  But that's added-on stuff.

	Since I am guessing that you really have extended memory, you
will need an extended memory (XMS) driver.  Fortunately, that is
available free.  You can write to Microsoft Corporation,  16011  NE
36th Way, Box 97017, Redmond WA  98073,  and politely request a copy of
the latest XMS driver and spec, on floppy.  You will get a whole bunch
of goodies, including the run-down on XMS, extended memory, and even
source code for drivers, as well as the finished, usable driver.

	That still leaves you will the problem of making calls to the
driver from Pascal.  Dunno for sure there, I'm an assembly-and-C
programmer myself.  I just write up short C-callable routines in
assembly to do the job of calling the driver.  Making it C-callable is
just a matter of writing the assembly so that it knows that all the
arguments are on the stack, and where.  Pascal does the same thing,
except that it pushes arguments in the opposite order than C does.  C
pushes right-most arguments and proceedes to the left, Pascal does
left-hand ones first (I'm told).

	If you can call assembly from your Pascal, then you are home
free.  One of my hacker friends who is a Pascal lover uses Turbo
Pascal, and raves about how it lets him insert in-line assembly code.
He loves it.  I love C.  So it goes.

	Incidentally, if you have an AT with some extended memory,
you might also want to read a file I'm sending around, which goes
into how to use the un-publicized 80286 Loadall instruction to get at
such ram.  It'll answer some more of your questions about high ram.
Send a note to 76416.553@compuserve.com, with your full Internet
address, and I'll pong you a uuencoded file through the Internet.

--Terry
(Terrance Hodgins  CIS 76416,553  Internet: 76416.553@compuserve.com
--or--  terry@scopes.unm.edu