home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / tasm / oerrexit.asm < prev    next >
Assembly Source File  |  1988-08-28  |  2KB  |  65 lines

  1.  
  2. ;    FILENAME: OERREXIT.ASM
  3. ;    Copyright (c) 1988 by Borland International, Inc.
  4. ;
  5. ;    Description: This module implements the routine ErrorExit. ErrorExit 
  6. ;    handles the printing of error messages.
  7. ;    ASSEMBLY INSTRUCTIONS:  To assemble this module use the following  
  8. ;    TASM command line.     
  9. ;  
  10. ;        TASM oerrexit
  11.  
  12. include globals.inc
  13.  
  14. _TEXT   segment
  15.  
  16.     ErrorExit proc
  17.  
  18.     ;    Input 
  19.     ;        al - error number
  20.     ;        ErrTbl - starting location of the error table
  21.     ;        si - address of start of command line
  22.     ;        OptTab - Option Table
  23.     ;        Options - designates user set options
  24.     ;    Output
  25.     ;        command line processed
  26.     ;    Registers modified
  27.     ;        none
  28.  
  29.  
  30.  
  31.     ;    get error table entry
  32.  
  33.     sub     ah, ah
  34.     mov     bx, ax
  35.     shl     ax, 1
  36.     add     bx, ax                  ;error number times three
  37.     lea     si, [ErrTbl + bx]       ;get location of error data
  38.  
  39.     lodsb                           ;load return code
  40.     push    ax
  41.  
  42.     ;    write message
  43.  
  44.     lodsw                           ;load offset of message
  45.     mov     si, ax
  46.     lodsb                           ;load length of message
  47.     sub     ah, ah
  48.     mov     cx, ax                  ;length in CX
  49.     mov     bx, 2                   ;error device
  50.     mov     dx, si                  ;offset in DX
  51.     mov     ah, 40h                 ;function
  52.     int     21h                     ;execute
  53.  
  54.     ;    exit
  55.  
  56.     pop     ax                      ;restore error code
  57.     mov     ah, 4ch                 ;exit function
  58.     int     21h                     ;execute
  59.  
  60.     ErrorExit endp
  61. _TEXT    ends
  62.  
  63. end
  64.