Skip to content

Commit 18b09db

Browse files
Merge pull request #75 from zohassadar/lowstack
low stack mode
2 parents 33f808e + 86b8d72 commit 18b09db

File tree

11 files changed

+74
-3
lines changed

11 files changed

+74
-3
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
@@ -23,6 +23,7 @@
2323
* [Garbage](#garbage)
2424
* [Drought](#drought)
2525
* [DAS Delay](#das-delay)
26+
* [Low Stack](#low-stack)
2627
* [Double Killscreen](#double-killscreen)
2728
* [Invisible](#invisible)
2829
* [Hard Drop](#hard-drop)
@@ -204,6 +205,12 @@ Create artificially inflated droughts. Increasing the value causes less I pieces
204205

205206
Change the auto-shift delay rate.
206207

208+
### Low Stack
209+
210+
![Low-Stack](./assets/screens/lowstack.png)
211+
212+
Choose a height limit for your stack and stay below or else it's game over.
213+
207214
### Double Killscreen
208215

209216
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
@@ -78,6 +79,7 @@ MODE_CHECKERBOARD
7879
MODE_GARBAGE
7980
MODE_DROUGHT
8081
MODE_DAS
82+
MODE_LOWSTACK
8183
MODE_KILLX2
8284
MODE_INVISIBLE
8385
MODE_HARDDROP
@@ -144,6 +146,7 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
144146
.byte $4 ; MODE_GARBAGE
145147
.byte $12 ; MODE_DROUGHT
146148
.byte $10 ; MODE_DAS
149+
.byte $0F ; MODE_LOWSTACK
147150
.byte $0 ; MODE_KILLX2
148151
.byte $0 ; MODE_INVISIBLE
149152
.byte $0 ; MODE_HARDDROP
@@ -181,6 +184,7 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
181184
.byte "GARBGE"
182185
.byte "LOBARS"
183186
.byte "DASDLY"
187+
.byte "LOSTAK"
184188
.byte "KILLX2"
185189
.byte "INVZBL"
186190
.byte "HRDDRP"

src/nametables/game_type_menu.js

Lines changed: 2 additions & 1 deletion
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 STRICT CRASH 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 renderFlags ; Flag needed to reveal hidden score
66
ora #RENDER_SCORE
77
sta renderFlags
@@ -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)