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) {
|
2018-03-10 01:53:57 +00:00
|
|
|
BUS().write(--SP().word, value);
|
2017-11-05 12:47:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t EightBit::IntelProcessor::pop() {
|
2018-03-10 01:53:57 +00:00
|
|
|
return BUS().read(SP().word++);
|
2017-11-05 12:47:42 +00:00
|
|
|
}
|
|
|
|
|
2018-02-25 19:48:01 +00:00
|
|
|
EightBit::register16_t EightBit::IntelProcessor::getWord() {
|
|
|
|
register16_t returned;
|
2018-03-10 01:53:57 +00:00
|
|
|
returned.low = BUS().read(MEMPTR().word++);
|
|
|
|
returned.high = BUS().read(++BUS().ADDRESS().word);
|
2018-02-25 19:48:01 +00:00
|
|
|
return returned;
|
2017-11-05 12:47:42 +00:00
|
|
|
}
|
|
|
|
|
2018-01-10 23:08:14 +00:00
|
|
|
void EightBit::IntelProcessor::setWord(register16_t value) {
|
2018-03-10 01:53:57 +00:00
|
|
|
BUS().write(MEMPTR().word++, value.low);
|
|
|
|
BUS().write(++BUS().ADDRESS().word, value.high);
|
2017-11-05 12:47:42 +00:00
|
|
|
}
|