home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l430 / 1.ddi / CHAP10.ZIP / TH_ASM.ASM < prev    next >
Encoding:
Assembly Source File  |  1992-01-05  |  1.1 KB  |  53 lines

  1. ;=================================
  2. ; Coroner, by Matt Pietrek, 1992
  3. ; File: TH_ASM.ASM
  4. ;=================================
  5.  
  6. .model small
  7. .286
  8.  
  9. PUBLIC EXCEPTIONHANDLER    ; Make EXCEPTIONHANDLER public
  10.  
  11. extrn _C_ExceptionHandler: NEAR
  12.  
  13. .code
  14.  
  15. ; The EXCEPTIONHANDLER proc is called directly from TOOLHELP.  It sets up a
  16. ; stackframe, and calls the 'C' function C_ExceptionHandler.
  17. ; On entry, the stack looks like this:
  18.  
  19. ;        ------------
  20. ;BP---->|  Old BP  |  [BP + 00h]
  21. ;        |  Ret IP  |  [BP + 02h]
  22. ;        |  Ret CS  |  [BP + 04h]
  23. ;        |    AX    |  [BP + 06h]
  24. ;        |Exception#|  [BP + 08h]
  25. ;        |  Handle  |  [BP + 0Ah]
  26. ;        |    IP    |  [BP + 0Ch]
  27. ;        |    CS    |  [BP + 0Eh]
  28. ;        |   Flags  |  [BP + 10h]
  29. ;        ------------
  30.  
  31. EXCEPTIONHANDLER proc far
  32.  
  33.     push    bp            ;Make a stack frame
  34.     mov        bp,sp
  35.     pusha                ;Save all registers
  36.     push    ds
  37.     push    es
  38.  
  39.     mov        ax, @data    ; There's only one instance of the CORONER running, so
  40.     mov        ds, ax        ; we save work by loading DS directly, like a DLL does.
  41.  
  42.     call    _C_ExceptionHandler
  43.  
  44.     pop        es            ;Chain on to next fault handler
  45.     pop        ds
  46.     popa
  47.     pop        bp
  48.     retf
  49.  
  50. EXCEPTIONHANDLER endp
  51.  
  52. END
  53.