File tree Expand file tree Collapse file tree 6 files changed +28
-21
lines changed Expand file tree Collapse file tree 6 files changed +28
-21
lines changed Original file line number Diff line number Diff line change 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
-
3
1
# TetrisGYM
4
2
5
3
<div align =" center " >
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ compile_flags=()
5
5
help () {
6
6
echo " Usage: $0 [-v] [-m <1|3>] [-a] [-s] [-k] [-h]"
7
7
echo " -v Enable verbose output"
8
- echo " -m Set mapper. Valid values are 1 and 3 . Default 1."
8
+ echo " -m Set mapper. Valid values are 1, 3 and 4 . Default 1."
9
9
echo " -a Enable pressing select to end game"
10
10
echo " -s Disable saving of high scores"
11
11
echo " -k Enable Famicom Keyboard support"
@@ -17,7 +17,7 @@ while getopts "vm:askh" flag; do
17
17
v) set -x ;;
18
18
m)
19
19
if ! [[ " ${OPTARG} " =~ ^[134]$ ]]; then
20
- echo " Valid INES_MAPPER (-m) options are 1 or 3 "
20
+ echo " Valid INES_MAPPER (-m) options are 1, 3 or 4 "
21
21
exit 1
22
22
fi
23
23
compile_flags+=(" -D INES_MAPPER=${OPTARG} " )
Original file line number Diff line number Diff line change @@ -18,8 +18,9 @@ gameMode_gameTypeMenu:
18
18
jsr changeCHRBank1
19
19
.endif
20
20
.if INES_MAPPER = 4
21
+ ; Horizontal mirroring
21
22
lda #$1
22
- sta $A000
23
+ sta MMC3_MIRRORING
23
24
.endif
24
25
lda #%10011 ; used to be $10 (enable horizontal mirroring)
25
26
jsr setMMC1Control
Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ gameModeState_initGameBackground:
47
47
lda #%10011000
48
48
sta PPUCTRL
49
49
sta currentPpuCtrl
50
+ .elseif INES_MAPPER = 4
51
+ ; Vertical mirroring (Prevents screen glitching)
52
+ lda #$0
53
+ sta MMC3_MIRRORING
50
54
.endif
51
55
jsr resetScroll
52
56
jsr waitForVBlankAndEnableNmi
Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ MMC1_Control := $8000
46
46
MMC1_CHR0 := $ BFFF
47
47
MMC1_CHR1 := $ DFFF
48
48
49
+ MMC3_BANK_SELECT := $ 8000
50
+ MMC3_BANK_DATA := $ 8001
51
+ MMC3_MIRRORING := $ A000
52
+
49
53
.macro RESET_MMC1
50
54
.if INES_MAPPER = 1
51
55
inc $ 8000 ; initRam
Original file line number Diff line number Diff line change @@ -315,13 +315,13 @@ changeCHRBank0:
315
315
asl a
316
316
asl a
317
317
ldx #$00
318
- stx $8000
319
- sta $8001
318
+ stx MMC3_BANK_SELECT
319
+ sta MMC3_BANK_DATA
320
320
inx
321
321
clc
322
322
adc #$02
323
- stx $8000
324
- sta $8001
323
+ stx MMC3_BANK_SELECT
324
+ sta MMC3_BANK_DATA
325
325
.endif
326
326
rts
327
327
@@ -340,23 +340,23 @@ changeCHRBank1:
340
340
asl a
341
341
asl a
342
342
ldx #$02
343
- stx $8000
344
- sta $8001
343
+ stx MMC3_BANK_SELECT
344
+ sta MMC3_BANK_DATA
345
345
inx
346
346
clc
347
347
adc #$01
348
- stx $8000
349
- sta $8001
348
+ stx MMC3_BANK_SELECT
349
+ sta MMC3_BANK_DATA
350
350
inx
351
351
clc
352
352
adc #$01
353
- stx $8000
354
- sta $8001
353
+ stx MMC3_BANK_SELECT
354
+ sta MMC3_BANK_DATA
355
355
inx
356
356
clc
357
357
adc #$01
358
- stx $8000
359
- sta $8001
358
+ stx MMC3_BANK_SELECT
359
+ sta MMC3_BANK_DATA
360
360
.endif
361
361
rts
362
362
@@ -375,12 +375,12 @@ changePRGBank:
375
375
asl a
376
376
asl a
377
377
ldx #$06
378
- stx $8000
379
- sta $8001
378
+ stx MMC3_BANK_SELECT
379
+ sta MMC3_BANK_DATA
380
380
inx
381
381
clc
382
382
adc #$01
383
- stx $8000
384
- sta $8001
383
+ stx MMC3_BANK_SELECT
384
+ sta MMC3_BANK_DATA
385
385
.endif
386
386
rts
You can’t perform that action at this time.
0 commit comments