diff --git a/LR35902/src/IoRegisters.cpp b/LR35902/src/IoRegisters.cpp index e41b58a..96b7117 100644 --- a/LR35902/src/IoRegisters.cpp +++ b/LR35902/src/IoRegisters.cpp @@ -18,7 +18,7 @@ void EightBit::GameBoy::IoRegisters::reset() { void EightBit::GameBoy::IoRegisters::transferDma() { if (m_dmaTransferActive) { - m_bus.OAMRAM().poke(m_dmaAddress.low, m_bus.peek(m_dmaAddress.word)); + m_bus.OAMRAM().poke(m_dmaAddress.low, m_bus.peek(m_dmaAddress)); m_dmaTransferActive = ++m_dmaAddress.low < 0xa0; } } diff --git a/M6502/test/Board.cpp b/M6502/test/Board.cpp index 56a4b68..dc0f25e 100644 --- a/M6502/test/Board.cpp +++ b/M6502/test/Board.cpp @@ -128,6 +128,6 @@ void Board::Cpu_ExecutedInstruction_Poll(const EightBit::MOS6502& cpu) { void Board::pollKeyboard() { #ifdef _MSC_VER if (_kbhit()) - poke(m_configuration.getInputAddress().word, _getch()); + poke(m_configuration.getInputAddress(), _getch()); #endif } \ No newline at end of file diff --git a/Z80/test/Board.cpp b/Z80/test/Board.cpp index df05cbc..ecbcd8b 100644 --- a/Z80/test/Board.cpp +++ b/Z80/test/Board.cpp @@ -76,7 +76,7 @@ void Board::Cpu_ExecutingInstruction_Profile(EightBit::Z80& cpu) { const auto pc = cpu.PC(); m_profiler.addAddress(pc.word); - m_profiler.addInstruction(peek(pc.word)); + m_profiler.addInstruction(peek(pc)); } void Board::Cpu_ExecutingInstruction_Debug(EightBit::Z80& cpu) { diff --git a/inc/Bus.h b/inc/Bus.h index 23f3383..091ede3 100644 --- a/inc/Bus.h +++ b/inc/Bus.h @@ -25,8 +25,10 @@ namespace EightBit { uint8_t peek() { return reference(); } uint8_t peek(uint16_t address) { return reference(address); } + uint8_t peek(register16_t address) { return reference(address.word); } void poke(uint8_t value) { reference() = value; } void poke(uint16_t address, uint8_t value) { reference(address) = value; } + void poke(register16_t address, uint8_t value) { reference(address.word) = value; } uint8_t read(); template uint8_t read(const T address) { @@ -43,7 +45,8 @@ namespace EightBit { protected: virtual uint8_t& reference(uint16_t address) = 0; - uint8_t& reference() { return reference(ADDRESS().word); } + uint8_t& reference(register16_t address) { return reference(address.word); } + uint8_t& reference() { return reference(ADDRESS()); } private: uint8_t m_data = 0xff; diff --git a/src/BigEndianProcessor.cpp b/src/BigEndianProcessor.cpp index a11f9c6..6ff1744 100644 --- a/src/BigEndianProcessor.cpp +++ b/src/BigEndianProcessor.cpp @@ -48,7 +48,7 @@ EightBit::register16_t EightBit::BigEndianProcessor::popWord() { } EightBit::register16_t EightBit::BigEndianProcessor::peekWord(const register16_t address) { - const auto high = BUS().peek(address.word); - const auto low = BUS().peek(address.word + 1); - return register16_t(low, high).word; + const auto high = BUS().peek(address); + const auto low = BUS().peek(address + 1); + return register16_t(low, high); } diff --git a/src/LittleEndianProcessor.cpp b/src/LittleEndianProcessor.cpp index acc3d59..2197a79 100644 --- a/src/LittleEndianProcessor.cpp +++ b/src/LittleEndianProcessor.cpp @@ -48,7 +48,7 @@ EightBit::register16_t EightBit::LittleEndianProcessor::popWord() { } EightBit::register16_t EightBit::LittleEndianProcessor::peekWord(const register16_t address) { - const auto low = BUS().peek(address.word); - const auto high = BUS().peek(address.word + 1); - return register16_t(low, high).word; + const auto low = BUS().peek(address); + const auto high = BUS().peek(address + 1); + return register16_t(low, high); }