-
Notifications
You must be signed in to change notification settings - Fork 13
/
gameover.asm
111 lines (92 loc) · 1.68 KB
/
gameover.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
// code concerning the game over mode
// states of the game over mode
.const STEP_FILLWELL = 0
.const STEP_CLEARWELL = 1
.const STEP_GAMEOVERTEXT = 2
// ------------------------------------------------
StartGameOverMode:
// play game over music
lda #0
sta sounddelayCounter
lda #SND_MUSIC_GAMEOVER
jsr playsound
// prepare for the first step
lda #STEP_FILLWELL
sta currentStep
// we will render this block
lda #105
sta drawCharacter
// and we need to do 20 lines
lda #19
sta linesLeft
rts
// ---------------------------------------------------
UpdateGameOverMode:
lda currentStep // which step to ...
cmp #STEP_FILLWELL // perform?
bne !otherStep+
jsr DrawLine
dec linesLeft
bmi !skip+
rts
!skip:
inc currentStep
lda #$20
sta drawCharacter
lda #19
sta linesLeft
rts
!otherStep:
cmp #STEP_CLEARWELL
bne !otherStep+
jsr DrawLine
dec linesLeft
bmi !skip+
rts
!skip:
// done clearing
// print text and go to next mode
ldy #WELL_GAMEOVER
jsr PRINT_WELLDATA
inc currentStep
rts
!otherStep:
// waiting for a key or fire button
lda inputResult
cmp #DOWN
beq !exit+
cmp #TURNCLOCK
beq !exit+
rts
!exit:
jmp EndGameOverMode
//rts
// ----------------------------------------------------
DrawLine:
clc
ldy #12
ldx linesLeft
jsr PLOT
lda drawCharacter
ldy #10
!loop:
jsr PRINT
dey
bne !loop-
rts
// ---------------------------------------------------
EndGameOverMode:
lda #MODE_ENTERNAME
sta gameMode
jsr StartEnterNameMode
rts
// ---------------------------------------------------
// the character to fill the well with
drawCharacter:
.byte 0
// the mode step variable
currentStep:
.byte 0
// the amount of lines left to fill
linesLeft:
.byte 0