home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / BASIC / POWBASIC / LIBRARY1 / EMSFRM.ZIP / EMSFRM.BAS
BASIC Source File  |  1990-05-10  |  2KB  |  55 lines

  1. 'EMS analysis program for PowerBASIC #2.00
  2.  
  3. 'This program determines whether Expanded Memory (EMS) is available on
  4. 'your system.  If so, it displays the segment of the "page frame".  The
  5. 'page frame is the 64K of real mode memory through which EMS is accessed.
  6. 'If your EMS driver locates the page frame below segment A000 (hex), the
  7. 'total memory available to PowerBASIC is actually reduced due to memory
  8. 'fragmentation.  It is best not to use such an EMS driver with PowerBASIC.
  9.  
  10. %AX = 1: %BX = 2: %ES = 9    'register equates for REG
  11. memlimit& = 640 * 1024 / 16
  12.  
  13. def fndigs$(h%) = right$("000"+hex$(h%),4)
  14.  
  15. cls
  16. print "EMSFRM: EMS Page Frame Analyzer for PowerBASIC #2.00": print
  17.  
  18. reg %AX, &h3567
  19. call interrupt &h21        'check for EMS presence
  20. def seg = reg(%ES)
  21. if peek$(10,8)<>"EMMXXXX0" then goto NoEMS
  22.  
  23. reg %AX, &h4100
  24. call interrupt &h67        'get EMS page frame in BX, status in AH
  25. if (reg(%AX) AND &h0FF00) <> 0 then goto NoEMS
  26.  
  27. print "Your system contains EMS memory.  The page frame is located at"
  28. print "segment ";fndigs$(reg(%BX));" (hex).  PowerBASIC will use this 64K ";
  29. print "frame to store"
  30. print "the source file that is being compiled.": print
  31.  
  32.                 'here if we have EMS -- now check page frame
  33. pframe& = cvl(mki$(reg(%BX))+chr$(0,0))
  34. if pframe& < memlimit& then    'page frame in low memory -- useless
  35.   print "Since the page frame is located in the main 640K of memory (below"
  36.   print "segment A000 hex), using the EMS driver that is currently present in"
  37.   print "your system will actually reduce the memory available to PowerBASIC"
  38.   print "during compilation, due to memory fragmentation.  In order to make"
  39.   print "better use of your resources, you should install an EMS driver which"
  40.   print "places its page frame at or above segment A000."
  41. else                'page frame in high memory -- okay
  42.   print "You may wish to run DOS' CHKDSK program before and after loading"
  43.   print "your EMS driver, in order to determine how much of your main 640K"
  44.   print "memory the driver uses.  If your driver requires a large portion"
  45.   print "of memory (48-64K for example), you may not gain much additional"
  46.   print "compilation space by using your EMS with PowerBASIC."
  47. end if
  48.  
  49. end
  50.  
  51. NoEMS:
  52.  
  53. print "Your system does not appear to contain any EMS memory."
  54. end
  55.