-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarque.asm
198 lines (166 loc) · 3.2 KB
/
marque.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
.export MarqueScreen
.include "include.controller.asm"
.include "include.const.asm"
.include "include.branch-macros.asm"
.include "include.mov-macros.asm"
.include "include.sys.asm"
.include "gfx.h.asm"
.include "general_mapper.h.asm"
.include "memory_layout.h.asm"
.include "read_controller.h.asm"
.include "sprite_space.h.asm"
.include "gameplay.h.asm"
.include "render_action.h.asm"
.include "score_combo.h.asm"
.include "msg_catalog.h.asm"
.include "famitone.h.asm"
.include "endboss.h.asm"
.importzp ppu_ctrl_current, buttons_press, lives
.importzp values
.importzp which_level
.importzp buttons
.import gameplay_palette
.import text_palette
.import RESET
outer = values + 4
inner = values + 5
BOSS_LEVEL = MAX_LEVEL
.segment "CODE"
.proc MarqueScreen
jsr WaitVblankFlag
; Load palette, which is defined in the prologue.
ldx #<text_palette
ldy #>text_palette
jsr LoadPalette
jsr SpriteSpaceEraseAllAndSpriteZero
jsr ClearBothNametables
ldx #MSG_SCORE
jsr MsgRender
ldx #MSG_ZERO_SCORE
jsr MsgRender
jsr RenderScore
ldx #MSG_MARQUE_LIVES
jsr MsgRender
jsr RenderLives
lda which_level
cmp #MAX_LEVEL
bge :+
ldx #MSG_MARQUE_LEVEL
jsr MsgRender
jsr RenderLevel
:
jsr RenderActionApplyAll
lda which_level
cmp #1
beq Level1
cmp #2
beq Level2
cmp #3
beq Level3
cmp #4
beq Level4
cmp #BOSS_LEVEL
beq EndBoss
jmp Finale
Level1:
ldx #MSG_THE_KITCHEN_IS
jsr MsgRender
ldx #MSG_FIND_THE_BROOM
jsr MsgRender
ldx #MSG_AND_CLEAN_IT_UP
jsr MsgRender
jmp LevelDone
Level2:
ldx #MSG_KILL_ALL_THE_FLIES
jsr MsgRender
ldx #MSG_WATCH_OUT_FOR
jsr MsgRender
ldx #MSG_AND_APPLIANCES
jsr MsgRender
jmp LevelDone
Level3:
ldx #MSG_USE_YOUR_SWATTER
jsr MsgRender
ldx #MSG_GET_COMBO_KILLS
jsr MsgRender
ldx #MSG_AND_EARN_HIGH
jsr MsgRender
jmp LevelDone
Level4:
ldx #MSG_KEEP_GOING_ALMOST
jsr MsgRender
ldx #MSG_THE_KITCHEN_NEARLY
jsr MsgRender
jmp LevelDone
EndBoss:
ldx #MSG_WARNING
jsr MsgRender
ldx #MSG_BOSS_FLY_IS_APPROACHING
jsr MsgRender
ldx #MSG_RESOLVE_YOUR_BATTLE
jsr MsgRender
jmp LevelDone
Finale:
ldx #MSG_YOU_DID_IT
jsr MsgRender
ldx #MSG_THE_KITCHEN_IS_CLEAN
jsr MsgRender
lda #1
jsr FamiToneMusicPlay
jmp LevelDone
LevelDone:
ldx #TITLE_MEMORY_LAYOUT
jsr MemoryLayoutFillChrRam
jsr EnableNmiThenWaitNewFrameThenEnableDisplay
mov outer, #$0
mov inner, #$90
lda which_level
cmp #(MAX_LEVEL + 1)
bne :+
mov inner, #1
:
MarqueLoop:
jsr WaitNewFrame
jsr FamiToneUpdate
dec inner
bne MarqueLoop
lda which_level
cmp #(MAX_LEVEL + 1)
beq MaybeTestController
dec outer
bpl MarqueLoop
TransitionOut:
jsr FamiToneMusicStop
ExitMarqueScreen:
jsr DisableDisplayAndNmi
jmp GameplayMain
MaybeTestController:
mov inner, #1
jsr ReadController
lda buttons_press
and #BUTTON_START
beq MarqueLoop
TransitionToReset:
jsr FamiToneMusicStop
jmp RESET
.endproc
.proc RenderLives
lda #1
jsr AllocateRenderAction
RenderActionSetYX 3, 10
lda lives
clc
adc #$30
sta render_action_data+0,y
rts
.endproc
.proc RenderLevel
lda #1
jsr AllocateRenderAction
RenderActionSetYX 11, 19
lda which_level
clc
adc #$30
sta render_action_data+0,y
rts
.endproc