Skip to content

Commit fca425f

Browse files
Merge pull request #96 from zohassadar/darkmode_toggle
Small optimizations
2 parents d7cf62c + b13be94 commit fca425f

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/gamemodestate/initbackground.asm

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -262,21 +262,20 @@ darkBuffer := playfield ; cleared right after in initGameState
262262
sta PPUADDR
263263
lda PPUDATA
264264

265-
ldx #0
265+
ldx #15
266266
@copyToBuffer:
267267
lda PPUDATA
268268
sta darkBuffer, x
269-
inx
270-
cpx #16
271-
bne @copyToBuffer
269+
dex
270+
bpl @copyToBuffer
272271

273272
; reset PPUADDR
274273
lda tmpX
275274
sta PPUADDR
276275
lda tmpY
277276
sta PPUADDR
278277

279-
ldx #0
278+
ldx #15
280279
@copyToNametable:
281280
lda darkBuffer, x
282281

@@ -297,9 +296,8 @@ darkBuffer := playfield ; cleared right after in initGameState
297296
:
298297

299298
sta PPUDATA
300-
inx
301-
cpx #16
302-
bne @copyToNametable
299+
dex
300+
bpl @copyToNametable
303301

304302
clc
305303
lda tmpY
@@ -309,9 +307,6 @@ darkBuffer := playfield ; cleared right after in initGameState
309307
inc tmpX
310308
@noverflow:
311309

312-
sec
313-
lda tmpZ
314-
sbc #1
315-
sta tmpZ
310+
dec tmpZ
316311
bne @processChunk
317312
rts

0 commit comments

Comments
 (0)