home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / PGMUTL / SWITCH22.ZIP / SWDEMO.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-01-22  |  4.7 KB  |  109 lines

  1.  
  2. {****************************************************** Switch! Demo
  3. ******************************************************* Version 2.0
  4. ******************************************************* Tab Size:  8
  5. ******************************************************* December 19, 1988
  6. ******************************************************* Curtis Little
  7. ******************************************************* 1087 Murrietta Blvd
  8. *******************************************************                #244
  9. ******************************************************* Livermore, CA 94550
  10. *
  11. * NOTES:  This demo was designed for Turbo Pascal.
  12. *
  13. * WARNING:  For this demo the input length is not restricted, and can
  14. * therefore be exceeded, but since you have to compile this and will be
  15. * running it yourself this shouldn't pose a big problem - just don't type
  16. * more characters than allowed in the input fields!
  17. *
  18. }
  19.  
  20.  
  21. program Swdemo;
  22.  
  23. uses CRT;
  24.  
  25. type cline = string[84];
  26.  
  27.  
  28. var
  29.     mmem : integer;
  30.         mprog  : string[84];
  31.         ch     : char;
  32.  
  33. {$F+}
  34. function Switch(drive : integer; mem : integer; command : cline) : integer;
  35. external;
  36. {$L switchtp}
  37. {$F-}
  38. begin
  39.  
  40.  
  41.     writeln( #13#10#10'     This demo demonstrates the usefullness of Switch!.  Switch! is an' );
  42.     writeln( '     assembly function that frees up as much memory as needed to run' );
  43.     writeln( '     another program.  Switch! saves the memory used by your Pascal' );
  44.     writeln( '     application to a temporary disk file (registered versions' );
  45.     writeln( '     of Switch! use EMS if present) then frees it up for use by DOS. It' );
  46.     writeln( '     can free up all but about 11K of available memory!!  To see how' );
  47.     writeln( '     helpful Switch! is this program allows you to specify a program' );
  48.     writeln( '     to run and the amount of memory required by the program.  Use a' );
  49.     writeln( '     map program or CHKDSK to see how much memory you have free before' );
  50.     writeln( '     running this demo.  Then specify CHKDSK as the program to run from' );
  51.     writeln( '     within this demo and specify 0 for the amount of memory required' );
  52.     writeln( '     (a value of 0 causes Switch! to free all memory possible).  You''ll' );
  53.     writeln( '     be amazed how much memory becomes available!' );
  54.  
  55.     writeln( #10'     Switch! was designed to work with QuickBASIC, MS BASIC, IBM BASIC,' );
  56.     writeln( '     Turbo C, Turbo Pascal 4.0 and above, and Summer ''87 Clipper.' );
  57.     writeln( '     It doesn''t matter how big the program is!  You can free most of' );
  58.     writeln( '     the used memory to run another program!  Using Switch! you can' );
  59.     writeln( '     run a 630K program from within a 640K program by using a simple' );
  60.     writeln( '     function call.  With Switch! there''s no worries about memory!' );
  61.     writeln( #10'     The calling syntax for the Turbo Pascal version of Switch! is:' );
  62.     writeln( #10'     SWITCH(Drive to use, K mem needed, Program to run and parameters)' );
  63.  
  64.     ch := readkey;
  65.  
  66.     mmem := 0;
  67.  
  68.     while mmem >= 0 do begin
  69.         (* get the program name and the amount of memory required *)
  70.         writeln( #13#10'Enter the program to run (leave blank for DOS shell):' );
  71.         write( '>' );
  72.         readln( mprog );
  73.         writeln( #13#10'Enter amount of K RAM required by program (0 for all)' );
  74.         write( '                            (Negative number to quit): ' );
  75.         readln( mmem );
  76.  
  77.         (* exit the loop if the user wants to quit *)
  78.         if (mmem >= 0) then
  79.             mmem := Switch(0, mmem, mprog);
  80.  
  81.         (* check for error *)
  82.         if (mmem > 0) then begin
  83.                        writeln( #13#10'Switch!  Error# ', mmem, '  SWDEMO aborted.' );
  84.             halt;
  85.         end;
  86.  
  87.                 if (mmem >= 0) then begin
  88.                    write( #13#10#10'>> Press Any Key to Continue <<' );
  89.            ch := readkey;
  90.                 end;
  91.     end;
  92.  
  93.  
  94.     writeln(#13#10#10#10#10'     Switch! only frees up the memory it needs to.  For instance, if you' );
  95.     writeln('     specify the program to run needs 64K Switch! will only save memory' );
  96.     writeln('     if there isn''t already 64K free memory.  Setting the value to the' );
  97.     writeln('     minimum required by the application reduces the time it takes to' );
  98.     writeln('     Switch! applications.  To really get a feel for what Switch! can do' );
  99.     writeln('     for you use the SWITCH.OBJ file to link Switch! into your own' );
  100.     writeln('     applications and use it to call other programs.' );
  101.     writeln(#10'     To register Switch! (and get the source!) please send $20.00 check' );
  102.     writeln('     or money order to:' );
  103.     writeln(#10'                      Curtis Little' );
  104.     writeln('                      1087 Murrietta Blvd #244' );
  105.     writeln('                      Livermore, CA  94550'#13#10#10#10#10#10#10 );
  106.  
  107. end.
  108.  
  109.