mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-04-23 15:25:03 +00:00
Remove some "tricksy" code from the Z80 emulator chain.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
+10
-10
@@ -11,7 +11,7 @@ uint8_t& EightBit::Bus::DATA() {
|
||||
return *m_data;
|
||||
}
|
||||
|
||||
uint8_t& EightBit::Bus::placeDATA(uint8_t value) {
|
||||
uint8_t& EightBit::Bus::placeDATA(const uint8_t value) {
|
||||
m_temporary = value;
|
||||
m_data = &m_temporary;
|
||||
return DATA();
|
||||
@@ -22,17 +22,17 @@ uint8_t& EightBit::Bus::referenceDATA(uint8_t& value) {
|
||||
return DATA();
|
||||
}
|
||||
|
||||
uint8_t EightBit::Bus::peek(uint16_t address) {
|
||||
uint8_t EightBit::Bus::peek(const uint16_t address) {
|
||||
bool rom;
|
||||
return reference(address, rom);
|
||||
}
|
||||
|
||||
void EightBit::Bus::poke(uint16_t address, uint8_t value) {
|
||||
void EightBit::Bus::poke(const uint16_t address, const uint8_t value) {
|
||||
bool rom;
|
||||
reference(address, rom) = value;
|
||||
}
|
||||
|
||||
uint16_t EightBit::Bus::peekWord(uint16_t address) {
|
||||
uint16_t EightBit::Bus::peekWord(const uint16_t address) {
|
||||
register16_t returned;
|
||||
returned.low = peek(address);
|
||||
returned.high = peek(address + 1);
|
||||
@@ -46,28 +46,28 @@ uint8_t EightBit::Bus::read() {
|
||||
return returned;
|
||||
}
|
||||
|
||||
uint8_t EightBit::Bus::read(uint16_t offset) {
|
||||
uint8_t EightBit::Bus::read(const uint16_t offset) {
|
||||
ADDRESS().word = offset;
|
||||
return read();
|
||||
}
|
||||
|
||||
uint8_t EightBit::Bus::read(register16_t address) {
|
||||
uint8_t EightBit::Bus::read(const register16_t address) {
|
||||
ADDRESS() = address;
|
||||
return read();
|
||||
}
|
||||
|
||||
void EightBit::Bus::write(uint8_t value) {
|
||||
void EightBit::Bus::write(const uint8_t value) {
|
||||
WritingByte.fire(ADDRESS().word);
|
||||
reference() = value;
|
||||
WrittenByte.fire(ADDRESS().word);
|
||||
}
|
||||
|
||||
void EightBit::Bus::write(uint16_t offset, uint8_t value) {
|
||||
void EightBit::Bus::write(const uint16_t offset, const uint8_t value) {
|
||||
ADDRESS().word = offset;
|
||||
write(value);
|
||||
}
|
||||
|
||||
void EightBit::Bus::write(register16_t address, uint8_t value) {
|
||||
void EightBit::Bus::write(const register16_t address, const uint8_t value) {
|
||||
ADDRESS() = address;
|
||||
write(value);
|
||||
}
|
||||
@@ -75,5 +75,5 @@ void EightBit::Bus::write(register16_t address, uint8_t value) {
|
||||
uint8_t& EightBit::Bus::reference() {
|
||||
bool rom;
|
||||
auto& value = reference(ADDRESS().word, rom);
|
||||
return LIKELY(!rom) ? referenceDATA(value) : placeDATA(value);
|
||||
return rom ? placeDATA(value) : referenceDATA(value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user