Skip to content

Commit cb628ff

Browse files
committed
init mmc1 before autodetect
1 parent 28c5926 commit cb628ff

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/reset.asm

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,24 @@ reset: cld
3737
jsr changeCHRBanks
3838
jmp initRam
3939

40+
.macro setMMC1PRG
41+
RESET_MMC1
42+
lda #$00
43+
sta MMC1_PRG
44+
lsr a
45+
sta MMC1_PRG
46+
lsr a
47+
sta MMC1_PRG
48+
lsr a
49+
sta MMC1_PRG
50+
lsr a
51+
sta MMC1_PRG
52+
.endmacro
53+
4054
mapperInit:
4155
; autodetect
4256
.if INES_MAPPER = 0
57+
setMMC1PRG ; initialize mmc1 just in case
4358
jsr testVerticalMirroring
4459
bne not_mmc1 ; cnrom should bail here
4560
jsr testHorizontalMirroring ; Test again in case of cnrom miswire
@@ -49,17 +64,7 @@ not_mmc1:
4964

5065
; MMC1
5166
.elseif INES_MAPPER = 1
52-
RESET_MMC1
53-
lda #$00
54-
sta MMC1_PRG
55-
lsr a
56-
sta MMC1_PRG
57-
lsr a
58-
sta MMC1_PRG
59-
lsr a
60-
sta MMC1_PRG
61-
lsr a
62-
sta MMC1_PRG
67+
setMMC1PRG
6368

6469
; CNROM (no init)
6570
.elseif INES_MAPPER = 3

0 commit comments

Comments
 (0)