mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-02-24 17:29:06 +00:00
Because of its boot room, the LR35902 needs a custom clear mechanism.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
787d9dd799
commit
7948962d70
@ -79,6 +79,8 @@ namespace EightBit {
|
||||
|
||||
void reset();
|
||||
|
||||
virtual void clear() override;
|
||||
|
||||
void writeRegister(int offset, uint8_t content) {
|
||||
return Memory::write(BASE + offset, content);
|
||||
}
|
||||
@ -95,10 +97,13 @@ namespace EightBit {
|
||||
writeRegister(LY, 0);
|
||||
}
|
||||
|
||||
void disableBootRom() { m_disableBootRom = true; }
|
||||
void enableBootRom() { m_disableBootRom = false; }
|
||||
|
||||
void loadBootRom(const std::string& path);
|
||||
|
||||
bool isBootRom(uint16_t address) const {
|
||||
return (address < m_boot.size()) && !peek(BASE + BOOT_DISABLE);
|
||||
return !m_disableBootRom && (address < m_boot.size()) && !peek(BASE + BOOT_DISABLE);
|
||||
}
|
||||
|
||||
virtual uint8_t peek(uint16_t address) const;
|
||||
@ -107,5 +112,6 @@ namespace EightBit {
|
||||
|
||||
private:
|
||||
std::array<uint8_t, 0x100> m_boot;
|
||||
bool m_disableBootRom;
|
||||
};
|
||||
}
|
@ -2,7 +2,8 @@
|
||||
#include "Bus.h"
|
||||
|
||||
EightBit::Bus::Bus()
|
||||
: Memory(0xffff) {
|
||||
: Memory(0xffff),
|
||||
m_disableBootRom(false) {
|
||||
}
|
||||
|
||||
void EightBit::Bus::reset() {
|
||||
@ -10,6 +11,11 @@ void EightBit::Bus::reset() {
|
||||
writeRegister(LCDC, 0x91);
|
||||
}
|
||||
|
||||
void EightBit::Bus::clear() {
|
||||
Memory::clear();
|
||||
m_boot.fill(0);
|
||||
}
|
||||
|
||||
void EightBit::Bus::loadBootRom(const std::string& path) {
|
||||
auto size = loadMemory(path, 0);
|
||||
if (size != 0x100)
|
||||
|
@ -91,7 +91,7 @@ namespace EightBit {
|
||||
write(value);
|
||||
}
|
||||
|
||||
void clear();
|
||||
virtual void clear();
|
||||
void loadRom(const std::string& path, uint16_t offset);
|
||||
void loadRam(const std::string& path, uint16_t offset);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user