-
Notifications
You must be signed in to change notification settings - Fork 0
/
macro.inc
311 lines (283 loc) · 3.74 KB
/
macro.inc
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
; == DEFINES ==
SYS_STUB_ORG EQU $FF00
SYS_VECTOR_ORG EQU $FFFA
SAFE_STUB_ORG EQU SYS_STUB_ORG & $BFFF
SAFE_VECTOR_ORG EQU SYS_VECTOR_ORG & $BFFF
; == DAMAGE TWEAKS ==
MIN_PERCENT_VALUE EQU $19
DEF_PERCENT_VALUE EQU $32
MAX_PERCENT_VALUE EQU $64
UPPER_DAMAGE_ALERT EQU $14
LOWER_DAMAGE_ALERT EQU $E
FAILURE_TRESHOLD EQU $18
DEF_PERCENT_POWERUP EQU 6
DEF_PERCENT_REPAIR EQU $A
ACID_DAMAGE_VALUE EQU 4
BACK_DAMAGE_VALUE EQU 2 ; additional damage from regular gunmans if close up from back (no shoot)
NINJA_DAMAGE_VALUE EQU $E
PROJ0_FAMAGE_VALUE EQU 2
PROJ1_FAMAGE_VALUE EQU 4
PROJ2_FAMAGE_VALUE EQU 6
PROJ3_FAMAGE_VALUE EQU $14
; == ENUMS ==
APU_MUS_ENABLE EQU 1
APU_SND_ENABLE EQU 2
; == BIOS FONT ==
_ EQU $00
_A EQU $01
_B EQU $02
_C EQU $03
_D EQU $04
_E EQU $05
_F EQU $06
_G EQU $07
_H EQU $08
_I EQU $09
_J EQU $0A
_K EQU $0B
_L EQU $0C
_M EQU $0D
_N EQU $0E
_O EQU $0F
_P EQU $10
_Q EQU $11
_R EQU $12
_S EQU $13
_T EQU $14
_U EQU $15
_V EQU $16
_W EQU $17
_X EQU $18
_Y EQU $19
_Z EQU $1A
_1 EQU $1B
_2 EQU $1C
_3 EQU $1D
_4 EQU $1E
_5 EQU $1F
_6 EQU $20
_7 EQU $21
_8 EQU $22
_9 EQU $23
_DT EQU $24
_DD EQU $25
_TM EQU $25
_CO EQU $26
_ASK EQU $F9
_END EQU $FA
_CLR EQU $FB
_DLY EQU $FC
_MUT EQU $FD
_SCL EQU $FE
_NXT EQU $FF
; == HUD FONTS ==
__ EQU $0B
_a EQU $0C
_b EQU $0D
_c EQU $0E
_d EQU $0F
_e EQU $10
_f EQU $11
_g EQU $12
_h EQU $13
_i EQU $14
_j EQU $15
_k EQU $16
_l EQU $17
_m EQU $18
_n EQU $19
_o EQU $1A
_p EQU $1B
_q EQU $1C
_r EQU $1D
_s EQU $1E
_t EQU $1F
_u EQU $20
_v EQU $21
_w EQU $22
_x EQU $23
_y EQU $24
_z EQU $25
_excl EQU $26
_lq EQU $27
_rq EQU $28
_gt EQU $29
_dot EQU $2A
_cur EQU $2B
; == STRUCT ==
MAC TOBJ
{1} EQU .
{1}._player EQU .
.BYTE 0
{1}._enemy EQU .
.BYTE 0,0,0
{1}._pbullet EQU .
.BYTE 0,0,0
{1}._ebullet EQU .
.BYTE 0,0,0
{1}._misc EQU .
.BYTE 0
{1}._bonus EQU .
.BYTE 0
{1}._spr0hit EQU .
.BYTE 0
ENDM
MAC TPOW
{1} EQU .
{1}.head EQU .
.BYTE 0
{1}.body EQU .
.BYTE 0
{1}.arms EQU .
.BYTE 0
{1}.legs EQU .
.BYTE 0
ENDM
; == OPCODE ==
MAC INCY
INY
BNE .1
INC {1}+1
.1:
ENDM
MAC ADD16
LDA {1}
CLC
ADC #[{2}]
STA {1}
BCC .1
INC {1}+1
.1:
ENDM
MAC PRINTF
LDA #<{1}
LDY #>{1}
JSR _printf
ENDM
MAC U8TOS
STA _str_ptr
LDA #0
STA _str_ptr+1
LDX #<[{1}]
LDY #>[{1}]
JSR _hex2str
ENDM
MAC U16TOS
LDA [{1}]
STA _str_ptr
LDA [{1}+1]
STA _str_ptr+1
LDX #<[{2}]
LDY #>[{2}]
JSR _hex2str
ENDM
; == DATA ==
MAC STRING
.BYTE [.1-.-1]
.BYTE {#}
.1 EQU .
ENDM
MAC SOUND
SND_{1} EQU [[.-_sound_lib]>>3]
.BYTE {2},{3},{4},{5},{6},{7},{8},{9}
ENDM
; == STUB ==
MAC SAFE_STUB0
SEI
CLD
LDA #$EF
STA $8000
INC $8000
LDX #0
STX _PPU_CTRL
STX _PPU_MASK
STX _PPU_STATUS
STX _PPU_OAM_ADDR
STX _PPU_OAM_DATA
STX _PPU_OAM_DMA
DEX
TXS
.1:
BIT _PPU_STATUS
BPL .1
.2:
BIT _PPU_STATUS
BMI .2
.3:
BIT _PPU_STATUS
BPL .3
.4:
BIT _PPU_STATUS
BMI .4
LDA #$80
STA $A000
STA $C000
STA $E000
LDA #$80
STA $8000
LDA #$1E
STA $8000
LSR
STA $8000
LSR
STA $8000
LSR
STA $8000
LSR
STA $8000
LDA #$80
STA $E000
LDA #7
STA $E000
LSR
STA $E000
LSR
STA $E000
LSR
STA $E000
LSR
STA $E000
LDA #$80
STA $8000
LDA #$1A
STA $8000
LSR
STA $8000
LSR
STA $8000
LSR
STA $8000
LSR
STA $8000
LDA #$80
STA $E000
LDA #2
STA $E000
LSR
STA $E000
LSR
STA $E000
LSR
STA $E000
LSR
STA $E000
JMP _RESET
ENDM
MAC SAFE_STUB1
PHA
LDA _PPU_STATUS
PLA
ENDM
MAC SAFE_STUB2
RTI
ENDM
MAC SAFE_STUB
ORG SAFE_STUB_ORG, $00
.1: SAFE_STUB0
.2: SAFE_STUB1
.3: SAFE_STUB2
ORG SAFE_VECTOR_ORG, $00
.WORD .2
.WORD RESET
.WORD .3
ENDM