-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathtitle.asm
420 lines (352 loc) · 8.02 KB
/
title.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
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
; This file is part of Pwn Adventure Z.
; Pwn Adventure Z is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
; Pwn Adventure Z is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
; You should have received a copy of the GNU General Public License
; along with Pwn Adventure Z. If not, see <http://www.gnu.org/licenses/>.
.include "defines.inc"
.define TILE_UI $00
.define TILE_VECTOR $01
.define TILE_Z $01
.segment "FIXED"
PROC title
lda current_bank
pha
lda #^show_title
jsr bankswitch
jsr show_title & $ffff
pla
jsr bankswitch
rts
.endproc
.segment "CHR1"
PROC show_title
; Get the developer logo screen ready
jsr clear_screen
jsr clear_tiles
; Copy tiles into video memory
LOAD_ALL_TILES $100 + TILE_VECTOR, vector35_tiles
; Use 8x8 sprites on first CHR page
lda #PPUCTRL_ENABLE_NMI | PPUCTRL_SPRITE_PATTERN | PPUCTRL_NAMETABLE_2C00
sta ppu_settings
; Copy sprite data to OAM
LOAD_PTR vector35_logo
ldy #0
vectorloop:
lda (ptr), y
sta sprites, y
iny
cpy #19 * 4
bne vectorloop
LOAD_PTR vector35_palette
jsr fade_in
; Show developer logo for 3 seconds then fade out
ldy #180
vectorwait:
jsr wait_for_vblank
jsr update_controller
and #JOY_START
bne vectordone
dey
bne vectorwait
vectordone:
jsr fade_out
jsr clear_screen
jsr clear_tiles
LOAD_ALL_TILES $01, insomnihack_logo_tiles
LOAD_PTR insomnihack_logo
ldx #6
ldy #13
lda #18
jsr write_tiles
ldx #6
ldy #14
lda #18
jsr write_tiles
LOAD_PTR insomnihack_logo_palette
jsr fade_in
; Show CSAW logo for 3 seconds then fade out
ldy #180
insomnihackwait:
jsr wait_for_vblank
jsr update_controller
and #JOY_START
bne insomnihackdone
dey
bne insomnihackwait
insomnihackdone:
jsr fade_out
; Start drawing title screen
jsr clear_screen
; Copy tiles into video memory
LOAD_ALL_TILES $000 + TILE_UI, title_tiles
LOAD_ALL_TILES $100 + TILE_Z, z_tiles
; Draw UI box around logo
lda #6
sta arg0
lda #5
sta arg1
lda #24
sta arg2
lda #14
sta arg3
jsr draw_large_box
; Draw Pwn Adventure logo
LOAD_PTR pwn_logo
ldy #7
pwn_logo_loop:
tya
pha
ldx #8
lda #9
jsr write_tiles
pla
tay
iny
cpy #11
bne pwn_logo_loop
; Copy Z logo sprite data to OAM
LOAD_PTR z_logo
ldy #0
zloop:
lda (ptr), y
sta sprites, y
iny
cpy #28 * 4
bne zloop
; Set palette for logo
lda #4
sta arg0
lda #3
sta arg1
lda #8
sta arg2
lda #5
sta arg3
lda #1
sta arg4
jsr set_box_palette
lda #2
sta arg0
sta arg4
lda #8
sta arg1
sta arg3
lda #13
sta arg2
jsr set_box_palette
lda #11
sta arg1
sta arg3
lda #3
sta arg4
jsr set_box_palette
; Draw text
LOAD_PTR adventure_str
ldx #8
ldy #12
jsr write_string
LOAD_PTR retro_str
ldx #4
ldy #16
jsr write_string
ldx #10
ldy #22
jsr write_string
; Fade in to the palette and start displaying the title screen
LOAD_PTR title_palette
jsr fade_in
lda #MUSIC_TITLE
jsr play_music
lda #0
sta arg0
sta arg1
menuloop:
jsr update_controller
and #JOY_START
bne start
lda controller
beq nopress
ldx #0
buttonmoveloop:
lda button_presses + 1, x
sta button_presses, x
inx
cpx #9
bne buttonmoveloop
lda controller
sta button_presses + 9
lda button_presses
cmp #JOY_UP
bne waitfordepress
lda button_presses + 1
cmp #JOY_UP
bne waitfordepress
lda button_presses + 2
cmp #JOY_DOWN
bne waitfordepress
lda button_presses + 3
cmp #JOY_DOWN
bne waitfordepress
lda button_presses + 4
cmp #JOY_LEFT
bne waitfordepress
lda button_presses + 5
cmp #JOY_RIGHT
bne waitfordepress
lda button_presses + 6
cmp #JOY_LEFT
bne waitfordepress
lda button_presses + 7
cmp #JOY_RIGHT
bne waitfordepress
lda button_presses + 8
cmp #JOY_B
bne waitfordepress
lda button_presses + 9
cmp #JOY_A
bne waitfordepress
lda #1
sta secret_code
waitfordepress:
jsr wait_for_vblank
jsr title_palette_anim & $ffff
jsr update_controller
lda controller
bne waitfordepress
nopress:
jsr wait_for_vblank
jsr title_palette_anim & $ffff
jmp menuloop & $ffff
start:
jsr fade_out
rts
.endproc
PROC title_palette_anim
ldx arg0
ldy arg1
inx
cpx #8
bne done
ldx #0
LOAD_PTR flashing_text_palette_anim
lda #3
sta arg0
jsr animate_palette
jsr prepare_for_rendering
done:
stx arg0
sty arg1
rts
.endproc
.segment "TEMP"
VAR button_presses
.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
.segment "CHR1"
VAR vector35_logo
.byte 99, TILE_VECTOR, 0, 108
.byte 99, TILE_VECTOR + $1, 1, 116
.byte 99, TILE_VECTOR + $1, 1 | SPRITE_FLIP_HORIZ, 132
.byte 99, TILE_VECTOR + $0, 0 | SPRITE_FLIP_HORIZ, 140
.byte 107, TILE_VECTOR + $2, 0, 108
.byte 107, TILE_VECTOR + $3, 0, 116
.byte 107, TILE_VECTOR + $4, 1, 124
.byte 107, TILE_VECTOR + $3, 0 | SPRITE_FLIP_HORIZ, 132
.byte 107, TILE_VECTOR + $2, 0 | SPRITE_FLIP_HORIZ, 140
.byte 115, TILE_VECTOR + $2, 0, 116
.byte 115, TILE_VECTOR + $5, 0, 124
.byte 115, TILE_VECTOR + $2, 0 | SPRITE_FLIP_HORIZ, 132
.byte 131, TILE_VECTOR + $6, 2, 100
.byte 131, TILE_VECTOR + $7, 2, 108
.byte 131, TILE_VECTOR + $8, 2, 116
.byte 131, TILE_VECTOR + $9, 2, 124
.byte 131, TILE_VECTOR + $a, 2, 132
.byte 131, TILE_VECTOR + $b, 2, 140
.byte 131, TILE_VECTOR + $c, 2, 148
VAR vector35_palette
.byte $0f, $10, $2a, $3a
.byte $0f, $10, $2a, $3a
.byte $0f, $10, $2a, $3a
.byte $0f, $10, $2a, $3a
.byte $0f, $10, $2a, $3a
.byte $0f, $10, $2a, $30
.byte $0f, $30, $3a, $2a
.byte $0f, $10, $2a, $3a
VAR pwn_logo
.byte $02, $01, $04, $0c, $20, $0c, $0e, $10, $0c
.byte $2b, $20, $2b, $2b, $20, $2b, $0f, $11, $2b
.byte $03, $01, $05, $06, $08, $0a, $2b, $12, $14
.byte $0d, $20, $20, $07, $09, $0b, $0d, $13, $15
VAR z_logo
.byte 63, TILE_Z + $00, 0, 152
.byte 63, TILE_Z + $01, 0, 160
.byte 63, TILE_Z + $01, 0, 168
.byte 63, TILE_Z + $01, 0, 176
.byte 63, TILE_Z + $02, 0, 184
.byte 71, TILE_Z + $03, 0, 152
.byte 71, TILE_Z + $04, 0, 160
.byte 71, TILE_Z + $05, 0, 168
.byte 71, TILE_Z + $06, 0, 176
.byte 71, TILE_Z + $07, 0, 184
.byte 79, TILE_Z + $08, 0, 160
.byte 79, TILE_Z + $09, 0, 168
.byte 79, TILE_Z + $0a, 0, 176
.byte 79, TILE_Z + $0b, 0, 184
.byte 87, TILE_Z + $08, 0, 152
.byte 87, TILE_Z + $09, 0, 160
.byte 87, TILE_Z + $0a, 0, 168
.byte 87, TILE_Z + $0b, 0, 176
.byte 95, TILE_Z + $0c, 0, 152
.byte 95, TILE_Z + $0d, 0, 160
.byte 95, TILE_Z + $0e, 0, 168
.byte 95, TILE_Z + $0f, 0, 176
.byte 95, TILE_Z + $10, 0, 184
.byte 103, TILE_Z + $11, 0, 152
.byte 103, TILE_Z + $12, 0, 160
.byte 103, TILE_Z + $12, 0, 168
.byte 103, TILE_Z + $12, 0, 176
.byte 103, TILE_Z + $13, 0, 184
VAR adventure_str
.byte "ADVENTURE", 0
VAR retro_str
.byte " ", $3b, " BEARLY ALIVE ", $3d, " ", 0
VAR press_start_str
.byte "PRESS START", 0
VAR flashing_text_palette_anim
.word normal_str_palette & $ffff
.word normal_str_palette & $ffff
.word normal_str_palette & $ffff
.word alt_str_palettes & $ffff
.word (alt_str_palettes + 4) & $ffff
.word (alt_str_palettes + 8) & $ffff
.word (alt_str_palettes + 4) & $ffff
.word alt_str_palettes & $ffff
VAR title_palette
.byte $0f, $21, $31, $37
.byte $0f, $16, $26, $36
.byte $0f, $31, $31, $31
normal_str_palette:
.byte $0f, $30, $30, $30
.byte $0f, $16, $26, $36
.byte $0f, $16, $26, $36
.byte $0f, $16, $26, $36
.byte $0f, $16, $26, $36
alt_str_palettes:
.byte $0f, $10, $10, $10
.byte $0f, $00, $00, $00
.byte $0f, $0f, $0f, $0f
VAR insomnihack_logo
.byte $01, $03, $05, $07, $09, $0b, $0d, $0f, $11, $13, $15, $17, $19, $1b, $1d, $1f, $21, $23
.byte $02, $04, $06, $08, $0a, $0c, $0e, $10, $12, $14, $16, $18, $1a, $1c, $1e, $20, $22, $24
VAR insomnihack_logo_palette
.byte $0f, $06, $30, $20
.byte $0f, $06, $30, $20
TILES title_tiles, 1, "tiles/title/title.chr", 92
TILES vector35_tiles, 1, "tiles/title/vector35.chr", 14
TILES z_tiles, 1, "tiles/title/z.chr", 20
TILES insomnihack_logo_tiles, 1, "tiles/title/insomnihack2.chr", 36