2017-06-04 20:38:34 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "Processor.h"
|
|
|
|
|
|
|
|
EightBit::Processor::Processor(Memory& memory)
|
2017-06-10 11:42:55 +00:00
|
|
|
: m_memory(memory),
|
|
|
|
cycles(0),
|
2017-08-31 11:13:00 +00:00
|
|
|
m_halted(false),
|
|
|
|
m_power(false) {
|
2017-06-19 12:53:00 +00:00
|
|
|
PC().word = 0;
|
2017-06-04 20:38:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EightBit::Processor::reset() {
|
2017-06-19 12:53:00 +00:00
|
|
|
PC().word = 0;
|
2017-06-04 20:38:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EightBit::Processor::initialise() {
|
|
|
|
reset();
|
|
|
|
}
|
2017-08-30 22:17:34 +00:00
|
|
|
|
|
|
|
int EightBit::Processor::run(int limit) {
|
|
|
|
int current = 0;
|
|
|
|
do {
|
|
|
|
current += singleStep();
|
|
|
|
} while (current < limit);
|
|
|
|
return current;
|
|
|
|
}
|
|
|
|
|
|
|
|
int EightBit::Processor::singleStep() {
|
|
|
|
return step();
|
|
|
|
}
|