2018-08-25 21:51:56 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "BigEndianProcessor.h"
|
|
|
|
|
|
|
|
EightBit::BigEndianProcessor::BigEndianProcessor(Bus& memory)
|
|
|
|
: Processor(memory) {}
|
|
|
|
|
|
|
|
EightBit::register16_t EightBit::BigEndianProcessor::getWord() {
|
2020-02-09 11:51:58 +00:00
|
|
|
const auto high = memoryRead();
|
2018-08-25 21:51:56 +00:00
|
|
|
++BUS().ADDRESS();
|
2020-02-09 11:51:58 +00:00
|
|
|
const auto low = memoryRead();
|
2019-12-29 01:18:54 +00:00
|
|
|
return { low, high };
|
2018-08-25 21:51:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EightBit::BigEndianProcessor::setWord(const register16_t value) {
|
2020-02-09 11:51:58 +00:00
|
|
|
memoryWrite(value.high);
|
2018-08-25 21:51:56 +00:00
|
|
|
++BUS().ADDRESS();
|
2020-02-09 11:51:58 +00:00
|
|
|
memoryWrite(value.low);
|
2018-08-25 21:51:56 +00:00
|
|
|
}
|
|
|
|
|
2018-09-20 23:16:00 +00:00
|
|
|
EightBit::register16_t EightBit::BigEndianProcessor::getWordPaged(const uint8_t page, const uint8_t offset) {
|
2018-08-25 21:51:56 +00:00
|
|
|
const auto high = getBytePaged(page, offset);
|
|
|
|
++BUS().ADDRESS().low;
|
2020-02-09 11:51:58 +00:00
|
|
|
const auto low = memoryRead();
|
2019-12-29 01:18:54 +00:00
|
|
|
return { low, high };
|
2018-08-25 21:51:56 +00:00
|
|
|
}
|
|
|
|
|
2018-09-20 23:16:00 +00:00
|
|
|
void EightBit::BigEndianProcessor::setWordPaged(const uint8_t page, const uint8_t offset, const register16_t value) {
|
2018-08-25 21:51:56 +00:00
|
|
|
setBytePaged(page, offset, value.high);
|
|
|
|
++BUS().ADDRESS().low;
|
2020-02-09 11:51:58 +00:00
|
|
|
memoryWrite(value.low);
|
2018-08-25 21:51:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
EightBit::register16_t EightBit::BigEndianProcessor::fetchWord() {
|
|
|
|
const auto high = fetchByte();
|
|
|
|
const auto low = fetchByte();
|
2019-12-29 01:18:54 +00:00
|
|
|
return { low, high };
|
2018-08-25 21:51:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EightBit::BigEndianProcessor::pushWord(const register16_t value) {
|
|
|
|
push(value.low);
|
|
|
|
push(value.high);
|
|
|
|
}
|
|
|
|
|
|
|
|
EightBit::register16_t EightBit::BigEndianProcessor::popWord() {
|
|
|
|
const auto high = pop();
|
|
|
|
const auto low = pop();
|
2019-12-29 01:18:54 +00:00
|
|
|
return { low, high };
|
2018-08-25 21:51:56 +00:00
|
|
|
}
|
2018-08-27 10:27:33 +00:00
|
|
|
|
|
|
|
EightBit::register16_t EightBit::BigEndianProcessor::peekWord(const register16_t address) {
|
2018-08-29 12:52:25 +00:00
|
|
|
const auto high = BUS().peek(address);
|
|
|
|
const auto low = BUS().peek(address + 1);
|
2019-12-29 01:18:54 +00:00
|
|
|
return { low, high };
|
2018-08-27 10:27:33 +00:00
|
|
|
}
|
2018-10-14 09:05:43 +00:00
|
|
|
|
|
|
|
void EightBit::BigEndianProcessor::pokeWord(const register16_t address, const register16_t value) {
|
|
|
|
BUS().poke(address, value.high);
|
|
|
|
BUS().poke(address + 1, value.low);
|
|
|
|
}
|