mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-11 17:29:57 +00:00
Corrected for use with the latest EightBit library.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
757d8f3c32
commit
53461e712f
@ -59,8 +59,8 @@ namespace EightBit {
|
|||||||
int runVerticalBlankLines();
|
int runVerticalBlankLines();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual uint8_t& reference(uint16_t address, bool& rom);
|
virtual uint8_t& reference(uint16_t address);
|
||||||
virtual uint8_t reference(uint16_t address, bool& rom) const;
|
virtual uint8_t reference(uint16_t address) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LR35902 m_cpu;
|
LR35902 m_cpu;
|
||||||
|
@ -149,9 +149,8 @@ void EightBit::GameBoy::Bus::validateCartridgeType() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t EightBit::GameBoy::Bus::reference(uint16_t address, bool& rom) const {
|
uint8_t EightBit::GameBoy::Bus::reference(uint16_t address) const {
|
||||||
|
|
||||||
rom = true;
|
|
||||||
if ((address < 0x100) && IO().bootRomEnabled())
|
if ((address < 0x100) && IO().bootRomEnabled())
|
||||||
return m_bootRom.reference(address);
|
return m_bootRom.reference(address);
|
||||||
if ((address < 0x4000) && gameRomEnabled())
|
if ((address < 0x4000) && gameRomEnabled())
|
||||||
@ -159,11 +158,10 @@ uint8_t EightBit::GameBoy::Bus::reference(uint16_t address, bool& rom) const {
|
|||||||
if ((address < 0x8000) && gameRomEnabled())
|
if ((address < 0x8000) && gameRomEnabled())
|
||||||
return m_gameRomBanks[m_romBank].reference(address - 0x4000);
|
return m_gameRomBanks[m_romBank].reference(address - 0x4000);
|
||||||
|
|
||||||
rom = false;
|
|
||||||
if (address < 0xa000)
|
if (address < 0xa000)
|
||||||
return VRAM().reference(address - 0x8000);
|
return VRAM().reference(address - 0x8000);
|
||||||
if (address < 0xc000)
|
if (address < 0xc000)
|
||||||
return m_ramBanks.size() == 0 ? rom = true, 0xff : m_ramBanks[m_ramBank].reference(address - 0xa000);
|
return m_ramBanks.size() == 0 ? 0xff : m_ramBanks[m_ramBank].reference(address - 0xa000);
|
||||||
if (address < 0xe000)
|
if (address < 0xe000)
|
||||||
return m_lowInternalRam.reference(address - 0xc000);
|
return m_lowInternalRam.reference(address - 0xc000);
|
||||||
if (address < 0xfe00)
|
if (address < 0xfe00)
|
||||||
@ -171,15 +169,14 @@ uint8_t EightBit::GameBoy::Bus::reference(uint16_t address, bool& rom) const {
|
|||||||
if (address < 0xfea0)
|
if (address < 0xfea0)
|
||||||
return OAMRAM().reference(address - 0xfe00);
|
return OAMRAM().reference(address - 0xfe00);
|
||||||
if (address < IoRegisters::BASE)
|
if (address < IoRegisters::BASE)
|
||||||
return rom = true, 0xff;
|
return 0xff;
|
||||||
if (address < 0xff80)
|
if (address < 0xff80)
|
||||||
return IO().reference(address - IoRegisters::BASE);
|
return IO().reference(address - IoRegisters::BASE);
|
||||||
return m_highInternalRam.reference(address - 0xff80);
|
return m_highInternalRam.reference(address - 0xff80);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t& EightBit::GameBoy::Bus::reference(uint16_t address, bool& rom) {
|
uint8_t& EightBit::GameBoy::Bus::reference(uint16_t address) {
|
||||||
|
|
||||||
rom = true;
|
|
||||||
if ((address < 0x100) && IO().bootRomEnabled())
|
if ((address < 0x100) && IO().bootRomEnabled())
|
||||||
return DATA() = m_bootRom.reference(address);
|
return DATA() = m_bootRom.reference(address);
|
||||||
if ((address < 0x4000) && gameRomEnabled())
|
if ((address < 0x4000) && gameRomEnabled())
|
||||||
@ -187,11 +184,10 @@ uint8_t& EightBit::GameBoy::Bus::reference(uint16_t address, bool& rom) {
|
|||||||
if ((address < 0x8000) && gameRomEnabled())
|
if ((address < 0x8000) && gameRomEnabled())
|
||||||
return DATA() = m_gameRomBanks[m_romBank].reference(address - 0x4000);
|
return DATA() = m_gameRomBanks[m_romBank].reference(address - 0x4000);
|
||||||
|
|
||||||
rom = false;
|
|
||||||
if (address < 0xa000)
|
if (address < 0xa000)
|
||||||
return VRAM().reference(address - 0x8000);
|
return VRAM().reference(address - 0x8000);
|
||||||
if (address < 0xc000)
|
if (address < 0xc000)
|
||||||
return m_ramBanks.size() == 0 ? rom = true, DATA() = 0xff : m_ramBanks[m_ramBank].reference(address - 0xa000);
|
return m_ramBanks.size() == 0 ? DATA() = 0xff : m_ramBanks[m_ramBank].reference(address - 0xa000);
|
||||||
if (address < 0xe000)
|
if (address < 0xe000)
|
||||||
return m_lowInternalRam.reference(address - 0xc000);
|
return m_lowInternalRam.reference(address - 0xc000);
|
||||||
if (address < 0xfe00)
|
if (address < 0xfe00)
|
||||||
@ -199,7 +195,7 @@ uint8_t& EightBit::GameBoy::Bus::reference(uint16_t address, bool& rom) {
|
|||||||
if (address < 0xfea0)
|
if (address < 0xfea0)
|
||||||
return OAMRAM().reference(address - 0xfe00);
|
return OAMRAM().reference(address - 0xfe00);
|
||||||
if (address < IoRegisters::BASE)
|
if (address < IoRegisters::BASE)
|
||||||
return rom = true, DATA() = 0xff;
|
return DATA() = 0xff;
|
||||||
if (address < 0xff80)
|
if (address < 0xff80)
|
||||||
return IO().reference(address - IoRegisters::BASE);
|
return IO().reference(address - IoRegisters::BASE);
|
||||||
return m_highInternalRam.reference(address - 0xff80);
|
return m_highInternalRam.reference(address - 0xff80);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user