2017-06-11 08:45:34 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "IntelProcessor.h"
|
|
|
|
|
2017-09-06 12:22:23 +00:00
|
|
|
EightBit::IntelProcessor::IntelProcessor(Bus& bus)
|
|
|
|
: Processor(bus) {
|
2017-12-10 21:41:48 +00:00
|
|
|
for (int i = 0; i < 0x100; ++i)
|
2017-07-21 12:33:17 +00:00
|
|
|
m_decodedOpcodes[i] = i;
|
2017-06-11 08:45:34 +00:00
|
|
|
}
|
2017-09-01 15:01:40 +00:00
|
|
|
|
|
|
|
void EightBit::IntelProcessor::reset() {
|
|
|
|
Processor::reset();
|
|
|
|
SP().word = AF().word = BC().word = DE().word = HL().word = Mask16;
|
2017-11-05 12:47:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EightBit::IntelProcessor::push(uint8_t value) {
|
|
|
|
setByte(--SP().word, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t EightBit::IntelProcessor::pop() {
|
|
|
|
return getByte(SP().word++);
|
|
|
|
}
|
|
|
|
|
2018-01-10 23:08:14 +00:00
|
|
|
void EightBit::IntelProcessor::getWord(register16_t& value) {
|
|
|
|
value.low = getByte(MEMPTR().word++);
|
2017-11-05 12:47:42 +00:00
|
|
|
BUS().ADDRESS().word++;
|
|
|
|
value.high = getByte();
|
|
|
|
}
|
|
|
|
|
2018-01-10 23:08:14 +00:00
|
|
|
void EightBit::IntelProcessor::setWord(register16_t value) {
|
|
|
|
setByte(MEMPTR().word++, value.low);
|
2017-11-05 12:47:42 +00:00
|
|
|
BUS().ADDRESS().word++;
|
|
|
|
setByte(value.high);
|
|
|
|
}
|