Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!uunet!attcan!ncrcan!ziebmef!stephen
From: stephen@ziebmef.uucp (Stephen M. Dunn)
Newsgroups: comp.sys.ibm.pc
Subject: Re: Writing to extended memory
Summary: Don't confuse extended and expanded memory
Keywords: extended memory
Message-ID: <1989Aug18.092544.5202@ziebmef.uucp>
Date: 18 Aug 89 13:25:43 GMT
References: <1145@hcx1.UUCP> <693@jc3b21.UUCP> <12048@orstcs.CS.ORST.EDU> 
Reply-To: stephen@ziebmef.UUCP (Stephen M. Dunn)
Distribution: usa
Organization: Ziebmef Public Access Unix, Toronto, Ontario
Lines: 43

In article  kaldis@topaz.rutgers.edu (Theodore A. Kaldis) writes:
$In article <12048@orstcs.CS.ORST.EDU> cowl1453@neptune.uucp (Tim Cowles) writes:
$> I am working on a realtime PC program that uses a very high baud rate
$> serial card to aquire roughly 1Mbyte of data from a remote probe.  The
$> problem is that I cannot write to the drive while accepting data from
$> the serial stream, the timing is too tight and I lose data.   

$> Is there a reasonable way to write, during runtime and without using a 
$> virtual disk drive (same problem!), to the memory in my machine above 1M ??  
$> (It seems like it can be done, the virtual disk device driver does it. )

$I seem to recall that even VDISK.SYS has the very same problem when
$running in expanded memory -- or at least that there is a caveat in
$the IBM DOS manual about it.

   Watch it - you're getting expanded memory confused with extended memory!
DOS versions prior to 4.00 know absolutely nothing about expanded memory, and
that includes VDISK.  VDISK will, however, use extended memory.  (Just as a
refresher, extended memory is available only on 286s or better; expanded,
or LIM EMS, is available with the correct hardware on any machine)

   To access extended memory, you have to kick the 286 into "protected" mode,
which is the mode OS/2 runs in.  (The 286 in an AT-clone normally runs in
"real" mode, which emulates an 8086 and can only access 1M of memory).  You
then read or write to the extended memory.  The problem is that now you have
to get back to real mode.  The only way to do this is to reset the CPU!
(ATs have a special kludge so that the keyboard processor can reset the
CPU without losing memory etc.).  While the CPU is being reset, interrupts
are lost.  This is what interferes with serial comm, for example.  (Also,
while in protected mode, it's generally a good idea to turn off the
interrupts too, because the interrupt drivers for your comm package or
whatever are written to work in real mode and likely won't work in
protected mode).

   So, if you're running your comm program in real mode (which is just
about guaranteed), there is no simple way to use your extended memory.
Perhaps OS/2 might be able to help you out ... I know next to nothing about
OS/2, so you'd have to get advice on this from someone else.
-- 
-------------------------------------------------------------------------------
! Stephen M. Dunn              stephen@ziebmef.UUCP ! DISCLAIMER:  Who'd ever !
!---------------------------------------------------! claim such dumb ideas?  !
! I have become comfortably numb ...                ! I sure as heck wouldn't !