[comp.sys.ibm.pc] Writing to extended memory

cowl1453@neptune.uucp (Tim Cowles) (08/11/89)

    As I am new to this group please excuse me if my questions have already been
answered by previously posted articles.


    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 would greatly appreciate any references to published material and/or source
code fragments (in C or 80286 asm please) that would help me solve this little 
problem.



						    Thank You
						    
						    Potter

kaldis@topaz.rutgers.edu (Theodore A. Kaldis) (08/16/89)

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.
-- 
              Theodore A. Kaldis                      |  "Perhaps we may
              +-+-+-+-+-+-+-+-+-                      |   frighten away
      email:  kaldis@topaz.rutgers.edu                |   the ghost of so
       UUCP:  {...}!rutgers!topaz.rutgers.edu!kaldis  |   many years ago
 U.S. Snail:  P.O. Box #1212, Woodbridge, NJ  07095   |   with a little
 ex-Ma Bell:  (201) 283-4855  (voice)                 |   illumination . . ."

stephen@ziebmef.uucp (Stephen M. Dunn) (08/18/89)

In article <Aug.16.08.13.59.1989.27380@topaz.rutgers.edu> 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 !

shap@bunker.UUCP (Joseph D. Shapiro) (08/22/89)

In article <1989Aug18.092544.5202@ziebmef.uucp> stephen@ziebmef.UUCP (Stephen M. Dunn) writes:
>In article <Aug.16.08.13.59.1989.27380@topaz.rutgers.edu> kaldis@topaz.rutgers.edu (Theodore A. Kaldis) writes:
>$In article <12048@orstcs.CS.ORST.EDU> cowl1453@neptune.uucp (Tim Cowles) writes:
>$> 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. )
>   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

well, to split hairs, and maybe the difference is significant to the
original poster, it is possible on most 286 machines to access about 64k
of the extended memory without going into protected mode.

If you call microsoft, they will send you, *free*, HIMEM.SYS (an arbitrator
for this 64k of memory) and instructions on how to ask it for buffers.

So -- if 64k is enough, AND your 286 machine allows it (a fairly safe bet),
you may be in luck.

-- 
__--__--__--__--__--__--__--__--__--__--__--__--__--__--__--__--__--__--__--__
Joe Shapiro					"My other car is a turbo...
ISC-Bunker Ramo     				 ...too."
{decvax,yale,philabs,oliveb}!bunker!shap