home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / util / crashsav.sit / CrashSaver.Asm < prev    next >
Assembly Source File  |  1985-10-12  |  2KB  |  58 lines

  1. ; Crash Saver
  2. ; ⌐1985 by DailSoft
  3. ; You may distribute CrashSaver to others as long as orginal credit is
  4. ; givin to Macazine.  Also, you must include the entire contents the
  5. ; folders labeled ╥Crash Saver╙ and ╥Ordering╙ from this issue.
  6. ; Macazine can be ordered from:
  7. ;    DailSoft
  8. ;    P.O. Box 2861
  9. ;    Newport News, VA  23602
  10. ; The cost of Macazine is $15.95/issue or $60.00/year (6 issues).
  11. ; This program is designed to allow for a return to the Finder when a
  12. ; system error occurs.  By pressing the Interrupt button (not the Reset
  13. ; button) on the programmers switch during a system error, an
  14. ; ExitToShell trap will be executed.  This will return you to the
  15. ; Finder  (or to the Switcher).  One reason for doing this is to preserve
  16. ; your RamDisk.
  17. ; Warning, this method will usually work, but in some cases, ExitToShell
  18. ; will produced a repeated System Error.
  19. ; This  application should be made your startup application. 
  20. ; Note: By modifying the interrupt vectors, MacsBug will not work when this
  21. ; utility has  been installed.
  22.  
  23. Include     MacTraps.D    ; Use System and ToolBox traps
  24. autoInt4    EQU    $70
  25. autoInt5    EQU    $74
  26. autoInt6    EQU    $78
  27. autoInt7    EQU    $7C
  28.  
  29. Install
  30.     ; Allocate space on the system heap for the crash saver.
  31.     MOVE.L    #(Exit-CrashSaver),D0    ; Length of block.
  32.     _NewPtr    ,SYS            ; Allocate in system heap.
  33.     
  34.     ; Make interrupt vectors point to crash saver.
  35.     MOVE.L    A0,autoInt4
  36.     MOVE.L    A0,autoInt5
  37.     MOVE.L    A0,autoInt6
  38.     MOVE.L    A0,autoInt7
  39.     
  40.     ; Copy local copy of crash saver to the system heap.
  41.     MOVE.L    A0,A1            ; A1 points to destination.
  42.     LEA        CrashSaver,A0    ; A0 points to source.
  43.     MOVE.L    #(Exit-CrashSaver),D0    ; D0 is length of copy.
  44.     _BlockMove            ; Execute move.
  45.     RTS                ; Return to the Finder.
  46.  
  47. CrashSaver
  48.     AND    #$F8FF,(SP)    ; Force all interupts to be enabled.
  49.     ; set return to ExitToShell call.
  50.     LEA    ETS,A0
  51.     MOVE.L    A0,2(SP)
  52.     RTE
  53.     
  54. ETS
  55.     NOP            ; Make sure interrupt button is released before exit
  56.     _ExitToShell
  57. Exit
  58.     END