-
Notifications
You must be signed in to change notification settings - Fork 13
/
attract.asm
72 lines (54 loc) · 1.18 KB
/
attract.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
.const ATTRACT_DELAY = 254
// -----------------------------------------
StartAttractMode:
lda #SND_MUSIC_TITLE
jsr playsound
lda #ATTRACT_DELAY
sta attractDelay
ldy #SCREEN_TITLE
sty attractStep
jmp PRINT_SCREEN
// -----------------------------------------
UpdateAttractMode:
dec attractDelay
beq triggered // swap screen when triggered
// check for key or joy button press
lda inputResult
cmp #DOWN // enter pressed?
beq !skip+ // yes
cmp #TURNCLOCK // joy button pressed?
beq !skip+ // yes
rts
!skip:
jmp EndAttractMode // start the game
triggered:
lda #ATTRACT_DELAY // reset the delay
sta attractDelay
inc attractStep // go to next screen
lda attractStep
cmp #4 // have we done 3 screens?
bne !skip+ // no. continue cycle
lda #SCREEN_TITLE // yes. reset cycle
sta attractStep
!skip:
ldy attractStep
jsr PRINT_SCREEN
lda attractStep
cmp #3
bne !exit+
ldx #14
ldy #14
jsr PRINT_HISCORE_TABLE
!exit:
rts
// -----------------------------------------
EndAttractMode:
lda #MODE_SELECTLEVEL
sta gameMode
jsr StartLevelSelectMode
rts
// -----------------------------------------
attractStep:
.byte 0
attractDelay:
.byte 0