Better method of enabling/disabling boot ROM.

Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
Adrian.Conlon 2017-08-19 17:33:28 +01:00
parent 86a4e22ae1
commit 75b17e47a8
2 changed files with 9 additions and 6 deletions

View File

@ -158,13 +158,13 @@ namespace EightBit {
writeRegister(LY, 0);
}
void disableBootRom() { m_disableBootRom = true; }
void enableBootRom() { m_disableBootRom = false; }
bool bootRomDisabled() const { return m_disableBootRom; }
bool bootRomEnabled() const { return !bootRomDisabled(); }
void loadBootRom(const std::string& path);
bool isBootRom(uint16_t address) const {
return !m_disableBootRom && (address < m_boot.size()) && !peek(BASE + BOOT_DISABLE);
return (address < m_boot.size()) && bootRomEnabled();
}
virtual uint8_t peek(uint16_t address) const;

View File

@ -2,8 +2,8 @@
#include "Bus.h"
EightBit::Bus::Bus()
: Memory(0xffff),
m_disableBootRom(false) {
: Memory(0xffff) {
WrittenByte.connect(std::bind(&Bus::Bus_WrittenByte, this, std::placeholders::_1));
}
void EightBit::Bus::reset() {
@ -39,8 +39,11 @@ uint8_t EightBit::Bus::peek(uint16_t address) const {
void EightBit::Bus::Bus_WrittenByte(const AddressEventArgs& e) {
switch (e.getAddress()) {
case EightBit::Bus::BASE + TAC:
case BASE + TAC:
m_timerRate = timerClockTicks();
break;
case BASE + BOOT_DISABLE:
m_disableBootRom = e.getCell() != 0;
break;
}
}