summaryrefslogtreecommitdiff
path: root/mapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'mapper.c')
-rw-r--r--mapper.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/mapper.c b/mapper.c
index 4fb8346..2e27304 100644
--- a/mapper.c
+++ b/mapper.c
@@ -1,21 +1,21 @@
-#include "mapper_nrom.c"
+#include "mapper_001.c"
// #include "mapper_mmc1.c"
// #include "mapper_uxrom.c"
-#include "mapper_gxrom.c"
+#include "mapper_066.c"
struct mapper_entry {
- int id;
- uint8_t (*read)(struct nes_state *state, uint32_t addr);
- void (*write)(struct nes_state *state, uint32_t addr, uint8_t value);
- void (*tick)(struct nes_state *state);
- void (*init)(struct nes_state *state);
+ int id;
+ uint8_t (*read)(struct nes_state *state, uint32_t addr);
+ void (*write)(struct nes_state *state, uint32_t addr, uint8_t value);
+ void (*tick)(struct nes_state *state);
+ void (*init)(struct nes_state *state);
};
static struct mapper_entry mapper_table[] = {
- { 0, mapper_nrom_read, mapper_nrom_write, mapper_nrom_tick, mapper_nrom_init },
- { 66, mapper_66_read, mapper_66_write, mapper_66_tick, mapper_66_init },
+ { 0, mapper_001_read, mapper_001_write, mapper_001_tick, mapper_001_init },
+ { 66, mapper_066_read, mapper_066_write, mapper_066_tick, mapper_066_init },
// { 1, mapper_mmc1_read, ... }, etc
};
@@ -23,7 +23,6 @@ static void mapper_setup(struct nes_state *state) {
uint32_t mapper = state->ines.mapper;
for(uint32_t i = 0; i < sizeof(mapper_table)/sizeof(mapper_table[0]); i++) {
if(mapper_table[i].id == mapper) {
-printf("%d\n", mapper);
state->mapper.read = mapper_table[i].read;
state->mapper.write = mapper_table[i].write;
state->mapper.tick = mapper_table[i].tick;
@@ -33,10 +32,11 @@ printf("%d\n", mapper);
}
}
+ // NOTE(peter): Not sure how safe this is, but it sure is funny...
printf("Unsupported mapper %d, falling back to NROM\n", mapper);
- state->mapper.read = mapper_nrom_read;
- state->mapper.write = mapper_nrom_write;
- state->mapper.tick = mapper_nrom_tick;
- state->mapper.init = mapper_nrom_init;
+ state->mapper.read = mapper_001_read;
+ state->mapper.write = mapper_001_write;
+ state->mapper.tick = mapper_001_tick;
+ state->mapper.init = mapper_001_init;
state->mapper.init(state);
}