Skip to content

Commit 825db19

Browse files
committed
feature: dark mode
1 parent 72b0fd8 commit 825db19

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

src/gamemodestate/initbackground.asm

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ gameModeState_initGameBackground:
1212
jsr copyRleNametableToPpu
1313
.addr game_nametable
1414
jsr scoringBackground
15+
jsr drawDarkMode
1516

1617
lda hzFlag
1718
beq @noHz
@@ -249,3 +250,72 @@ savestate_nametable_patch:
249250
.byte $23,$17,$3B,$1C,$15,$18,$1D,$FF,$FF,$3C,$FE
250251
.byte $23,$37,$3B,$FF,$FF,$FF,$FF,$FF,$FF,$3C,$FE
251252
.byte $23,$57,$3D,$3E,$3E,$3E,$3E,$3E,$3E,$3F,$FD
253+
254+
drawDarkMode:
255+
lda currentPpuCtrl
256+
and #%11111011
257+
sta tmp1
258+
ldx #$00
259+
@darkLoop:
260+
lda darkmode_stripes,x
261+
beq @ret
262+
sta PPUADDR
263+
inx
264+
lda darkmode_stripes,x
265+
sta PPUADDR
266+
inx
267+
lda darkmode_stripes,x
268+
lsr
269+
tay
270+
lda #$00
271+
rol
272+
asl
273+
asl
274+
ora tmp1
275+
sta PPUCTRL
276+
lda #$FF
277+
@darkTiles:
278+
sta PPUDATA
279+
dey
280+
bne @darkTiles
281+
inx
282+
bne @darkLoop
283+
@ret:
284+
lda currentPpuCtrl
285+
sta PPUCTRL
286+
rts
287+
288+
289+
drawHorz = $00
290+
drawVert = $01
291+
292+
darkmode_stripes:
293+
.byte $20,$00
294+
.byte 75 << 1 | drawHorz
295+
.byte $20,$60
296+
.byte 24 << 1 | drawVert
297+
.byte $20,$61
298+
.byte 03 << 1 | drawVert
299+
.byte $20,$6A
300+
.byte 05 << 1 | drawVert
301+
.byte $20,$5F
302+
.byte 21 << 1 | drawVert
303+
.byte $20,$C1
304+
.byte 09 << 1 | drawHorz
305+
.byte $20,$E1
306+
.byte 09 << 1 | drawHorz
307+
.byte $21,$77
308+
.byte 08 << 1 | drawHorz
309+
.byte $21,$9D
310+
.byte 07 << 1 | drawVert
311+
.byte $21,$7E
312+
.byte 12 << 1 | drawVert
313+
.byte $22,$F7
314+
.byte 09 << 1 | drawHorz
315+
.byte $23,$17
316+
.byte 09 << 1 | drawHorz
317+
.byte $23,$37
318+
.byte 09 << 1 | drawHorz
319+
.byte $23,$57
320+
.byte 105 << 1 | drawHorz
321+
.byte $00

0 commit comments

Comments
 (0)