Correct constructions of register16_t: the structure is "#ifdef"ed for different endian arrangements.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2019-01-06 11:27:43 +00:00
parent 3749585398
commit a13ad5042a
8 changed files with 19 additions and 19 deletions

View File

@ -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();
}

View File

@ -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

View File

@ -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));
}
}

View File

@ -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()); }

View File

@ -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() {

View File

@ -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();
}

View File

@ -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) {

View File

@ -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) {