Start refactoring the processor classes to allow big/little endian processors to be specified.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon
2018-08-17 21:53:49 +01:00
parent 677b9a608e
commit cc64e114a9
9 changed files with 151 additions and 50 deletions
+1 -16
View File
@@ -2,7 +2,7 @@
#include "mos6502.h"
EightBit::MOS6502::MOS6502(Bus& bus)
: Processor(bus) {}
: LittleEndianProcessor(bus) {}
void EightBit::MOS6502::powerOn() {
@@ -50,21 +50,6 @@ void EightBit::MOS6502::reset() {
jump(getWordPaged(0xff, RSTvector));
}
EightBit::register16_t EightBit::MOS6502::getWordPaged(uint8_t page, uint8_t offset) {
const auto low = getBytePaged(page, offset);
++BUS().ADDRESS().low;
const auto high = BUS().read();
return register16_t(low, high);
}
uint8_t EightBit::MOS6502::getBytePaged(uint8_t page, uint8_t offset) {
return BUS().read(register16_t(offset, page));
}
void EightBit::MOS6502::setBytePaged(uint8_t page, uint8_t offset, uint8_t value) {
BUS().write(register16_t(offset, page), value);
}
void EightBit::MOS6502::interrupt(uint8_t vector) {
raise(HALT());
pushWord(PC());