Skip to content

Commit

Permalink
Get rid of the "SPECIAL" mirroring enum.
Browse files Browse the repository at this point in the history
Just check whether the mapper has defined read_nt() and write_nt()
functions instead.
  • Loading branch information
ulfalizer committed May 16, 2015
1 parent c0d5133 commit 8f4406c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion include/mapper.h
Expand Up @@ -66,7 +66,6 @@ extern enum Mirroring {
ONE_SCREEN_LOW = 2,
ONE_SCREEN_HIGH = 3,
FOUR_SCREEN = 4,
SPECIAL = 5, // Mapper-specific special mirroring

N_MIRRORING_MODES
} mirroring;
Expand Down
1 change: 0 additions & 1 deletion src/mapper_5.cpp
Expand Up @@ -202,7 +202,6 @@ void mapper_5_init() {

prg_mode = chr_mode = 3;
wram_6000_bank = 7;
set_mirroring(SPECIAL);
mmc5_mirroring = 0xFF;
high_chr_bits = 0;
multiplicand = multiplier = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/ppu.cpp
Expand Up @@ -178,13 +178,13 @@ static uint16_t get_mirrored_addr(uint16_t addr) {
}

static uint8_t read_nt(uint16_t addr) {
return (mirroring == SPECIAL) ?
mapper_fns.read_nt(addr) :
ciram[get_mirrored_addr(addr)];
return mapper_fns.read_nt ?
mapper_fns.read_nt(addr) :
ciram[get_mirrored_addr(addr)];
}

static void write_nt(uint16_t addr, uint8_t val) {
if (mirroring == SPECIAL)
if (mapper_fns.write_nt)
mapper_fns.write_nt(val, addr);
else
ciram[get_mirrored_addr(addr)] = val;
Expand Down
3 changes: 1 addition & 2 deletions src/rom.cpp
Expand Up @@ -41,8 +41,7 @@ char const *const mirroring_to_str[N_MIRRORING_MODES] =
"vertical",
"one-screen, low",
"one-screen, high",
"four-screen",
"special (internal error - should never get this here)" };
"four-screen" };

static void do_rom_specific_overrides();

Expand Down

0 comments on commit 8f4406c

Please sign in to comment.