home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / basic / baswiz18.zip / BW$BAS.ZIP / MEMORYQ.BAS < prev    next >
BASIC Source File  |  1992-08-29  |  1KB  |  24 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |        BASWIZ  Copyright (c) 1990-1992  Thomas G. Hanlin III         |
  4. '   |                                                                      |
  5. '   |                      The BASIC Wizard's Library                      |
  6. '   |                                                                      |
  7. '   +----------------------------------------------------------------------+
  8.  
  9.    DECLARE SUB MAllocate0 (Bytes&, Ptr&, ErrCode%)
  10.    DECLARE SUB MDeallocate0 (Ptr&, ErrCode%)
  11.  
  12.    DEFINT A-Z
  13.  
  14. SUB MAllocate (Bytes&, Ptr&, ErrCode%)
  15.    junk& = SETMEM(-Bytes& - 48&)        ' make QB release memory
  16.    MAllocate0 Bytes&, Ptr&, ErrCode%    ' allocate what we need
  17.    junk& = SETMEM(999999)               ' release the rest back to QB
  18. END SUB
  19.  
  20. SUB MDeallocate (Ptr&, ErrCode%)
  21.    MDeallocate0 Ptr&, ErrCode%          ' deallocate memory
  22.    junk& = SETMEM(999999)               ' release it back to QB
  23. END SUB
  24.