Skip to content

Commit 40e1d3f

Browse files
committed
low stack mode
1 parent fd43635 commit 40e1d3f

File tree

11 files changed

+74
-4
lines changed

11 files changed

+74
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Crunch Mode
66
* Marathon Mode
77
* Hidden Score Mode
8+
* Low Stack Mode
89
* M Score changed to Classic Scoring + Millions counter
910
* Invisible linecap turns entire playfield invisible
1011
* Invisible mode preserves original piece colors

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* [Garbage](#garbage)
2626
* [Drought](#drought)
2727
* [DAS Delay](#das-delay)
28+
* [Low Stack](#low-stack)
2829
* [Double Killscreen](#double-killscreen)
2930
* [Invisible](#invisible)
3031
* [Hard Drop](#hard-drop)
@@ -224,6 +225,12 @@ Create artificially inflated droughts. Increasing the value causes less I pieces
224225

225226
Change the auto-shift delay rate.
226227

228+
### Low Stack
229+
230+
![Low-Stack](./assets/screens/lowstack.png)
231+
232+
Choose a height limit for your stack and stay below or else it's game over.
233+
227234
### Double Killscreen
228235

229236
The pieces fall by two blocks every frame. It's hard.

assets/screens/lowstack.png

4.76 KB
Loading

src/chr/game_tileset.png

-22.5 KB
Loading

src/constants.asm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ BTYPE_START_LINES := $25 ; bcd
3434
MENU_HIGHLIGHT_COLOR := $12 ; $12 in gym, $16 in original
3535
BLOCK_TILES := $7B
3636
EMPTY_TILE := $EF
37+
LOW_STACK_LINE := $DF
3738
TETRIMINO_X_HIDE := $EF
3839

3940
PAUSE_SPRITE_X := $74
@@ -70,6 +71,7 @@ MODE_CHECKERBOARD
7071
MODE_GARBAGE
7172
MODE_DROUGHT
7273
MODE_DAS
74+
MODE_LOWSTACK
7375
MODE_KILLX2
7476
MODE_INVISIBLE
7577
MODE_HARDDROP
@@ -135,6 +137,7 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
135137
.byte $4 ; MODE_GARBAGE
136138
.byte $12 ; MODE_DROUGHT
137139
.byte $10 ; MODE_DAS
140+
.byte $0F ; MODE_LOWSTACK
138141
.byte $0 ; MODE_KILLX2
139142
.byte $0 ; MODE_INVISIBLE
140143
.byte $0 ; MODE_HARDDROP
@@ -171,6 +174,7 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
171174
.byte "GARBGE"
172175
.byte "LOBARS"
173176
.byte "DASDLY"
177+
.byte "LOSTAK"
174178
.byte "KILLX2"
175179
.byte "INVZBL"
176180
.byte "HRDDRP"

src/nametables/game_type_menu.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ drawTiles(buffer, lookup, `
5656
#a GARBAGE d#
5757
#a DROUGHT d#
5858
#a DAS DELAY d#
59+
#a LOW STACK d#
5960
#a KILLSCREEN »2 d#
6061
#a INVISIBLE d#
6162
#a HARD DROP d#
62-
#a TAP/ROLL SPEED d#
6363
`);drawTiles(extra, lookup, `
64+
#a TAP/ROLL SPEED d#
6465
#a SCORING d#
6566
#a CRASH d#
6667
#a HZ DISPLAY d#
@@ -74,7 +75,6 @@ drawTiles(buffer, lookup, `
7475
#a QUAL MODE d#
7576
#a PAL MODE d#
7677
#a d#
77-
#a d#
7878
#a V5 d#
7979
#a d#
8080
#a d#

src/nmi/render_util.asm

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ render_playfield:
5252
jsr copyPlayfieldRowToVRAM
5353
jsr copyPlayfieldRowToVRAM
5454
jsr copyPlayfieldRowToVRAM
55-
rts
55+
lda practiseType
56+
cmp #MODE_LOWSTACK
57+
bne @ret
58+
jmp copyLowStackRowToVram
59+
@ret: rts
5660

5761
vramPlayfieldRows:
5862
.word $20CC,$20EC,$210C,$212C
@@ -61,6 +65,22 @@ vramPlayfieldRows:
6165
.word $224C,$226C,$228C,$22AC
6266
.word $22CC,$22EC,$230C,$232C
6367

68+
copyLowStackRowToVram:
69+
lda lowStackRow
70+
asl
71+
tax
72+
lda vramPlayfieldRows+1,x
73+
sta PPUADDR
74+
lda vramPlayfieldRows,x
75+
sta PPUADDR
76+
ldx #$0A
77+
lda #LOW_STACK_LINE
78+
@drawLine:
79+
sta PPUDATA
80+
dex
81+
bne @drawLine
82+
rts
83+
6484
copyPlayfieldRowToVRAM:
6585
ldx vramRow
6686
cpx #$15

src/playstate/lock.asm

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
playState_lockTetrimino:
22
jsr isPositionValid
33
beq @notGameOver
4-
; gameOver:
4+
@gameOver:
55
lda outOfDateRenderFlags ; Flag needed to reveal hidden score
66
ora #$04
77
sta outOfDateRenderFlags
@@ -78,6 +78,25 @@ playState_lockTetrimino:
7878
inx
7979
dec generalCounter3
8080
bne @lockSquare
81+
lda practiseType
82+
cmp #MODE_LOWSTACK
83+
bne @notAboveLowStack
84+
jsr checkIfAboveLowStackLine
85+
bcc @notAboveLowStack
86+
ldx #<lowStackNopeGraphic
87+
ldy #>lowStackNopeGraphic
88+
lda lowStackRow
89+
cmp #$09
90+
bcs @drawOnUpperHalf
91+
; draw on lower half
92+
adc #$03 ; carry already clear
93+
bne @copyGraphic
94+
@drawOnUpperHalf:
95+
sbc #$04 ; carry already set
96+
@copyGraphic:
97+
jsr copyGraphicToPlayfieldAtCustomRow
98+
jmp @gameOver
99+
@notAboveLowStack:
81100
lda #$00
82101
sta lineIndex
83102
jsr updatePlayfield

src/playstate/preparenext.asm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ copyGraphicToPlayfieldAtCustomRow:
112112
rts
113113

114114
; $28 is ! in game tileset
115+
lowStackNopeGraphic:
116+
.byte "N","O","P","E",$FF,$28,$00
115117
haltEndingGraphic:
116118
.byte $FF,'G','G',$FF,$28,$00
117119
typebSuccessGraphic:

src/playstate/util.asm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,22 @@ updateMusicSpeed:
114114
jsr setMusicTrack
115115
@ret: rts
116116

117+
checkIfAboveLowStackLine:
118+
; carry set - block found
119+
ldx lowStackRow
120+
lda multBy10Table,x
121+
tay
122+
ldx #$0A
123+
sec
124+
@checkForBlockInRow:
125+
lda playfield,y
126+
bpl @foundBlockInRow
127+
iny
128+
dex
129+
bne @checkForBlockInRow
130+
clc
131+
@foundBlockInRow:
132+
rts
117133

118134
; canon is adjustMusicSpeed
119135
setMusicTrack:

0 commit comments

Comments
 (0)