Skip to content

Commit 7648a7a

Browse files
committed
low stack mode
1 parent 5979fa2 commit 7648a7a

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
@@ -4,6 +4,7 @@
44
* Crunch Mode
55
* Marathon Mode
66
* Hidden Score Mode
7+
* Low Stack Mode
78
* M Score changed to Classic Scoring + Millions counter
89
* Invisible linecap turns entire playfield invisible
910
* 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)
@@ -220,6 +221,12 @@ Create artificially inflated droughts. Increasing the value causes less I pieces
220221

221222
Change the auto-shift delay rate.
222223

224+
### Low Stack
225+
226+
![Low-Stack](./assets/screens/lowstack.png)
227+
228+
Choose a height limit for your stack and stay below or else it's game over.
229+
223230
### Double Killscreen
224231

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

assets/screens/lowstack.png

4.76 KB
Loading

src/chr/game_tileset.png

-21.8 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
@@ -129,6 +131,7 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
129131
.byte $4 ; MODE_GARBAGE
130132
.byte $12 ; MODE_DROUGHT
131133
.byte $10 ; MODE_DAS
134+
.byte $0F ; MODE_LOWSTACK
132135
.byte $0 ; MODE_KILLX2
133136
.byte $0 ; MODE_INVISIBLE
134137
.byte $0 ; MODE_HARDDROP
@@ -164,6 +167,7 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
164167
.byte "GARBGE"
165168
.byte "LOBARS"
166169
.byte "DASDLY"
170+
.byte "LOSTAK"
167171
.byte "KILLX2"
168172
.byte "INVZBL"
169173
.byte "HRDDRP"

src/nametables/game_type_menu.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ drawTiles(buffer, lookup, `
5959
#a GARBAGE d#
6060
#a DROUGHT d#
6161
#a DAS DELAY d#
62+
#a LOW STACK d#
6263
#a KILLSCREEN »2 d#
6364
#a INVISIBLE d#
6465
#a HARD DROP d#
65-
#a TAP/ROLL SPEED d#
6666
`);drawTiles(extra, lookup, `
67+
#a TAP/ROLL SPEED d#
6768
#a SCORING d#
6869
#a HZ DISPLAY d#
6970
#a INPUT DISPLAY d#
@@ -76,7 +77,6 @@ drawTiles(buffer, lookup, `
7677
#a QUAL MODE d#
7778
#a PAL MODE d#
7879
#a d#
79-
#a d#
8080
#a V5 d#
8181
#a d#
8282
#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
@@ -103,6 +103,8 @@ copyGraphicToPlayfieldAtCustomRow:
103103
rts
104104

105105
; $28 is ! in game tileset
106+
lowStackNopeGraphic:
107+
.byte "N","O","P","E",$FF,$28,$00
106108
haltEndingGraphic:
107109
.byte $FF,"G","G",$FF,$28,$00
108110
typebSuccessGraphic:

src/playstate/util.asm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,22 @@ updateMusicSpeed:
111111
jsr setMusicTrack
112112
@ret: rts
113113

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

115131
; canon is adjustMusicSpeed
116132
setMusicTrack:

0 commit comments

Comments
 (0)