home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / qb_pds / qb_sub / halt.sub < prev    next >
Encoding:
Text File  |  1987-07-14  |  2.4 KB  |  59 lines

  1. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. '%  (C) 1987 HUMBLEWARE Custom Programming    Author: Lawrence A. Westhaver  %
  3. '%        247 Paul Martin Drive,  Baltimore MD  21227  (301) 799-1975        %
  4. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  5. '%                                                                           %
  6. '%     FILENAME: HALT.SUB                        LAST UPDATE: 06/12/1987     %
  7. '%                                                                           %
  8. '%  DESCRIPTION: Terminates a QuickBASIC program and returns an error code   %
  9. '%               that can be tested by the DOS ERRORLEVEL batch statement.   %
  10. '%                                                                           %
  11. '%         CALL: CALL HALT(ERRORLEVEL%)                                      %
  12. '%                                                                           %
  13. '%       INPUTS: ERRORLEVEL% = A DOS errorlevel value between 0 and 255.     %
  14. '%                                                                           %
  15. '%      OUTPUTS: None.                                                       %
  16. '%                                                                           %
  17. '%         NOTE: The Microsoft QuickBASIC INT86 assembly routine must be     %
  18. '%               linked into your program at compile time or it must be      %
  19. '%               present in the QuickBASIC USERLIB.EXE file before this      %
  20. '%               routine can be used.                                        %
  21. '%                                                                           %
  22. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  23.  
  24.  
  25. SUB HALT(ERRORLEVEL%) Static
  26.  
  27.  
  28. 'dim parameter storage for INT86 call
  29.  
  30.     DIM PARMIN%(7),PARMOUT%(7)
  31.  
  32.  
  33. 'declare indexes for INT86 calls
  34.  
  35.     AXREG%=0    'AX register
  36.     BXREG%=1    'BX register
  37.     CXREG%=2    'CX register
  38.     DXREG%=3    'DX register
  39.     BPREG%=4    'BP register
  40.     SIREG%=5    'SI register
  41.     DIREG%=6    'DI register
  42.     FLAGS%=7    'Flags
  43.  
  44.  
  45. 'restore video before exiting to DOS
  46.  
  47.     COLOR 7,0,0
  48.     LOCATE ,,1,6,7
  49.  
  50.  
  51. 'return error level to DOS
  52.  
  53.     POKE VARPTR(PARMIN%(0))+0,ERRORLEVEL% 'set error level
  54.     POKE VARPTR(PARMIN%(0))+1,&H4C        'set DOS function
  55.     CALL INT86(&H21,VARPTR(PARMIN%(0)),VARPTR(PARMOUT%(0)))
  56.  
  57.  
  58. END SUB 'halt
  59.