home *** CD-ROM | disk | FTP | other *** search
/ Intermedia 1998 January / inter1_98.iso / www / rozi / MOD2.ZIP / XMSDRV.DOC < prev    next >
Text File  |  1995-05-20  |  3KB  |  65 lines

  1.  
  2.  XMSDRV.TPU
  3.  
  4.  XMS handling library.
  5.  Copyright by TSC-Software, 1993-95.
  6.  
  7.  -----------------------------------------------------------------------------
  8.  
  9.  Link this library into your software and you'll have completely control of
  10.  extended memory, which is managed by a XMS-handler like HIMEM.SYS
  11.  The unit offers you various procedures and functions to access the XMS-mem. 
  12.  
  13.  
  14.  The following data and procedures are declared as public
  15.  
  16.  
  17.  
  18.  Var
  19.   XMSAddr: Pointer;            { Holds the address of the expanded   }
  20.                     { memory manager. If NIL then the ma- }
  21.                     { nager isn't installed. Don't change }
  22.  
  23.   Procedure A20Access(Access: Word);    { For professionals only. 0=OFF, 1=ON }
  24.  
  25.   Function EMBAvail: Word;        { Returns the available size of XMS in kB }
  26.   Function EMBMax: Word;        { Returns the complete XMS-mem size in kB }
  27.  
  28.   Function  LockEMB(Var Handle: Word): Pointer;      { Locks an allocated EMB }
  29.   Procedure UnlockEMB(Var Handle: Word);           { Unlocks a locked EMB }
  30.  
  31.   Function  GetEMB(Size: Word): Word;               { Allocates an EMB }
  32.   Procedure ReSizeEMB(Var Handle: Word; Size: Word);  { Resizes an alloc. EMB }
  33.   Procedure FreeEMB(Var Handle: Word);              { Free up allocated EMB }
  34.  
  35.   Procedure MoveEMB(Var EMMStruc);     { Move mem contents from or to XMS-mem }
  36.  
  37.  
  38.  How to write something to XMS-mem:
  39.   1. Check if XMS-handler is installed (XMSAddr <> NIL)
  40.   2. Check if enough XMS-mem is free (EMBAvail >= needed size)
  41.   3. Allocate an EMB by using GetEMB (Size in kB) and save the handle, which
  42.      is returned. If handle is zero then an error has occured.
  43.   4. Now use MoveEMB to copy data from base memory into XMS. EMMStruc is de-
  44.      fined as the following record:
  45.  
  46.       for moving from                      for moving from
  47.       base mem to XMS                     XMS to base mem
  48.   
  49.      EMMStruc = Record                    EMMStruc = Record;
  50.       Counter: LongInt; <-------- must be even ------->     Counter: LongInt;
  51.       SHandle: Word;    <-- zero       | EMB-handle -->     SHandle: Word;
  52.       SOffset: Pointer;    <-- mem addr   |     offset -->     SOffset: LongInt;
  53.       THandle: Word;    <-- EMB-handle |       zero -->     THandle: Word;
  54.       TOffset: LongInt;    <-- offset     |   mem addr -->  TOffset: LongInt;
  55.      End;                        End;
  56.  
  57.      You can't copy more than 65528 bytes in one time. So increase the offset
  58.      of the EMB by the count of bytes you've just copied and go on.
  59.   5. Now you can lock  your EMB and get the physical address where it's loca-
  60.      ted in XMS. Now do what you want with it.
  61.   6. Unlock your EMB and release it.
  62.  
  63.  
  64.   VOCS.TPU needs this unit internally for loading VOC-files into XMS-memory.
  65.