-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHandler.mar
51 lines (48 loc) · 1.98 KB
/
Handler.mar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
; Copyright (C) 2024 Jeffrey Getzin.
; Licensed under the GNU General Public License v3.0 with additional terms.
; See the LICENSE file in the repository root for details.
;
; This error handler is a modified form of the error handler used in the
; public domain software, Moria. It is more
; advanced than what I have, so I'm using this. Those guys from Moria
; must be VERY smart!
;
;
.TITLE HANDLER - Condition handler for STONEQUEST
.PSECT HANDLER$DATA RD, WRT, PIC, NOSHR, NOEXE, LONG
FAC: .ASCID /STONEQUEST/
STRING: .ASCII /**Warning: Error Encounter **/<13><10>
.ASCII /--Attempting to continue game--/<13><10>
.ASCII /--Suggest you SAVE and restore your characters/<13><10>
STRING_LEN = .-STRING
PROMPT: .LONG STRING_LEN
.ADDRESS STRING
NCSP: .LONG 10
.ADDRESS BUF
BUF: .BLKB 10
TWEN: .LONG 1
.PSECT MISC1$CODE RD, NOWRT, PIC, SHR, LONG, EXE
$SSDEF ; Define system service values
.ENTRY OH_NO,^M<R2,R3,R4>
;
; Arg list offsets
SIG_ARGS = 4 ; Signal array
MECH_ARGS = 8 ; Mechanism array
;-
MOVL SIG_ARGS(AP), R2 ; Get pointer to signals
MOVL 4(R2), R3 ; Get condition signalled
CMPL R3, #SS$_UNWIND ; Unwinding?
BEQL 10$ ; Yes, just do it
$PUTMSG_S MSGVEC=@SIG_ARGS(AP),-
FACNAM=FAC
PUSHAL PROMPT
PUSHAL BUF
CALLS #2, G^LIB$GET_COMMAND ;
BICL3 #^C<7>, R3, R4 ; Extract the severity
CMPL R4, #4 ; Is it fatal?
BLSS 10$ ; Nope, resignal
BICB #7, 4(R2) ; Modify the severity to warning
$UNWIND_S DEPADR=TWEN ; Unwind the caller
10$: MOVL #SS$_RESIGNAL, R0 ; So to resignal
RET
.END