mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-04-20 10:16:48 +00:00
Start moving towards reset being just another style of interrupt.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
@@ -7,8 +7,8 @@ EightBit::IntelProcessor::IntelProcessor(Bus& bus)
|
||||
m_decodedOpcodes[i] = i;
|
||||
}
|
||||
|
||||
void EightBit::IntelProcessor::reset() {
|
||||
Processor::reset();
|
||||
void EightBit::IntelProcessor::powerOn() {
|
||||
Processor::powerOn();
|
||||
SP() = AF() = BC() = DE() = HL() = Mask16;
|
||||
}
|
||||
|
||||
|
||||
+16
-10
@@ -5,24 +5,30 @@ EightBit::Processor::Processor(Bus& bus)
|
||||
: m_bus(bus) {
|
||||
}
|
||||
|
||||
void EightBit::Processor::reset() {
|
||||
if (lowered(POWER()))
|
||||
throw std::logic_error("POWER cannot be low");
|
||||
void EightBit::Processor::powerOn() {
|
||||
raise(RESET());
|
||||
raise(HALT());
|
||||
raise(INT());
|
||||
raise(NMI());
|
||||
raise(POWER());
|
||||
}
|
||||
|
||||
void EightBit::Processor::handleRESET() {
|
||||
raise(RESET());
|
||||
PC() = 0;
|
||||
}
|
||||
|
||||
void EightBit::Processor::handleNMI() {
|
||||
raise(NMI());
|
||||
}
|
||||
|
||||
void EightBit::Processor::handleINT() {
|
||||
raise(INT());
|
||||
}
|
||||
|
||||
int EightBit::Processor::run(const int limit) {
|
||||
int current = 0;
|
||||
while (LIKELY(powered()) && current < limit)
|
||||
current += singleStep();
|
||||
current += step();
|
||||
return current;
|
||||
}
|
||||
|
||||
int EightBit::Processor::singleStep() {
|
||||
if (UNLIKELY(lowered(RESET())))
|
||||
reset();
|
||||
return step();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user