-
Notifications
You must be signed in to change notification settings - Fork 0
/
ErrorHandler.asm
112 lines (80 loc) · 3.49 KB
/
ErrorHandler.asm
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
; ===============================================================
; ---------------------------------------------------------------
; Error handling and debugging modules
; 2016-2017, Vladikcomper
; ---------------------------------------------------------------
; Error handler functions and calls
; ---------------------------------------------------------------
; ---------------------------------------------------------------
; Error handler control flags
; ---------------------------------------------------------------
; Screen appearence flags
_eh_address_error equ $01 ; use for address and bus errors only (tells error handler to display additional "Address" field)
_eh_show_sr_usp equ $02 ; displays SR and USP registers content on error screen
; Advanced execution flags
; WARNING! For experts only, DO NOT USES them unless you know what you're doing
_eh_return equ $20
_eh_enter_console equ $40
_eh_align_offset equ $80
; ---------------------------------------------------------------
; Errors vector table
; ---------------------------------------------------------------
; Default screen configuration
_eh_default equ 0 ;_eh_show_sr_usp
; ---------------------------------------------------------------
BusError:
__ErrorMessage "BUS ERROR", _eh_default|_eh_address_error
AddressError:
__ErrorMessage "ADDRESS ERROR", _eh_default|_eh_address_error
IllegalInstr:
__ErrorMessage "ILLEGAL INSTRUCTION", _eh_default
ZeroDivide:
__ErrorMessage "ZERO DIVIDE", _eh_default
ChkInstr:
__ErrorMessage "CHK INSTRUCTION", _eh_default
TrapvInstr:
__ErrorMessage "TRAPV INSTRUCTION", _eh_default
PrivilegeViol:
__ErrorMessage "PRIVILEGE VIOLATION", _eh_default
Trace:
__ErrorMessage "TRACE", _eh_default
Line1010Emu:
__ErrorMessage "LINE 1010 EMULATOR", _eh_default
Line1111Emu:
__ErrorMessage "LINE 1111 EMULATOR", _eh_default
ErrorExcept:
__ErrorMessage "ERROR EXCEPTION", _eh_default
; ---------------------------------------------------------------
; Error handler external functions (compiled only when used)
; ---------------------------------------------------------------
; WARNING! This blocks are intended to compile if referenced anywhere in the code.
; However, as of AS version 1.42 [Bld 55], "IFUSED" directive doesn't work properly.
; --------------------------------------------------------------
; ifused ErrorHandler___extern_scrollconsole
ErrorHandler___extern__scrollconsole:
; endif
; --------------------------------------------------------------
; ifused ErrorHandler___extern__console_only
ErrorHandler___extern__console_only:
dc.l $46FC2700, $4FEFFFF2, $48E7FFFE, $47EF003C
jsr ErrorHandler___global__errorhandler_setupvdp(pc)
jsr ErrorHandler___global__error_initconsole(pc)
dc.l $4CDF7FFF, $487A0008, $2F2F0012, $4E7560FE
; endif
; --------------------------------------------------------------
; ifused ErrorHandler___extern__vsync
ErrorHandler___extern__vsync:
dc.l $41F900C0, $000444D0, $6BFC44D0, $6AFC4E75
; endif
; ---------------------------------------------------------------
; Include error handler binary module
; ---------------------------------------------------------------
ErrorHandler:
binclude "ErrorHandler.bin"
; ---------------------------------------------------------------
; WARNING!
; DO NOT put any data from now on! DO NOT use ROM padding!
; Symbol data should be appended here after ROM is compiled
; by ConvSym utility, otherwise debugger modules won't be able
; to resolve symbol names.
; ---------------------------------------------------------------