File tree Expand file tree Collapse file tree 6 files changed +18
-57
lines changed
Expand file tree Collapse file tree 6 files changed +18
-57
lines changed Original file line number Diff line number Diff line change 22
33INCLUDE 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." )
107ASSERT(__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" )
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ project(test-nes-gtrom LANGUAGES C)
55include (../test .cmake)
66
77add_nes_test(chr-ram)
8- add_nes_test(chr-rom)
98add_nes_test(chr-swap-split)
109add_nes_test(minimal)
1110add_nes_test(prg-rom-512)
Original file line number Diff line number Diff line change 33#include <peekpoke.h>
44#include <stdlib.h>
55
6- MAPPER_CHR_ROM_KB (0 );
7- MAPPER_CHR_RAM_KB (16 );
8-
96void poke_ppu (unsigned addr , char val ) {
107 PPU .vram .address = addr >> 8 ;
118 PPU .vram .address = (char )addr ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 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-
146volatile char frame_count ;
157
168asm(".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+
2523char 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
3331int 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
You can’t perform that action at this time.
0 commit comments