Skip to content

Commit cd3fdf1

Browse files
committed
add condition to reset mmc1 macro, add constant
1 parent cb628ff commit cd3fdf1

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/io.asm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ KB_MASK := $1E
4545
MMC1_Control := $8000
4646
MMC1_CHR0 := $BFFF
4747
MMC1_CHR1 := $DFFF
48+
MMC1_PRG := $FFFF
4849

4950
MMC3_BANK_SELECT := $8000
5051
MMC3_BANK_DATA := $8001
@@ -61,7 +62,7 @@ MMC5_CHR_BANK0 := $5123 ; 4kb page index
6162
MMC5_CHR_BANK1 := $5127
6263

6364
.macro RESET_MMC1
64-
.if INES_MAPPER = 1
65+
.if INES_MAPPER = 0 .or INES_MAPPER = 1
6566
: inc :- ; increments inc ($aa), writing a negative value to prg
6667
; https://www.nesdev.org/wiki/MMC1#Reset
6768
.endif

src/reset.asm

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ mapperInit:
5555
; autodetect
5656
.if INES_MAPPER = 0
5757
setMMC1PRG ; initialize mmc1 just in case
58+
; cnrom can pass one of these tests but not both.
59+
; Start with the one it's supposed to fail.
5860
jsr testVerticalMirroring
59-
bne not_mmc1 ; cnrom should bail here
60-
jsr testHorizontalMirroring ; Test again in case of cnrom miswire
61+
bne not_mmc1
62+
jsr testHorizontalMirroring
6163
bne not_mmc1
6264
inc mapperId ; 1 for MMC1, otherwise 0 for CNROM
6365
not_mmc1:
@@ -99,9 +101,3 @@ not_mmc1:
99101
stx MMC5_RAM_PROTECT1 ; 2: enable PRG RAM
100102
.endif
101103
rts
102-
103-
104-
MMC1_PRG:
105-
.byte $00,$00,$00,$00,$00,$00,$00,$00
106-
.byte $00
107-
.byte $00

0 commit comments

Comments
 (0)