Skip to content

Commit 2e9e206

Browse files
committed
NES GTROM cannot use CHR-ROM
Mesen will detect MMC1 if CHR-ROM is present, since there is a conflict for mapper 111 with a Chinese fan translation of Ninja Gaiden.
1 parent 52419cd commit 2e9e206

File tree

6 files changed

+18
-57
lines changed

6 files changed

+18
-57
lines changed

mos-platform/nes-gtrom/common.ld

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@
22

33
INCLUDE nes.ld
44

5-
ASSERT(__prg_rom_size <= 512,
6-
"GTROM only supports up to 512 KiB of PRG.")
5+
ASSERT(__prg_rom_size <= 512, "GTROM only supports up to 512 KiB of PRG.")
76

8-
ASSERT(__chr_rom_size <= 16,
9-
"GTROM only supports up to 16 KiB of CHR-ROM.")
107
ASSERT(__chr_ram_size + __chr_nvram_size <= 16,
118
"GTROM only supports up to 16 KiB of CHR-(NV)RAM.")
129

13-
ASSERT(__prg_ram_size == 0,
14-
"GTROM does not support PRG-RAM")
15-
ASSERT(__prg_nvram_size == 0,
16-
"GTROM does not support PRG-NVRAM")
10+
ASSERT(__prg_ram_size == 0, "GTROM does not support PRG-RAM")
11+
ASSERT(__prg_nvram_size == 0, "GTROM does not support PRG-NVRAM")

mos-platform/nes-gtrom/ines.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
__mapper = 111
55

66
; GTROM boards come with CHR-RAM by default.
7-
; Setting this to 0 gives CHR-ROM.
87
.weak __chr_ram_size
98
__chr_ram_size = 16
10-
.weak __chr_rom_size
9+
10+
.globl __chr_rom_size
1111
__chr_rom_size = 0

test/nes-gtrom/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ project(test-nes-gtrom LANGUAGES C)
55
include(../test.cmake)
66

77
add_nes_test(chr-ram)
8-
add_nes_test(chr-rom)
98
add_nes_test(chr-swap-split)
109
add_nes_test(minimal)
1110
add_nes_test(prg-rom-512)

test/nes-gtrom/chr-ram.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
#include <peekpoke.h>
44
#include <stdlib.h>
55

6-
MAPPER_CHR_ROM_KB(0);
7-
MAPPER_CHR_RAM_KB(16);
8-
96
void poke_ppu(unsigned addr, char val) {
107
PPU.vram.address = addr >> 8;
118
PPU.vram.address = (char)addr;

test/nes-gtrom/chr-rom.c

Lines changed: 0 additions & 35 deletions
This file was deleted.

test/nes-gtrom/chr-swap-split.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
#include <peekpoke.h>
44
#include <stdlib.h>
55

6-
MAPPER_CHR_ROM_KB(16);
7-
MAPPER_CHR_RAM_KB(0);
8-
9-
__attribute__((used, section(".chr_rom_0")))
10-
const char cr0[8192] = {1, [8191] = 2};
11-
__attribute__((used, section(".chr_rom_1")))
12-
const char cr1[8192] = {3, [8191] = 4};
13-
146
volatile char frame_count;
157

168
asm(".section .nmi,\"axR\",@progbits\n"
@@ -22,6 +14,12 @@ void ppu_wait_vblank(void) {
2214
;
2315
}
2416

17+
char write_ppu(unsigned addr, char val) {
18+
PPU.vram.address = addr >> 8;
19+
PPU.vram.address = (char)addr;
20+
PPU.vram.data = val;
21+
}
22+
2523
char read_ppu(unsigned ppu_addr) {
2624
(void)PPU.status;
2725
PPU.vram.address = (unsigned)ppu_addr >> 8;
@@ -31,6 +29,13 @@ char read_ppu(unsigned ppu_addr) {
3129
}
3230

3331
int main(void) {
32+
set_chr_bank(0);
33+
write_ppu(0, 1);
34+
write_ppu(8191, 2);
35+
set_chr_bank(3);
36+
write_ppu(0, 3);
37+
write_ppu(8191, 4);
38+
3439
// Enable NMI generation.
3540
PPU.control = 0x80;
3641

0 commit comments

Comments
 (0)