Skip to content

Commit 75f93cd

Browse files
Merge pull request #88 from zohassadar/pal181
Save bytes rendering pal 181
2 parents 7380f5a + 7bb70e5 commit 75f93cd

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

src/nmi/render_mode_play_and_demo.asm

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,12 @@ updatePaletteForLevel:
323323
@copyPalettes:
324324
and #$3F
325325
tax
326+
lda palFlag
327+
beq @renderPalettes
328+
cpx #(181 & $3F)
329+
bne @renderPalettes
330+
ldx #$40
331+
@renderPalettes:
326332
lda #$3F
327333
sta PPUADDR
328334
lda #$09
@@ -343,24 +349,6 @@ updatePaletteForLevel:
343349
sta PPUDATA
344350
lda colorTable2,x
345351
sta PPUDATA
346-
; PAL level 181 is a different colour because of an address change
347-
lda palFlag
348-
beq @done
349-
lda levelNumber
350-
cmp #181
351-
bne @done
352-
lda #$3F
353-
sta PPUADDR
354-
lda #$09
355-
sta PPUADDR
356-
lda #$21
357-
sta PPUDATA
358-
lda #$3F
359-
sta PPUADDR
360-
lda #$19
361-
sta PPUADDR
362-
lda #$21
363-
sta PPUDATA
364352
@done:
365353
rts
366354

@@ -382,6 +370,7 @@ colorTable0:
382370
.byte $17,$47,$29,$19
383371
.byte $06,$4C,$BD,$19
384372
.byte $00,$01,$03,$05
373+
.byte $21 ; level 181 pal (different from NTSC)
385374

386375
colorTable1:
387376
.byte $21,$29,$24,$2A
@@ -400,6 +389,7 @@ colorTable1:
400389
.byte $A0,$AB,$07,$C9
401390
.byte $38,$2A,$4E,$60
402391
.byte $00,$01,$04,$05
392+
.byte $2b ; level 181 pal (same as NTSC)
403393

404394
colorTable2:
405395
.byte $12,$1A,$14,$12
@@ -418,6 +408,7 @@ colorTable2:
418408
.byte $02,$A5,$18,$07
419409
.byte $E9,$99,$99,$00
420410
.byte $01,$02,$04,$05
411+
.byte $25 ; level 181 pal (same as NTSC)
421412

422413
incrementPieceStat:
423414
tax

0 commit comments

Comments
 (0)