-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.asm
270 lines (241 loc) · 3.53 KB
/
main.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
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
incsrc define.asm
lorom
org $FFD5
db $02
org $FFD8
db $08
org $8024
NOP #3
org $3D4AA
db "ROMHACK 1.1 ",$40,"FURIOUS"
; HIJACKS
;org $BE59
; JMP routine
org $8302
JSR nmi
org $AA90
JSR vblank
org $F380
incsrc include.asm
routine:
SEP #$20
PHP
REP #$30
LDA $4218
CMP !last_input
BNE +
PLP
JSR $BDFF
JMP return
+ PLP
LDA $4219
BIT #$10
BNE .start_axlr
JSR $BDFF
JMP return
; test 84218421
; axlr....
.start_axlr
STZ !p1_pad_frame
STZ !p2_pad_frame
LDA $4218
BIT #$10 ;R
BNE .fix_audio
BIT #$40 ;X
BNE .change_rng
BIT #$80 ;A
BNE .disable_darkroom
BRA .start_byetudlr
; ACTIONS AXLR
.fix_audio ; (superufo)
LDA $2142
STA $7FFF09
JMP return
.change_rng
JSL $808859
JSR $9553
;LDA !rng
;STA !last_rng
JMP return
.disable_darkroom
JSR $A87F
JMP return
; test 84218421
; byetudlr
.start_byetudlr
LDA $4219
BIT #$08 ;Up
BNE .next_room
BIT #$20 ; Select
BNE .reset_room
;BIT #$80 ;B
;BNE .change_item
BIT #$80 ;B
BNE .cicle_hearts
BIT #$40 ;Y
BNE .cicle_lives
JSR $BDFF
JMP return
; ACTIONS BYETUDLR
.next_room ; next room
LDA #$06
STA !load_status
JMP return
.reset_room ; reset room
PHP
REP #$30
LDA !last_rng
STA !rng
PLP
;LDA !last_room
;STA !level_id
;LDA #$06
;STA !load_status
;JSL $80E56A
;STZ $2100
STZ !load_status
JMP return
;JMP $AA90
.change_item ; change item
;LDA !p1_item
;CMP #$FF
;BEQ +
INC !p1_item
INC !p2_item
;BRA ++
;+ STZ $0142
;++
JSR status_update
JMP return
.cicle_lives ; change item
LDA !p1_lives
CMP #10
BEQ +
INC !p1_lives
INC !p2_lives
BRA ++
+ LDA #1
STA !p1_lives
STA !p2_lives
++ JSR status_update
JMP return
.cicle_hearts ; change hearts
LDA !p1_hp
CMP #$06
BEQ +
INC !p1_hp
INC !p2_hp
BRA ++
+ STZ !p1_hp
STZ !p2_hp
++ STZ !p1_update
STZ !p2_update
JMP return
return:
PHP
REP #$30
LDA $4218 ; last input
STA !last_input
LDA !load_status
CMP #$0008
BEQ .room_loaded
CMP #$0006
BEQ .room_loading
BRA +
.room_loaded
LDA !rng ; last rng
STA !last_rng
;.room_loading
LDA !level_id ; last room
STA !last_room
BRA +
.room_loading
LDA !igt_frm
STA !igt_last_frm
LDA !igt_sec
STA !igt_last_sec
LDA !igt_min
STA !igt_last_min
+
LDA !gamemode
CMP #$0206
BEQ .map_loaded
BRA +
.map_loaded
STZ !igt_frm
STZ !igt_sec
STZ !igt_min
+ PLP
RTS
; other hooks
vblank:
;JSR $BDFF ; hijacked routine
JSR routine
RTS
nmi:
JSR $838D ; hijacked routine
;RTS
;%save_registers()
REP #$20
LDA !gamemode
CMP #$0008
BEQ .playing
CMP #$0206
BEQ .map_loaded
JMP end
.map_loaded
SEP #$20
%status_color(!red)
%status_pos(3, 26)
%print_text(text_timereset)
JMP end
.playing
SEP #$20
;PRINT P1 INFO
;%status_color(!blue)
;%status_pos(1, 4)
;%print_text(text_xpos)
;%print_hex(!p1_Xpos, 1)
;%status_pos(1, 5)
;%print_text(text_ypos)
;%print_hex(!p1_Ypos, 1)
;PRINT P2 INFO
;PRINT RNG
%status_color(!blue)
%status_pos(1, 26)
%print_text(text_rng)
%status_color(!white)
%print_hex(!rng, 2)
;PRINT IGT
%status_color(!red)
%status_pos(18, 26)
%print_text(text_igt)
%status_color(!white)
%print_hex(!igt_min, 1)
%print_char(":")
%print_hex(!igt_sec, 1)
%print_char(".")
%print_dec_sub(!igt_frm, 60)
;%status_pos(23, 25)
;PHP
;SED
;LDA !igt_min
;SBC !igt_last_min
;STA !igt_room_min
;%print_hex(!igt_room_min, 1)
;%print_char(":")
;LDA !igt_sec
;SBC !igt_last_sec
;STA !igt_room_sec
;%print_hex(!igt_room_sec, 1)
;%print_char(".")
;LDA !igt_frm
;SBC !igt_last_frm
;STA !igt_room_frm
;%print_dec_sub(!igt_room_frm, 60)
;PLP
;%load_registers()
end:
SEP #$20
RTS
print "Total space used: ",pc