Rewrite i8080 interrupts to be more closely related to the hardware.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon
2017-12-02 23:50:59 +00:00
parent 55b989fe13
commit 7e3957d4db
4 changed files with 16 additions and 27 deletions
+13 -16
View File
@@ -3,7 +3,6 @@
EightBit::Intel8080::Intel8080(Bus& bus, InputOutput& ports)
: IntelProcessor(bus),
m_interrupt(false),
m_ports(ports) {
bc.word = de.word = hl.word = Mask16;
}
@@ -27,23 +26,11 @@ EightBit::register16_t& EightBit::Intel8080::HL() {
}
void EightBit::Intel8080::di() {
m_interrupt = false;
m_interruptEnable = false;
}
void EightBit::Intel8080::ei() {
m_interrupt = true;
}
int EightBit::Intel8080::interrupt(uint8_t value) {
if (isInterruptable()) {
di();
return execute(value);
}
return 0;
}
bool EightBit::Intel8080::isInterruptable() const {
return m_interrupt;
m_interruptEnable = true;
}
void EightBit::Intel8080::increment(uint8_t& f, uint8_t& operand) {
@@ -278,7 +265,17 @@ void EightBit::Intel8080::readPort() {
int EightBit::Intel8080::step() {
ExecutingInstruction.fire(*this);
resetCycles();
return fetchExecute();
if (LIKELY(powered())) {
uint8_t instruction;
if (UNLIKELY(INT() && m_interruptEnable)) {
INT() = false;
di();
instruction = BUS().DATA();
} else {
instruction = fetchByte();
}
return execute(instruction);
}
}
int EightBit::Intel8080::execute(uint8_t opcode) {