From a13ad5042ad5ec5b2205c57ddae10afd2f737867 Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Sun, 6 Jan 2019 11:27:43 +0000 Subject: [PATCH] Correct constructions of register16_t: the structure is "#ifdef"ed for different endian arrangements. Signed-off-by: Adrian Conlon --- Intel8080/src/Intel8080.cpp | 4 ++-- LR35902/src/IoRegisters.cpp | 2 +- M6502/src/mos6502.cpp | 2 +- MC6809/inc/mc6809.h | 2 +- MC6809/src/mc6809.cpp | 2 +- Z80/src/Z80.cpp | 6 +++--- src/BigEndianProcessor.cpp | 10 +++++----- src/LittleEndianProcessor.cpp | 10 +++++----- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Intel8080/src/Intel8080.cpp b/Intel8080/src/Intel8080.cpp index 2bc1c10..d02c0fc 100644 --- a/Intel8080/src/Intel8080.cpp +++ b/Intel8080/src/Intel8080.cpp @@ -248,7 +248,7 @@ void EightBit::Intel8080::xhtl() { } void EightBit::Intel8080::writePort(const uint8_t port) { - BUS().ADDRESS() = { port, A() }; + BUS().ADDRESS() = register16_t(port, A()); BUS().DATA() = A(); writePort(); } @@ -258,7 +258,7 @@ void EightBit::Intel8080::writePort() { } uint8_t EightBit::Intel8080::readPort(const uint8_t port) { - BUS().ADDRESS() = { port, A() }; + BUS().ADDRESS() = register16_t(port, A()); return readPort(); } diff --git a/LR35902/src/IoRegisters.cpp b/LR35902/src/IoRegisters.cpp index 31957e8..5b1cefd 100644 --- a/LR35902/src/IoRegisters.cpp +++ b/LR35902/src/IoRegisters.cpp @@ -130,7 +130,7 @@ void EightBit::GameBoy::IoRegisters::Bus_WrittenByte(EightBit::EventArgs) { case SCX: break; case DMA: - m_dmaAddress = { 0, value }; + m_dmaAddress = register16_t(0, value); m_dmaTransferActive = true; break; case LY: // R/O diff --git a/M6502/src/mos6502.cpp b/M6502/src/mos6502.cpp index db4c781..a38ece2 100644 --- a/M6502/src/mos6502.cpp +++ b/M6502/src/mos6502.cpp @@ -499,7 +499,7 @@ void EightBit::MOS6502::branch(const int condition) { const auto page = PC().high; jump(destination); if (UNLIKELY(PC().high != page)) - Processor::busRead({ PC().low, page }); + Processor::busRead(register16_t(PC().low, page)); } } diff --git a/MC6809/inc/mc6809.h b/MC6809/inc/mc6809.h index fabe759..0a97316 100644 --- a/MC6809/inc/mc6809.h +++ b/MC6809/inc/mc6809.h @@ -134,7 +134,7 @@ namespace EightBit { register16_t popWord(register16_t& stack) { const auto high = pop(stack); const auto low = pop(stack); - return { low, high }; + return register16_t(low, high); } auto popWordS() { return popWord(S()); } diff --git a/MC6809/src/mc6809.cpp b/MC6809/src/mc6809.cpp index 0cf6e37..8431118 100644 --- a/MC6809/src/mc6809.cpp +++ b/MC6809/src/mc6809.cpp @@ -621,7 +621,7 @@ EightBit::register16_t EightBit::mc6809::Address_relative_word() { } EightBit::register16_t EightBit::mc6809::Address_direct() { - return { fetchByte(), DP() }; + return register16_t(fetchByte(), DP()); } EightBit::register16_t EightBit::mc6809::Address_indexed() { diff --git a/Z80/src/Z80.cpp b/Z80/src/Z80.cpp index 6dcb553..0d5a1b5 100644 --- a/Z80/src/Z80.cpp +++ b/Z80/src/Z80.cpp @@ -74,7 +74,7 @@ void EightBit::Z80::handleINT() { addCycles(13); break; case 2: - call(MEMPTR() = { BUS().DATA(), IV() }); + call(MEMPTR() = register16_t(BUS().DATA(), IV())); addCycles(19); break; default: @@ -638,7 +638,7 @@ void EightBit::Z80::rld() { } void EightBit::Z80::writePort(const uint8_t port) { - MEMPTR() = BUS().ADDRESS() = { port, A() }; + MEMPTR() = BUS().ADDRESS() = register16_t(port, A()); BUS().DATA() = A(); writePort(); ++MEMPTR().low; @@ -649,7 +649,7 @@ void EightBit::Z80::writePort() { } uint8_t EightBit::Z80::readPort(const uint8_t port) { - MEMPTR() = BUS().ADDRESS() = { port, A() }; + MEMPTR() = BUS().ADDRESS() = register16_t(port, A()); ++MEMPTR().low; return readPort(); } diff --git a/src/BigEndianProcessor.cpp b/src/BigEndianProcessor.cpp index b972b89..b5b86d3 100644 --- a/src/BigEndianProcessor.cpp +++ b/src/BigEndianProcessor.cpp @@ -8,7 +8,7 @@ EightBit::register16_t EightBit::BigEndianProcessor::getWord() { const auto high = busRead(); ++BUS().ADDRESS(); const auto low = busRead(); - return { low, high }; + return register16_t(low, high); } void EightBit::BigEndianProcessor::setWord(const register16_t value) { @@ -21,7 +21,7 @@ EightBit::register16_t EightBit::BigEndianProcessor::getWordPaged(const uint8_t const auto high = getBytePaged(page, offset); ++BUS().ADDRESS().low; const auto low = busRead(); - return { low, high }; + return register16_t(low, high); } void EightBit::BigEndianProcessor::setWordPaged(const uint8_t page, const uint8_t offset, const register16_t value) { @@ -33,7 +33,7 @@ void EightBit::BigEndianProcessor::setWordPaged(const uint8_t page, const uint8_ EightBit::register16_t EightBit::BigEndianProcessor::fetchWord() { const auto high = fetchByte(); const auto low = fetchByte(); - return { low, high }; + return register16_t(low, high); } void EightBit::BigEndianProcessor::pushWord(const register16_t value) { @@ -44,13 +44,13 @@ void EightBit::BigEndianProcessor::pushWord(const register16_t value) { EightBit::register16_t EightBit::BigEndianProcessor::popWord() { const auto high = pop(); const auto low = pop(); - return { low, high }; + return register16_t(low, high); } EightBit::register16_t EightBit::BigEndianProcessor::peekWord(const register16_t address) { const auto high = BUS().peek(address); const auto low = BUS().peek(address + 1); - return { low, high }; + return register16_t(low, high); } void EightBit::BigEndianProcessor::pokeWord(const register16_t address, const register16_t value) { diff --git a/src/LittleEndianProcessor.cpp b/src/LittleEndianProcessor.cpp index 3b78fa5..843f350 100644 --- a/src/LittleEndianProcessor.cpp +++ b/src/LittleEndianProcessor.cpp @@ -8,7 +8,7 @@ EightBit::register16_t EightBit::LittleEndianProcessor::getWord() { const auto low = busRead(); ++BUS().ADDRESS(); const auto high = busRead(); - return { low, high }; + return register16_t(low, high); } void EightBit::LittleEndianProcessor::setWord(const register16_t value) { @@ -21,7 +21,7 @@ EightBit::register16_t EightBit::LittleEndianProcessor::getWordPaged(const uint8 const auto low = getBytePaged(page, offset); ++BUS().ADDRESS().low; const auto high = busRead(); - return { low, high }; + return register16_t(low, high); } void EightBit::LittleEndianProcessor::setWordPaged(const uint8_t page, const uint8_t offset, const register16_t value) { @@ -33,7 +33,7 @@ void EightBit::LittleEndianProcessor::setWordPaged(const uint8_t page, const uin EightBit::register16_t EightBit::LittleEndianProcessor::fetchWord() { const auto low = fetchByte(); const auto high = fetchByte(); - return { low, high }; + return register16_t(low, high); } void EightBit::LittleEndianProcessor::pushWord(const register16_t value) { @@ -44,13 +44,13 @@ void EightBit::LittleEndianProcessor::pushWord(const register16_t value) { EightBit::register16_t EightBit::LittleEndianProcessor::popWord() { const auto low = pop(); const auto high = pop(); - return { low, high }; + return register16_t(low, high); } EightBit::register16_t EightBit::LittleEndianProcessor::peekWord(const register16_t address) { const auto low = BUS().peek(address); const auto high = BUS().peek(address + 1); - return { low, high }; + return register16_t(low, high); } void EightBit::LittleEndianProcessor::pokeWord(const register16_t address, const register16_t value) {