Skip to content

Commit 259c33a

Browse files
committed
almost working
1 parent 5bfb260 commit 259c33a

File tree

9 files changed

+56
-7
lines changed

9 files changed

+56
-7
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Toying with MMC3 in this branch. Only problem I'm aware of to solve is a screen flicker during initGameBackground. May come back to this later.
2+
13
# TetrisGYM
24

35
<div align="center">

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ while getopts "vm:askh" flag; do
1616
case "${flag}" in
1717
v) set -x ;;
1818
m)
19-
if ! [[ "${OPTARG}" =~ ^[13]$ ]]; then
19+
if ! [[ "${OPTARG}" =~ ^[134]$ ]]; then
2020
echo "Valid INES_MAPPER (-m) options are 1 or 3"
2121
exit 1
2222
fi

src/chr.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.segment "CHR"
22

3-
.if INES_MAPPER = 1
3+
.if INES_MAPPER = 1 || INES_MAPPER = 4
44
.incbin "chr/title_menu_tileset.chr"
55
.incbin "chr/game_tileset.chr"
66
.incbin "chr/rocket_tileset.chr"

src/gamemode/gametypemenu/menu.asm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ gameMode_gameTypeMenu:
1111
lda #0
1212
sta displayNextPiece
1313
RESET_MMC1
14-
.if INES_MAPPER = 1
14+
.if INES_MAPPER = 1 || INES_MAPPER = 4
1515
; switch to blank charmap
1616
; (stops glitching when resetting)
1717
lda #$03
1818
jsr changeCHRBank1
19+
.endif
20+
.if INES_MAPPER = 4
21+
lda #$1
22+
sta $A000
1923
.endif
2024
lda #%10011 ; used to be $10 (enable horizontal mirroring)
2125
jsr setMMC1Control

src/gamemode/speedtest.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ gameMode_speedTest:
2121
sta PPUADDR
2222
lda #$30
2323
sta PPUDATA
24-
.if INES_MAPPER = 1
24+
.if INES_MAPPER = 1 || INES_MAPPER = 4
2525
lda #$01
2626
jsr changeCHRBank0
2727
lda #$01

src/gamemode/waitscreen.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ waitScreenLoad:
66
sta renderMode
77
jsr updateAudioWaitForNmiAndDisablePpuRendering
88
jsr disableNmi
9-
.if INES_MAPPER = 1
9+
.if INES_MAPPER = 1 || INES_MAPPER = 4
1010
lda #$02
1111
jsr changeCHRBank0
1212
lda #$02

src/gamemodestate/initbackground.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
gameModeState_initGameBackground:
22
jsr updateAudioWaitForNmiAndDisablePpuRendering
33
jsr disableNmi
4-
.if INES_MAPPER = 1
4+
.if INES_MAPPER = 1 || INES_MAPPER = 4
55
lda #$01
66
jsr changeCHRBank0
77
lda #$01

src/playstate/gameover_rocket.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ sleep_gameplay:
7676
endingAnimation: ; rocket_screen
7777
jsr updateAudioWaitForNmiAndDisablePpuRendering
7878
jsr disableNmi
79-
.if INES_MAPPER = 1
79+
.if INES_MAPPER = 1 || INES_MAPPER = 4
8080
lda #$02
8181
jsr changeCHRBank0
8282
lda #$02

src/util/core.asm

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,17 @@ changeCHRBank0:
311311
sta MMC1_CHR0
312312
lsr a
313313
sta MMC1_CHR0
314+
.elseif INES_MAPPER = 4
315+
asl a
316+
asl a
317+
ldx #$00
318+
stx $8000
319+
sta $8001
320+
inx
321+
clc
322+
adc #$02
323+
stx $8000
324+
sta $8001
314325
.endif
315326
rts
316327

@@ -325,6 +336,27 @@ changeCHRBank1:
325336
sta MMC1_CHR1
326337
lsr a
327338
sta MMC1_CHR1
339+
.elseif INES_MAPPER = 4
340+
asl a
341+
asl a
342+
ldx #$02
343+
stx $8000
344+
sta $8001
345+
inx
346+
clc
347+
adc #$01
348+
stx $8000
349+
sta $8001
350+
inx
351+
clc
352+
adc #$01
353+
stx $8000
354+
sta $8001
355+
inx
356+
clc
357+
adc #$01
358+
stx $8000
359+
sta $8001
328360
.endif
329361
rts
330362

@@ -339,5 +371,16 @@ changePRGBank:
339371
sta MMC1_PRG
340372
lsr a
341373
sta MMC1_PRG
374+
.elseif INES_MAPPER = 4
375+
asl a
376+
asl a
377+
ldx #$06
378+
stx $8000
379+
sta $8001
380+
inx
381+
clc
382+
adc #$01
383+
stx $8000
384+
sta $8001
342385
.endif
343386
rts

0 commit comments

Comments
 (0)