home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a016 / 1.ddi / BAS / SWAPDEMO.BAS < prev    next >
Encoding:
BASIC Source File  |  1992-03-15  |  3.2 KB  |  104 lines

  1. ''****************************************************************************
  2. '
  3. ' Blinker 2.00 swap function demo
  4. '
  5. ' MS PDS 7.1 example
  6. '
  7. ' Compile: BC swapdemo /O;
  8. '
  9. '****************************************************************************
  10. '
  11. ' $INCLUDE: 'blinker.bi'
  12. '
  13. enable  = 1
  14. disable = 0
  15.  
  16.   print "Basic Swap example"
  17.   print "=================="
  18.   print
  19.   print "Swap defaults      "
  20.   print
  21.   print "Use EMS memory                  : ",SWPUSEEMS%(disable)
  22.   print "Use XMS memory                  : ",SWPUSEXMS%(disable)
  23.   print "Use UMBs                        : ",SWPUSEUMB%(disable)
  24.   print "Save/restore video mode         : ",SWPVIDMDE%(disable)
  25.   print "Save/restore directory          : ",SWPCURDIR%(disable)
  26.   print "Display message                 : ",SWPDISMSG%(disable)
  27.   print "Wait for keypress               : ",SWPGETKEY%(disable)
  28.   print "Suppress <Ctrl><Alt><Del>       : ",SWPNOBOOT%(disable)
  29.   print
  30.  
  31.   print "Program already running?        : ",SWPGETPIDBAS%("swapdemo.bas")
  32.   print "Set program ID to swapdemo.bas  : ",SWPSETPIDBAS%("swapdemo.bas")
  33.   print
  34.  
  35.   ' enable ems / xms / umbs
  36.  
  37.   i = SWPUSEEMS%(enable)
  38.   i = SWPUSEXMS%(enable)
  39.   i = SWPUSEUMB%(enable)
  40.  
  41.   ' save / restore current directory and video mode
  42.   ' video buffer contents are not saved
  43.  
  44.   i = SWPCURDIR%(enable)
  45.   i = SWPVIDMDE%(enable)
  46.  
  47.   if SWPGETPIDBAS%("swapdemo.bas") = 0 THEN
  48.      ' if we're not running already
  49.      print "Shelling to DOS..."
  50.      print "Run swapdemo again to see SWPGETPIDBAS()."
  51.      print "-------------------------------------------------------------------------"
  52.  
  53.      ' status = bliswprunbas(ChildProg, Memory, Shell Directory, Temporary directory)
  54.  
  55.      i = SWPRUNCMDBAS%( "", 0, "", "")
  56.  
  57.      print "-------------------------------------------------------------------------"
  58.      print "Back from shell, status is      : ",i
  59.  
  60.      i = SWPERRMAJ%
  61.  
  62.      ' get major error code
  63.  
  64.      print "Major error code                : ",i;" ";
  65.  
  66.      SELECT CASE i
  67.          CASE SWPNONERR
  68.               print "(no error)"
  69.          CASE SWPFULERR
  70.               print "(disk full error)"
  71.          CASE SWPDSKERR
  72.               print "(disk error)"
  73.          CASE SWPDIRERR
  74.               print "(change directory error)"
  75.          CASE SWPCREERR
  76.               print "(create file error)"
  77.          CASE SWPDRVERR
  78.               print "(change drive error)"
  79.          CASE SWPEMSERR
  80.               print "(EMS error)"
  81.          CASE SWPXMSERR
  82.               print "(XMS error)"
  83.          CASE SWPCMDERR
  84.               print "(SHELL error)"
  85.          CASE SWPHANERR
  86.               print "(handle table too large error)"
  87.          CASE SWPMEMERR
  88.               print "(top of memory address changed)"
  89.          CASE SWPMCBERR
  90.               print "(corrupt memory chain error)"
  91.          CASE ELSE
  92.               print "(unknown error)"
  93.     END SELECT
  94.  
  95.     print "Minor error code                : ",SWPERRMIN%
  96.     print "Child process return code was   : ",BLISWPRET%
  97.  
  98.   else
  99.      ' we're already running, terminate the program
  100.      print "Terminating (swapdemo.bas already executing)"
  101.      print "Type EXIT to return to previous swapdemo.bas"
  102.   endif
  103.  
  104.