Improve the flexibility of the BUS mapping/read/write architecture.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon
2018-12-29 19:17:36 +00:00
parent 722888ae66
commit f38d326ca7
17 changed files with 114 additions and 59 deletions

View File

@@ -5,29 +5,29 @@ EightBit::BigEndianProcessor::BigEndianProcessor(Bus& memory)
: Processor(memory) {}
EightBit::register16_t EightBit::BigEndianProcessor::getWord() {
const auto high = BUS().read();
const auto high = busRead();
++BUS().ADDRESS();
const auto low = BUS().read();
const auto low = busRead();
return { low, high };
}
void EightBit::BigEndianProcessor::setWord(const register16_t value) {
BUS().write(value.high);
busWrite(value.high);
++BUS().ADDRESS();
BUS().write(value.low);
busWrite(value.low);
}
EightBit::register16_t EightBit::BigEndianProcessor::getWordPaged(const uint8_t page, const uint8_t offset) {
const auto high = getBytePaged(page, offset);
++BUS().ADDRESS().low;
const auto low = BUS().read();
const auto low = busRead();
return { low, high };
}
void EightBit::BigEndianProcessor::setWordPaged(const uint8_t page, const uint8_t offset, const register16_t value) {
setBytePaged(page, offset, value.high);
++BUS().ADDRESS().low;
BUS().write(value.low);
busWrite(value.low);
}
EightBit::register16_t EightBit::BigEndianProcessor::fetchWord() {