File tree Expand file tree Collapse file tree 3 files changed +126
-0
lines changed Expand file tree Collapse file tree 3 files changed +126
-0
lines changed Original file line number Diff line number Diff line change 1+ #include <mapper.h>
2+ #include <stdlib.h>
3+
4+ MAPPER_PRG_ROM_KB (128 );
5+
6+ volatile const char large_array [0x5000 ] = {
7+ [0 ] = 1 , [0x2000 ] = 2 , [0x4000 ] = 3 , [0x4fff ] = 4 };
8+
9+ __attribute__((section (".prg_rom_0" ))) volatile const char bank_0 [0x2000 ] = {
10+ [0 ] = 1 , [0x1fff ] = 2 };
11+ __attribute__((section (".prg_rom_1" ))) volatile const char bank_1 [0x2000 ] = {
12+ [0 ] = 3 , [0x1fff ] = 4 };
13+
14+ int main (void ) {
15+ if ((unsigned )large_array < 0xa000 )
16+ return EXIT_FAILURE ;
17+ if (large_array [0 ] != 1 )
18+ return EXIT_FAILURE ;
19+ if (large_array [0x2000 ] != 2 )
20+ return EXIT_FAILURE ;
21+ if (large_array [0x4000 ] != 3 )
22+ return EXIT_FAILURE ;
23+ if (large_array [0x4fff ] != 4 )
24+ return EXIT_FAILURE ;
25+
26+ if ((unsigned )bank_0 >= 0xa000 )
27+ return EXIT_FAILURE ;
28+ set_prg_8000 (0 );
29+ if (bank_0 [0 ] != 1 )
30+ return EXIT_FAILURE ;
31+ if (bank_0 [0x1fff ] != 2 )
32+ return EXIT_FAILURE ;
33+
34+ if ((unsigned )bank_1 >= 0xa000 )
35+ return EXIT_FAILURE ;
36+ set_prg_bank (1 , (unsigned )bank_1 >> 8 );
37+ if (bank_1 [0 ] != 3 )
38+ return EXIT_FAILURE ;
39+ if (bank_1 [0x1fff ] != 4 )
40+ return EXIT_FAILURE ;
41+ return EXIT_SUCCESS ;
42+ }
Original file line number Diff line number Diff line change 1+ #include <mapper.h>
2+ #include <stdlib.h>
3+
4+ MAPPER_PRG_ROM_KB (256 );
5+
6+ volatile const char large_array [0x5000 ] = {
7+ [0 ] = 1 , [0x2000 ] = 2 , [0x4000 ] = 3 , [0x4fff ] = 4 };
8+
9+ __attribute__((section (".prg_rom_0" ))) volatile const char bank_0 [0x2000 ] = {
10+ [0 ] = 1 , [0x1fff ] = 2 };
11+ __attribute__((section (".prg_rom_1" ))) volatile const char bank_1 [0x2000 ] = {
12+ [0 ] = 3 , [0x1fff ] = 4 };
13+
14+ int main (void ) {
15+ if ((unsigned )large_array < 0xa000 )
16+ return EXIT_FAILURE ;
17+ if (large_array [0 ] != 1 )
18+ return EXIT_FAILURE ;
19+ if (large_array [0x2000 ] != 2 )
20+ return EXIT_FAILURE ;
21+ if (large_array [0x4000 ] != 3 )
22+ return EXIT_FAILURE ;
23+ if (large_array [0x4fff ] != 4 )
24+ return EXIT_FAILURE ;
25+
26+ if ((unsigned )bank_0 >= 0xa000 )
27+ return EXIT_FAILURE ;
28+ set_prg_8000 (0 );
29+ if (bank_0 [0 ] != 1 )
30+ return EXIT_FAILURE ;
31+ if (bank_0 [0x1fff ] != 2 )
32+ return EXIT_FAILURE ;
33+
34+ if ((unsigned )bank_1 >= 0xa000 )
35+ return EXIT_FAILURE ;
36+ set_prg_bank (1 , (unsigned )bank_1 >> 8 );
37+ if (bank_1 [0 ] != 3 )
38+ return EXIT_FAILURE ;
39+ if (bank_1 [0x1fff ] != 4 )
40+ return EXIT_FAILURE ;
41+ return EXIT_SUCCESS ;
42+ }
Original file line number Diff line number Diff line change 1+ #include <mapper.h>
2+ #include <stdlib.h>
3+
4+ MAPPER_PRG_ROM_KB (64 );
5+
6+ volatile const char large_array [0x5000 ] = {
7+ [0 ] = 1 , [0x2000 ] = 2 , [0x4000 ] = 3 , [0x4fff ] = 4 };
8+
9+ __attribute__((section (".prg_rom_0" ))) volatile const char bank_0 [0x2000 ] = {
10+ [0 ] = 1 , [0x1fff ] = 2 };
11+ __attribute__((section (".prg_rom_1" ))) volatile const char bank_1 [0x2000 ] = {
12+ [0 ] = 3 , [0x1fff ] = 4 };
13+
14+ int main (void ) {
15+ if ((unsigned )large_array < 0xa000 )
16+ return EXIT_FAILURE ;
17+ if (large_array [0 ] != 1 )
18+ return EXIT_FAILURE ;
19+ if (large_array [0x2000 ] != 2 )
20+ return EXIT_FAILURE ;
21+ if (large_array [0x4000 ] != 3 )
22+ return EXIT_FAILURE ;
23+ if (large_array [0x4fff ] != 4 )
24+ return EXIT_FAILURE ;
25+
26+ if ((unsigned )bank_0 >= 0xa000 )
27+ return EXIT_FAILURE ;
28+ set_prg_8000 (0 );
29+ if (bank_0 [0 ] != 1 )
30+ return EXIT_FAILURE ;
31+ if (bank_0 [0x1fff ] != 2 )
32+ return EXIT_FAILURE ;
33+
34+ if ((unsigned )bank_1 >= 0xa000 )
35+ return EXIT_FAILURE ;
36+ set_prg_bank (1 , (unsigned )bank_1 >> 8 );
37+ if (bank_1 [0 ] != 3 )
38+ return EXIT_FAILURE ;
39+ if (bank_1 [0x1fff ] != 4 )
40+ return EXIT_FAILURE ;
41+ return EXIT_SUCCESS ;
42+ }
You can’t perform that action at this time.
0 commit comments