-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterrupts_includes.asm
162 lines (115 loc) · 2.85 KB
/
interrupts_includes.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
DEFSECT "VectorTable", CODE AT 2100h
SECT "VectorTable"
ascii "MN" ; weird marker 1
GLOBAL __START
ld nb, #@DPAG(__START)
jrl __START
ld nb, #@DPAG(_IRQ_VideoCopy)
jrl _IRQ_VideoCopy
ld nb, #@DPAG(_IRQ_VideoRender)
jrl _IRQ_VideoRender
ld nb, #@DPAG(_IRQ_Tim2Low)
jrl _IRQ_Tim2Low
ld nb, #@DPAG(_IRQ_Tim2High)
jrl _IRQ_Tim2High
ld nb, #@DPAG(_IRQ_Tim1Low)
jrl _IRQ_Tim1Low
ld nb, #@DPAG(_IRQ_Tim1High)
jrl _IRQ_Tim1High
ld nb, #@DPAG(_IRQ_SoundTimReload)
jrl _IRQ_SoundTimReload
ld nb, #@DPAG(_IRQ_SoundTimComMatch)
jrl _IRQ_SoundTimComMatch
ld nb, #@DPAG(_IRQ_RTCTim32Hz)
jrl _IRQ_RTCTim32Hz
ld nb, #@DPAG(_IRQ_RTCTim8Hz)
jrl _IRQ_RTCTim8Hz
ld nb, #@DPAG(_IRQ_RTCTim2Hz)
jrl _IRQ_RTCTim2Hz
ld nb, #@DPAG(_IRQ_RTCTim1Hz)
jrl _IRQ_RTCTim1Hz
ld nb, #@DPAG(_IRQ_InfraredRX)
jrl _IRQ_InfraredRX
ld nb, #@DPAG(_IRQ_ShakeDetect)
jrl _IRQ_ShakeDetect
ld nb, #@DPAG(_IRQ_ButtonPower)
jrl _IRQ_ButtonPower
ld nb, #@DPAG(_IRQ_DpadRight)
jrl _IRQ_DpadRight
ld nb, #@DPAG(_IRQ_DpadLeft)
jrl _IRQ_DpadLeft
ld nb, #@DPAG(_IRQ_DpadDown)
jrl _IRQ_DpadDown
ld nb, #@DPAG(_IRQ_DpadUp)
jrl _IRQ_DpadUp
ld nb, #@DPAG(_IRQ_ButtonC)
jrl _IRQ_ButtonC
ld nb, #@DPAG(_IRQ_ButtonB)
jrl _IRQ_ButtonB
ld nb, #@DPAG(_IRQ_ButtonA)
jrl _IRQ_ButtonA
ld nb, #@DPAG(_IRQ_Unknown1)
jrl _IRQ_Unknown1
ld nb, #@DPAG(_IRQ_Unknown2)
jrl _IRQ_Unknown2
ld nb, #@DPAG(_IRQ_Unknown3)
jrl _IRQ_Unknown3
ld nb, #@DPAG(_IRQ_External)
jrl _IRQ_External
; magic marker to validate cartridge
ascii "NINTENDO"
; game code, must be 4 bytes, i have no clue what the codes are but this is 4 bytes long
ascii "DAWN"
; 1234
; game title, must be exactly 12 chars
ascii "MAINFRAME "
; 123456789111
; 012
ascii "2P" ; weird marker 2
; reserved 18 zero bytes (huh?)
db 00, 00, 00, 00
db 00, 00, 00, 00
db 00, 00, 00, 00
db 00, 00, 00, 00
db 00, 00
DEFSECT "InterruptDestinations", CODE
SECT "InterruptDestinations"
_IRQ_VideoCopy:
ld [br:27h], #11111111b
ld [br:20h], #11000000b
rete
_IRQ_VideoRender:
_IRQ_Tim2Low:
_IRQ_Tim2High:
rete
_IRQ_Tim1High:
_IRQ_Tim1Low:
ld [br:27h], #11111111b ; clear interrupt flag
ld [br:20h], #11111111b ; reset interrupt priority
; ld a, [GameFlags]
jrl _MainLoopRender
; rete
_IRQ_SoundTimReload:
_IRQ_SoundTimComMatch:
_IRQ_RTCTim32Hz:
_IRQ_RTCTim8Hz:
_IRQ_RTCTim2Hz:
_IRQ_RTCTim1Hz:
_IRQ_InfraredRX:
_IRQ_ShakeDetect:
_IRQ_ButtonPower:
_IRQ_DpadRight:
_IRQ_DpadLeft:
_IRQ_DpadDown:
_IRQ_DpadUp:
_IRQ_ButtonC:
_IRQ_ButtonB:
_IRQ_ButtonA:
_IRQ_Unknown1:
_IRQ_Unknown2:
_IRQ_Unknown3:
_IRQ_External:
rete
EXTERN GameFlags
EXTERN _MainLoopRender
EXTERN EndingRender