Skip to content

Commit 134c178

Browse files
committed
Add missed test files
1 parent 623c138 commit 134c178

File tree

3 files changed

+126
-0
lines changed

3 files changed

+126
-0
lines changed

test/nes-mmc3/banked-8-128k.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
}

test/nes-mmc3/banked-8-256k.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
}

test/nes-mmc3/banked-8-64k.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
}

0 commit comments

Comments
 (0)