forked from AndreaOrru/LaiNES
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for iNES Mapper 007 (AxROM), Mirroring
Add support for iNES Mapper 007 (AxROM) which should enable Battletoads and Marble Madness. Add support for one-screen mirroring. (bit broken at the moment)
- Loading branch information
Showing
5 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "ppu.hpp" | ||
#include "mappers/mapper7.hpp" | ||
|
||
/* Based off of https://wiki.nesdev.com/w/index.php/AxROM */ | ||
|
||
/* Apply the registers state */ | ||
void Mapper7::apply() | ||
{ | ||
/* | ||
* 32 kb PRG ROM Banks | ||
* 0x8000 - 0xFFFF swappable | ||
*/ | ||
map_prg<32>(0, regs[0] & 0x7); | ||
|
||
/* 8k of CHR (ram) */ | ||
map_chr<8>(0, 0); | ||
|
||
/* Mirroring based on bit 5 */ | ||
set_mirroring((regs[0] & 0x10) ? PPU::ONE_SCREEN_HI : PPU::ONE_SCREEN_LO); | ||
} | ||
|
||
u8 Mapper7::write(u16 addr, u8 v) | ||
{ | ||
/* check for bus contingency? (addr & 0x8000 == v?) nah */ | ||
|
||
/* bank switching */ | ||
if (addr & 0x8000) | ||
{ | ||
regs[0] = v; | ||
apply(); | ||
} | ||
return v; | ||
} | ||
|
||
u8 Mapper7::chr_write(u16 addr, u8 v) | ||
{ | ||
return chr[addr] = v; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
#include "mapper.hpp" | ||
#include "ppu.hpp" | ||
|
||
class Mapper7 : public Mapper | ||
{ | ||
u8 regs[1]; | ||
void apply(); | ||
|
||
public: | ||
Mapper7(u8* rom) : Mapper(rom) | ||
{ | ||
regs[0] = 0; | ||
apply(); | ||
} | ||
|
||
u8 write(u16 addr, u8 v); | ||
u8 chr_write(u16 addr, u8 v); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters