File tree Expand file tree Collapse file tree 15 files changed +1339
-1347
lines changed Expand file tree Collapse file tree 15 files changed +1339
-1347
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change
1
+ controllerInputTiles:
2
+ ; .byte "RLDUSSBA"
3
+ .byte $D0 , $D1 , $D2 , $D3
4
+ .byte $D4 , $D4 , $D5 , $D5
5
+ controllerInputX:
6
+ .byte $8 , $0 , $5 , $4
7
+ .byte $1D , $14 , $27 , $30
8
+ controllerInputY:
9
+ .byte $FF , $0 , $5 , $FB
10
+ .byte $0 , $0 , $FF , $FF
11
+
12
+ controllerInputDisplay: ; called in events, speedtest
13
+ lda #0
14
+ sta tmp3
15
+ controllerInputDisplayX:
16
+ lda heldButtons_player1
17
+ sta tmp1
18
+ ldy #0
19
+ @inputLoop:
20
+ lda tmp1
21
+ and #1
22
+ beq @inputContinue
23
+ ldx oamStagingLength
24
+ lda controllerInputY, y
25
+ adc #$4C
26
+ sta oamStaging, x
27
+ inx
28
+ lda controllerInputTiles, y
29
+ sta oamStaging, x
30
+ inx
31
+ lda #$01
32
+ sta oamStaging, x
33
+ inx
34
+ lda controllerInputX, y
35
+ adc #$13
36
+ adc tmp3
37
+ sta oamStaging, x
38
+ inx
39
+ ; increase OAM index
40
+ lda #$04
41
+ clc
42
+ adc oamStagingLength
43
+ sta oamStagingLength
44
+ @inputContinue:
45
+ lda tmp1
46
+ ror
47
+ sta tmp1
48
+ iny
49
+ cpy #8
50
+ bmi @inputLoop
51
+ rts
Original file line number Diff line number Diff line change
1
+ practisePrepareNext:
2
+ lda practiseType
3
+ cmp #MODE_PACE
4
+ bne @skipPace
5
+ jmp prepareNextPace
6
+ @skipPace:
7
+ cmp #MODE_GARBAGE
8
+ bne @skipGarbo
9
+ jmp prepareNextGarbage
10
+ @skipGarbo:
11
+ cmp #MODE_PARITY
12
+ bne @skipParity
13
+ jmp prepareNextParity
14
+ @skipParity:
15
+ cmp #MODE_TAPQTY
16
+ bne @skipTapQuantity
17
+ jsr prepareNextTapQuantity
18
+ @skipTapQuantity:
19
+ rts
20
+ practiseInitGameState:
21
+ lda practiseType
22
+ cmp #MODE_TAPQTY
23
+ bne @skipTapQuantity
24
+ jsr prepareNextTapQuantity
25
+ @skipTapQuantity:
26
+ lda practiseType
27
+ cmp #MODE_CHECKERBOARD
28
+ bne @skipChecker
29
+ jsr initChecker
30
+ @skipChecker:
31
+ rts
32
+
33
+ practiseAdvanceGame:
34
+ lda practiseType
35
+ cmp #MODE_TSPINS
36
+ bne @skipTSpins
37
+ jmp advanceGameTSpins
38
+ @skipTSpins:
39
+ cmp #MODE_PRESETS
40
+ bne @skipPresets
41
+ jmp advanceGamePreset
42
+ @skipPresets:
43
+ cmp #MODE_FLOOR
44
+ bne @skipFloor
45
+ jmp advanceGameFloor
46
+ @skipFloor:
47
+ cmp #MODE_TAP
48
+ bne @skipTap
49
+ jmp advanceGameTap
50
+ @skipTap:
51
+ rts
52
+
53
+ practiseGameHUD:
54
+ lda inputDisplayFlag
55
+ beq @noInput
56
+ jsr controllerInputDisplay
57
+ @noInput:
58
+
59
+ lda practiseType
60
+ cmp #MODE_PACE
61
+ bne @skipPace
62
+ jsr gameHUDPace
63
+ @skipPace:
64
+
65
+ lda practiseType
66
+ cmp #MODE_TAPQTY
67
+ bne @skipTapQuantity
68
+
69
+ ldy #0
70
+ ldx oamStagingLength
71
+ @drawQTY:
72
+ ; taps
73
+ tya
74
+ asl
75
+ asl
76
+ asl
77
+ adc #$34
78
+ sta tmpY
79
+ sta oamStaging, x
80
+ inx
81
+ lda tqtyCurrent, y
82
+ cmp #5
83
+ bmi @right0
84
+ sbc #5
85
+ jmp @left0
86
+ @right0:
87
+ lda #6
88
+ sbc tqtyCurrent, y
89
+ @left0:
90
+ sta oamStaging, x
91
+ inx
92
+ lda #$02
93
+ sta oamStaging, x
94
+ inx
95
+ lda #$64
96
+ sta oamStaging, x
97
+ inx
98
+
99
+ ; direction
100
+ lda tmpY
101
+ sta oamStaging, x
102
+ inx
103
+
104
+ lda tqtyCurrent, y
105
+ cmp #6
106
+ bmi @right
107
+ lda #$D6
108
+ jmp @left
109
+ @right:
110
+ lda #$D7
111
+ @left:
112
+ sta oamStaging, x
113
+ inx
114
+ lda #$02
115
+ sta oamStaging, x
116
+ inx
117
+ lda #$6E
118
+ sta oamStaging, x
119
+ inx
120
+
121
+ ; $D6 / D7 for direction
122
+ ; increase OAM index
123
+ lda #$08
124
+ clc
125
+ adc oamStagingLength
126
+ sta oamStagingLength
127
+ iny
128
+ cpy #2
129
+ bmi @drawQTY
130
+
131
+ @skipTapQuantity:
132
+ rts
Original file line number Diff line number Diff line change
1
+ advanceGameFloor:
2
+ lda floorModifier
3
+ drawFloor:
4
+ ; get correct offset
5
+ sta tmp1
6
+ lda # $ D
7
+ sbc tmp1
8
+ tax
9
+ ; x10
10
+ lda multBy10Table , x
11
+ tax
12
+ ; tile to draw is $7B
13
+ lda # $ 7B
14
+ @ loop :
15
+ sta $ 0446 , X
16
+ inx
17
+ cpx # $ 82
18
+ bmi @ loop
19
+ @skip:
20
+ rts
Original file line number Diff line number Diff line change
1
+ prepareNextGarbage:
2
+ lda garbageModifier
3
+ jsr switch_s_plus_2a
4
+ .addr garbageAlwaysTetrisReady
5
+ .addr garbageNormal
6
+ .addr garbageSmart
7
+ .addr garbageHard
8
+ .addr garbageTypeC ; infinite dig
9
+
10
+ garbageTypeC:
11
+ jsr findTopBulky
12
+ adc #$20 ; offset from starting position
13
+ @loop:
14
+ sta tmp3
15
+
16
+ jsr random10
17
+ adc tmp3
18
+ tax
19
+ jsr swapMino
20
+ txa
21
+
22
+ sta tmp3
23
+ cmp #$c0
24
+ bcc @loop
25
+ rts
26
+
27
+ findTopBulky:
28
+ lda #$0
29
+ @loop:
30
+ sta tmp3 ; line
31
+
32
+ tax
33
+ lda #0
34
+ sta tmp2 ; line block qty
35
+ ldy #9
36
+ @loopLine:
37
+ lda playfield, x
38
+ cmp #EMPTY_TILE
39
+ beq @noBlock
40
+ inc tmp2
41
+ @noBlock:
42
+ inx
43
+ dey
44
+ bne @loopLine
45
+ lda tmp2
46
+ cmp #4 ; requirement
47
+ bpl @done
48
+
49
+ lda tmp3
50
+ adc #$A
51
+ cmp #$b8
52
+ bcc @loop
53
+ @done:
54
+ txa
55
+ rts
56
+
57
+ swapMino:
58
+ ldy #EMPTY_TILE
59
+ lda playfield, x
60
+ cmp #EMPTY_TILE
61
+ bne @full
62
+ ldy #BLOCK_TILES+3
63
+ @full:
64
+ tya
65
+ sta playfield, x
66
+ rts
67
+
68
+ garbageNormal:
69
+ jsr randomHole
70
+ jsr randomGarbage
71
+ rts
72
+
73
+ garbageSmart:
74
+ jsr smartHole
75
+ jsr randomGarbage
76
+ rts
77
+
78
+ findTop:
79
+ ldx #$0
80
+ @loop:
81
+ lda playfield, x
82
+ cmp #EMPTY_TILE
83
+ bne @done
84
+ inx
85
+ cpx #$b8
86
+ bcc @loop
87
+ @done:
88
+ rts
89
+
90
+ randomGarbage:
91
+ jsr findTop
92
+ cpx #130
93
+ bcc @done
94
+
95
+ lda garbageDelay
96
+ cmp #0
97
+ bne @delay
98
+
99
+ jsr random10
100
+ and #3
101
+ sta pendingGarbage
102
+ jsr random10
103
+ and #$7
104
+ adc #$2 +1
105
+ sta garbageDelay
106
+ @delay:
107
+ dec garbageDelay
108
+ @done:
109
+ rts
110
+
111
+ garbageHard:
112
+ jsr findTop
113
+ cpx #100
114
+ bcc @nothing
115
+
116
+ lda spawnCount
117
+ and #1
118
+ bne @nothing
119
+ jsr randomHole
120
+ inc pendingGarbage
121
+ @nothing:
122
+ rts
123
+
124
+ smartHole:
125
+ ldx #199
126
+ @loop:
127
+ lda playfield, x
128
+ cmp #EMPTY_TILE
129
+ beq @done
130
+ dex
131
+ cpx #190
132
+ bcs @loop
133
+ @done:
134
+ txa
135
+ sbc #190
136
+ sta garbageHole
137
+ rts
138
+
139
+ randomHole:
140
+ jsr random10
141
+ sta garbageHole
142
+ rts
143
+
144
+ garbageAlwaysTetrisReady:
145
+ ; right well
146
+ lda #9
147
+ sta garbageHole
148
+
149
+ lda #0
150
+ sta tmp1 ; garbage to add
151
+
152
+ ldx #190
153
+ jsr checkTetrisReady
154
+ ldx #180
155
+ jsr checkTetrisReady
156
+ ldx #170
157
+ jsr checkTetrisReady
158
+ ldx #160
159
+ jsr checkTetrisReady
160
+
161
+ lda tmp1
162
+ sta pendingGarbage
163
+ rts
164
+
165
+ checkTetrisReady:
166
+ ldy #9
167
+ @loop:
168
+ lda playfield, x
169
+ cmp #EMPTY_TILE
170
+ bne @filled
171
+ inc tmp1 ; add garbage
172
+ ldy #1
173
+ @filled:
174
+ inx
175
+ dey
176
+ bne @loop
177
+ rts
You can’t perform that action at this time.
0 commit comments