-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtitle.asm
407 lines (328 loc) · 10.5 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
TITLE_SPRITE_X_POS = 80
TITLE_FADE_COLOR_INDEX = 15
!zone HandleTitle
HandleTitle
lda #15
ldx #$10
jsr ColorClear32bitAddr
lda #$ff
sta VIC4.SPR16EN
sta VIC4.SPRX64EN
;enable palette 00 from RAM
lda #$f8
trb VIC3.ROMBANK
;set sprite palette bank 2
lda #%00001000
sta VIC4.PALSEL
;set default palette colors
ldx #0
-
lda PALETTE_DEFAULT_16_COLORS_R,x
sta VIC4.PALRED,x
lda PALETTE_DEFAULT_16_COLORS_G,x
sta VIC4.PALGREEN,x
lda PALETTE_DEFAULT_16_COLORS_B,x
sta VIC4.PALBLUE,x
inx
cpx #16
bne -
lda #0
sta VIC4.PALRED + TITLE_FADE_COLOR_INDEX
sta VIC4.PALGREEN + TITLE_FADE_COLOR_INDEX
sta VIC4.PALBLUE + TITLE_FADE_COLOR_INDEX
sta PAL_POS
sta COLOR_INDEX
sta PAL_COLORS
sta PAL_COLORS + 1
sta PAL_COLORS + 2
lda #TITLE_SPRITE_X_POS
sta VIC.SPRITE_X_POS
lda #TITLE_SPRITE_X_POS + 1 * 28
sta VIC.SPRITE_X_POS + 2
lda #TITLE_SPRITE_X_POS + 2 * 28
sta VIC.SPRITE_X_POS + 4
lda #TITLE_SPRITE_X_POS + 3 * 28
sta VIC.SPRITE_X_POS + 6
lda #TITLE_SPRITE_X_POS + 4 * 28
sta VIC.SPRITE_X_POS + 8
lda #TITLE_SPRITE_X_POS + 5 * 28
sta VIC.SPRITE_X_POS + 10
lda #TITLE_SPRITE_X_POS + 6 * 28
sta VIC.SPRITE_X_POS + 12
lda #< ( TITLE_SPRITE_X_POS + 7 * 28 )
sta VIC.SPRITE_X_POS + 14
lda #$80
sta VIC.SPRITE_X_EXTEND
lda #70
sta VIC.SPRITE_Y_POS
sta VIC.SPRITE_Y_POS + 2
sta VIC.SPRITE_Y_POS + 4
sta VIC.SPRITE_Y_POS + 6
sta VIC.SPRITE_Y_POS + 8
sta VIC.SPRITE_Y_POS + 10
sta VIC.SPRITE_Y_POS + 12
sta VIC.SPRITE_Y_POS + 14
lda #TITLE_LETTER_SPRITES / 64
sta SPRITE_POINTER_BASE
lda #( 1 * 256 + TITLE_LETTER_SPRITES ) / 64
sta SPRITE_POINTER_BASE + 1
lda #( 2 * 256 + TITLE_LETTER_SPRITES ) / 64
sta SPRITE_POINTER_BASE + 2
lda #( 3 * 256 + TITLE_LETTER_SPRITES ) / 64
sta SPRITE_POINTER_BASE + 3
lda #( 4 * 256 + TITLE_LETTER_SPRITES ) / 64
sta SPRITE_POINTER_BASE + 4
lda #( 5 * 256 + TITLE_LETTER_SPRITES ) / 64
sta SPRITE_POINTER_BASE + 5
lda #( 6 * 256 + TITLE_LETTER_SPRITES ) / 64
sta SPRITE_POINTER_BASE + 6
lda #( 7 * 256 + TITLE_LETTER_SPRITES ) / 64
sta SPRITE_POINTER_BASE + 7
lda #15
sta VIC.SPRITE_MULTICOLOR_1
lda #1
sta VIC.SPRITE_MULTICOLOR_2
;transparent color index for 16color sprites
lda #0 ;13
sta VIC.SPRITE_COLOR
sta VIC.SPRITE_COLOR + 1
sta VIC.SPRITE_COLOR + 2
sta VIC.SPRITE_COLOR + 3
sta VIC.SPRITE_COLOR + 4
sta VIC.SPRITE_COLOR + 5
sta VIC.SPRITE_COLOR + 6
sta VIC.SPRITE_COLOR + 7
lda #$ff
;sta VIC.SPRITE_MULTICOLOR
sta VIC.SPRITE_ENABLE
lda #0
sta VIC.BACKGROUND_COLOR
ldx #0
-
lda #32 ;160
sta SCREEN_CHAR,x
sta SCREEN_CHAR + 1 * 250,x
sta SCREEN_CHAR + 2 * 250,x
sta SCREEN_CHAR + 3 * 250,x
sta SCREEN_CHAR + 4 * 250,x
sta SCREEN_CHAR + 5 * 250,x
sta SCREEN_CHAR + 6 * 250,x
sta SCREEN_CHAR + 7 * 250,x
inx
cpx #250
bne -
lda #<TEXT_WRITTEN_BY
sta ZEROPAGE_POINTER_1
lda #>TEXT_WRITTEN_BY
sta ZEROPAGE_POINTER_1 + 1
lda #<( SCREEN_CHAR + 8 * 80 + 27 )
sta ZEROPAGE_POINTER_2
lda #>( SCREEN_CHAR + 8 * 80 + 27 )
sta ZEROPAGE_POINTER_2 + 1
jsr DisplayText
lda #<TEXT_FOR_COMPO
sta ZEROPAGE_POINTER_1
lda #>TEXT_FOR_COMPO
sta ZEROPAGE_POINTER_1 + 1
lda #<( SCREEN_CHAR + 10 * 80 + 27 )
sta ZEROPAGE_POINTER_2
lda #>( SCREEN_CHAR + 10 * 80 + 27 )
sta ZEROPAGE_POINTER_2 + 1
jsr DisplayText
lda #<TEXT_INSTRUCTIONS_1
sta ZEROPAGE_POINTER_1
lda #>TEXT_INSTRUCTIONS_1
sta ZEROPAGE_POINTER_1 + 1
lda #<( SCREEN_CHAR + 13 * 80 + 3 )
sta ZEROPAGE_POINTER_2
lda #>( SCREEN_CHAR + 13 * 80 + 3 )
sta ZEROPAGE_POINTER_2 + 1
jsr DisplayText
lda #<TEXT_INSTRUCTIONS_2
sta ZEROPAGE_POINTER_1
lda #>TEXT_INSTRUCTIONS_2
sta ZEROPAGE_POINTER_1 + 1
lda #<( SCREEN_CHAR + 14 * 80 + 3 )
sta ZEROPAGE_POINTER_2
lda #>( SCREEN_CHAR + 14 * 80 + 3 )
sta ZEROPAGE_POINTER_2 + 1
jsr DisplayText
lda #<TEXT_INSTRUCTIONS_3
sta ZEROPAGE_POINTER_1
lda #>TEXT_INSTRUCTIONS_3
sta ZEROPAGE_POINTER_1 + 1
lda #<( SCREEN_CHAR + 15 * 80 + 3 )
sta ZEROPAGE_POINTER_2
lda #>( SCREEN_CHAR + 15 * 80 + 3 )
sta ZEROPAGE_POINTER_2 + 1
jsr DisplayText
lda #<TEXT_PRESS_FIRE
sta ZEROPAGE_POINTER_1
lda #>TEXT_PRESS_FIRE
sta ZEROPAGE_POINTER_1 + 1
lda #<( SCREEN_CHAR + 22 * 80 + 26 )
sta ZEROPAGE_POINTER_2
lda #>( SCREEN_CHAR + 22 * 80 + 26 )
sta ZEROPAGE_POINTER_2 + 1
jsr DisplayText
jsr WaitFrame
;80 col mode
lda #$80
tsb VIC3.VICDIS
;Turn off FCM mode and 16bit per char number
lda #$00
sta VIC4.VIC4DIS
lda #80
sta VIC4.CHARSTEP_LO
lda #0
sta VIC4.CHARSTEP_HI
TitleLoop
lda #60
jsr WaitForLine
ldx #13
stx VIC.BACKGROUND_COLOR
inc
jsr WaitForLine
ldx #0
stx VIC.BACKGROUND_COLOR
inc
jsr WaitForLine
ldx #8
stx VIC.BACKGROUND_COLOR
jsr WaitFrame
;color "effect"
ldy PAL_INDEX
lda COLOR_INDEX,y
tax
clc
adc #$d1
sta .ColorIndex
lda PAL_COLORS,x
clc
adc COLOR_DIR,y
sta PAL_COLORS,x
;swizzle
asl
adc #$80
rol
asl
adc #$80
rol
.ColorIndex = * + 2
sta VIC4.PALRED + TITLE_FADE_COLOR_INDEX
sta PARAM1
inc PAL_POS
lda PAL_POS
cmp #63
bne +
lda #0
sta PAL_POS
inc PAL_INDEX
lda PAL_INDEX
cmp #6
bne +
lda #0
sta PAL_INDEX
+
lda CIA1.DATA_PORT_B
sta JOY_VALUE
and #$10
lbne TitleLoop
;release button
jsr ReleaseButton
;jmp HandleWellDone
;40 col mode
lda #$80
trb VIC3.VICDIS
;Turn on FCM mode and 16bit per char number
lda #$07
sta VIC4.VIC4DIS
lda #80
sta VIC4.CHARSTEP_LO
lda #0
sta VIC4.CHARSTEP_HI
jmp StartGame
HEX_CHAR2
!byte 48,49,50,51,52,53,54,55,56,57,1,2,3,4,5,6
;hi byte offset to indicate R, G or B (being 0,1 or 2)
COLOR_INDEX
!byte 0,1,2,0,1,2
COLOR_DIR
!byte 4,4,4,$fc,$fc,$fc
PAL_COLORS
!byte 0,0,0
!zone DisplayText
DisplayText
ldy #0
-
lda (ZEROPAGE_POINTER_1),y
beq .Done
sta (ZEROPAGE_POINTER_2),y
iny
bra -
.Done
rts
!zone ReleaseButton
ReleaseButton
-
jsr WaitFrame
lda CIA1.DATA_PORT_B
sta JOY_VALUE
and #$10
beq -
rts
!zone PaletteFadeIn
.PALETTE_POS
!byte 0
.PALETTE_R
!byte 127
.PALETTE_G
!byte 255
.PALETTE_B
!byte 255
PaletteFadeIn
lda #0
sta .PALETTE_POS
--
;copy palette data (16 entries)
ldy #0
ldx #$00
-
lda PALETTE_DATA_R, x
sta VIC4.PALRED,y
lda PALETTE_DATA_G, x
sta VIC4.PALGREEN,y
lda PALETTE_DATA_B, x
sta VIC4.PALBLUE,y
iny
inx
cpx #16
bne -
jsr WaitFrame
inc .PALETTE_POS
lda .PALETTE_POS
cmp #16
bne --
rts
PAL_POS
!byte 0
PAL_INDEX
!byte 0
TEXT_WRITTEN_BY
!scr "written by endurion 2021",0
TEXT_FOR_COMPO
!scr "for shallans mega65 compo",0
TEXT_INSTRUCTIONS_1
!scr "destroy all colored blocks. you can only destroy them if your ball has the",0
TEXT_INSTRUCTIONS_2
!scr "same color. there are color changers, direction changers, keys and locks.",0
TEXT_INSTRUCTIONS_3
!scr "press fire to speed up. f1 to self destruct.",0
TEXT_PRESS_FIRE
!scr "press fire to start playing",0
PALETTE_DEFAULT_16_COLORS_R
!hex 00ff88aacc0000eedd66ff3377aa00bb
PALETTE_DEFAULT_16_COLORS_G
!hex 00ff00ff44cc00ee8844773377ff88bb
PALETTE_DEFAULT_16_COLORS_B
!hex 00ff00eecc55aa77550077337766ffbb