4 ; Sapphire exception handling
6 ; © 1994-1998 Straylight
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's Sapphire library.
13 ; Sapphire is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
18 ; Sapphire is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ; GNU General Public License for more details.
23 ; You should have received a copy of the GNU General Public License
24 ; along with Sapphire. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ;----- Overview -------------------------------------------------------------
36 [ :LNOT::DEF:except__dfn
45 ; Use: Initialises the exception handler.
49 ; --- except_fatal ---
51 ; On entry: R0 == pointer to an error block
55 ; Use: Reports an error to our /caller's/ error handler. We quit
56 ; and die at this point. Don't use unless you have absolutely
57 ; no choice in the matter.
61 ; --- except_atExit ---
63 ; On entry: R0 == pointer to routine to call on exit
64 ; R1 == R12 value to call with
68 ; Use: Registers a routine to get called when the application quits.
69 ; Later-registered routines are called earlier than earlier-
70 ; registered routines, so everything closes down in a nice
75 ; --- except_returnPt ---
77 ; On entry: R0 == pointer to exception handler routine
78 ; R1 == R12 value to enter routine with
79 ; R2 == R13 value to enter routine with
83 ; Use: Sets up a routine to be called whenever there's an error.
84 ; The idea is that it should ask the user whether to quit,
85 ; and if not, resume to some known (safe?) state.
87 ; The routine is called with R0 == pointer to error block, and
88 ; R12 and R13 being the values set up here(*). It should
89 ; return with R0 == pointer to a routine to resume at, and R1
90 ; being the value to pass to the resume routine in R12. If
91 ; you decide to quit, just call OS_Exit -- this should tidy
94 ; Note that the error is held in the scratchpad buffer, so
95 ; you can't use the first 256 bytes of that until you've
96 ; finished with the error message.
98 ; (*) Actually, R13 is 4 bytes lower because it's assumed that
99 ; it points to a full descending stack that we can use. This
100 ; shouldn't make any difference as long as you're using R13
101 ; as a full descending stack pointer.
103 IMPORT except_returnPt
107 ;----- That's all, folks ----------------------------------------------------