home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / int3hand.asm < prev    next >
Assembly Source File  |  1998-06-08  |  2KB  |  120 lines

  1. ;THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  2. ;SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  3. ;END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  4. ;ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  5. ;IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  6. ;SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  7. ;FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  8. ;CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  9. ;AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  10. ;COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  11. ;
  12. ; $Source: f:/miner/source/main/rcs/int3hand.asm $
  13. ; $Revision: 2.0 $
  14. ; $Author: john $
  15. ; $Date: 1995/02/27 11:26:43 $
  16. ; Rountine to handle int3's when debugger not present
  17. ; $Log: int3hand.asm $
  18. ; Revision 2.0  1995/02/27  11:26:43  john
  19. ; New version 2.0, which has no anonymous unions, builds with
  20. ; Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  21. ; Revision 1.2  1993/10/15  11:29:45  matt
  22. ; Made stack bigger
  23. ; Revision 1.1  1993/10/15  11:27:45  matt
  24. ; Initial revision
  25.  
  26.  
  27. INT3_STACK_SIZE = 2048    ;big enough for mprintf() 1000-byte buffer
  28.  
  29. .386
  30.     option    oldstructs
  31.  
  32.     .nolist
  33.     include    types.inc
  34.     include    psmacros.inc
  35.     .list
  36.  
  37.     assume    cs:_TEXT, ds:_DATA
  38.  
  39. _DATA    segment    dword public USE32 'DATA'
  40.  
  41. rcsid    db    "$Id: int3hand.asm 2.0 1995/02/27 11:26:43 john Exp $"
  42.  
  43. int3_message    db    "int3 handler called",0ah,0
  44.  
  45. int3_stack    db    INT3_STACK_SIZE dup (?)
  46. end_int3_stack    label    byte
  47.  
  48. save_ss    dw    ?
  49. save_esp    dd    ?
  50.  
  51.     extd    __stacklow
  52.  
  53. _DATA    ends
  54.  
  55.  
  56.  
  57. _TEXT    segment    dword public USE32 'CODE'
  58.  
  59.     extn    mprintf_
  60.  
  61.     public    install_int3_handler_,int3_handler
  62.  
  63. install_int3_handler_:
  64.     pusha
  65.     mov    ax,0203h
  66.     mov    bl,3
  67.     mov    cx,cs
  68.     mov    edx,offset int3_handler
  69.     int    31h
  70.  
  71.     popa
  72.     ret
  73.  
  74. int3_handler:    pusha
  75.     pushm    ds,es
  76.  
  77.     mov    ax,_DATA
  78.     mov    ds,ax
  79.     mov    es,ax
  80.  
  81.     push    __stacklow
  82.  
  83.     mov    save_ss,ss
  84.     mov    save_esp,esp
  85.  
  86.     sti
  87.     mov    ss,ax
  88.     mov    esp,offset end_int3_stack
  89.     mov    __stacklow,offset int3_stack
  90.     cli
  91.  
  92.  
  93.     push    offset int3_message    ;push string
  94.     push    0    ;window zero
  95.     call    mprintf_
  96.     add    esp,8    ;kill stuff on stack
  97.  
  98.     sti
  99.     mov    ss,save_ss
  100.     mov    esp,save_esp
  101.     cli
  102.  
  103.     pop    __stacklow
  104.  
  105.     popm    ds,es
  106.     popa
  107.     retf
  108.  
  109.  
  110. _TEXT    ends
  111.  
  112.     end
  113.  
  114.