diff --git a/mos-platform/nes-gtrom/common.ld b/mos-platform/nes-gtrom/common.ld index 4474581ae..de1de8417 100644 --- a/mos-platform/nes-gtrom/common.ld +++ b/mos-platform/nes-gtrom/common.ld @@ -2,15 +2,10 @@ INCLUDE nes.ld -ASSERT(__prg_rom_size <= 512, - "GTROM only supports up to 512 KiB of PRG.") +ASSERT(__prg_rom_size <= 512, "GTROM only supports up to 512 KiB of PRG.") -ASSERT(__chr_rom_size <= 16, - "GTROM only supports up to 16 KiB of CHR-ROM.") ASSERT(__chr_ram_size + __chr_nvram_size <= 16, "GTROM only supports up to 16 KiB of CHR-(NV)RAM.") -ASSERT(__prg_ram_size == 0, - "GTROM does not support PRG-RAM") -ASSERT(__prg_nvram_size == 0, - "GTROM does not support PRG-NVRAM") +ASSERT(__prg_ram_size == 0, "GTROM does not support PRG-RAM") +ASSERT(__prg_nvram_size == 0, "GTROM does not support PRG-NVRAM") diff --git a/mos-platform/nes-gtrom/ines.s b/mos-platform/nes-gtrom/ines.s index d77dbbabe..960477e91 100644 --- a/mos-platform/nes-gtrom/ines.s +++ b/mos-platform/nes-gtrom/ines.s @@ -4,8 +4,8 @@ __mapper = 111 ; GTROM boards come with CHR-RAM by default. -; Setting this to 0 gives CHR-ROM. .weak __chr_ram_size __chr_ram_size = 16 -.weak __chr_rom_size + +.globl __chr_rom_size __chr_rom_size = 0 diff --git a/test/nes-gtrom/CMakeLists.txt b/test/nes-gtrom/CMakeLists.txt index cf1913d16..95af10489 100644 --- a/test/nes-gtrom/CMakeLists.txt +++ b/test/nes-gtrom/CMakeLists.txt @@ -5,7 +5,6 @@ project(test-nes-gtrom LANGUAGES C) include(../test.cmake) add_nes_test(chr-ram) -add_nes_test(chr-rom) add_nes_test(chr-swap-split) add_nes_test(minimal) add_nes_test(prg-rom-512) diff --git a/test/nes-gtrom/chr-ram.c b/test/nes-gtrom/chr-ram.c index d431e068d..4e9ce1692 100644 --- a/test/nes-gtrom/chr-ram.c +++ b/test/nes-gtrom/chr-ram.c @@ -3,9 +3,6 @@ #include #include -MAPPER_CHR_ROM_KB(0); -MAPPER_CHR_RAM_KB(16); - void poke_ppu(unsigned addr, char val) { PPU.vram.address = addr >> 8; PPU.vram.address = (char)addr; diff --git a/test/nes-gtrom/chr-rom.c b/test/nes-gtrom/chr-rom.c deleted file mode 100644 index cf020dded..000000000 --- a/test/nes-gtrom/chr-rom.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include -#include -#include - -MAPPER_CHR_ROM_KB(16); -MAPPER_CHR_RAM_KB(0); - -__attribute__((used, section(".chr_rom_0"))) -const char cr0[8192] = {1, [8191] = 2}; -__attribute__((used, section(".chr_rom_1"))) -const char cr1[8192] = {3, [8191] = 4}; - -char read_ppu(unsigned ppu_addr) { - (void)PPU.status; - PPU.vram.address = (unsigned)ppu_addr >> 8; - PPU.vram.address = (unsigned)ppu_addr; - (void)PPU.vram.data; - return PPU.vram.data; -} - -int main(void) { - set_chr_bank(0); - if (read_ppu(0) != 1) - return EXIT_FAILURE; - if (read_ppu(8191) != 2) - return EXIT_FAILURE; - - set_chr_bank(1); - if (read_ppu(0) != 3) - return EXIT_FAILURE; - if (read_ppu(8191) != 4) - return EXIT_FAILURE; - return EXIT_SUCCESS; -} diff --git a/test/nes-gtrom/chr-swap-split.c b/test/nes-gtrom/chr-swap-split.c index 12c211787..2fb7392ac 100644 --- a/test/nes-gtrom/chr-swap-split.c +++ b/test/nes-gtrom/chr-swap-split.c @@ -3,14 +3,6 @@ #include #include -MAPPER_CHR_ROM_KB(16); -MAPPER_CHR_RAM_KB(0); - -__attribute__((used, section(".chr_rom_0"))) -const char cr0[8192] = {1, [8191] = 2}; -__attribute__((used, section(".chr_rom_1"))) -const char cr1[8192] = {3, [8191] = 4}; - volatile char frame_count; asm(".section .nmi,\"axR\",@progbits\n" @@ -22,6 +14,12 @@ void ppu_wait_vblank(void) { ; } +char write_ppu(unsigned addr, char val) { + PPU.vram.address = addr >> 8; + PPU.vram.address = (char)addr; + PPU.vram.data = val; +} + char read_ppu(unsigned ppu_addr) { (void)PPU.status; PPU.vram.address = (unsigned)ppu_addr >> 8; @@ -31,6 +29,13 @@ char read_ppu(unsigned ppu_addr) { } int main(void) { + set_chr_bank(0); + write_ppu(0, 1); + write_ppu(8191, 2); + set_chr_bank(3); + write_ppu(0, 3); + write_ppu(8191, 4); + // Enable NMI generation. PPU.control = 0x80;