Get rid of wrappers for bus access: i.e. make it clearer where the bus is being read/written.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon
2018-03-10 01:53:57 +00:00
parent c6eb68ba13
commit 45dc274167
12 changed files with 236 additions and 180 deletions
+6 -8
View File
@@ -13,23 +13,21 @@ void EightBit::IntelProcessor::reset() {
}
void EightBit::IntelProcessor::push(uint8_t value) {
setByte(--SP().word, value);
BUS().write(--SP().word, value);
}
uint8_t EightBit::IntelProcessor::pop() {
return getByte(SP().word++);
return BUS().read(SP().word++);
}
EightBit::register16_t EightBit::IntelProcessor::getWord() {
register16_t returned;
returned.low = getByte(MEMPTR().word++);
BUS().ADDRESS().word++;
returned.high = getByte();
returned.low = BUS().read(MEMPTR().word++);
returned.high = BUS().read(++BUS().ADDRESS().word);
return returned;
}
void EightBit::IntelProcessor::setWord(register16_t value) {
setByte(MEMPTR().word++, value.low);
BUS().ADDRESS().word++;
setByte(value.high);
BUS().write(MEMPTR().word++, value.low);
BUS().write(++BUS().ADDRESS().word, value.high);
}