mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-02-05 13:29:59 +00:00
Fix up INT and NMI pin (M1 and IORQ) response a little (still working on ZX81 emulator!)
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
4be4a0603e
commit
6d6c95f695
@ -336,7 +336,7 @@ void Fuse::TestRunner::run() {
|
|||||||
try {
|
try {
|
||||||
m_cpu.run(allowedCycles);
|
m_cpu.run(allowedCycles);
|
||||||
check();
|
check();
|
||||||
} catch (std::logic_error& error) {
|
} catch (std::logic_error& error) {
|
||||||
m_unimplemented = true;
|
m_unimplemented = true;
|
||||||
std::cerr << "**** Error: " << error.what() << std::endl;
|
std::cerr << "**** Error: " << error.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,7 @@ namespace EightBit {
|
|||||||
|
|
||||||
DECLARE_PIN_INPUT(NMI)
|
DECLARE_PIN_INPUT(NMI)
|
||||||
DECLARE_PIN_OUTPUT(M1)
|
DECLARE_PIN_OUTPUT(M1)
|
||||||
|
DECLARE_PIN_OUTPUT(IORQ)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void handleRESET() final;
|
void handleRESET() final;
|
||||||
|
@ -30,6 +30,7 @@ EightBit::Z80::Z80(Bus& bus, InputOutput& ports)
|
|||||||
|
|
||||||
DEFINE_PIN_LEVEL_CHANGERS(NMI, Z80);
|
DEFINE_PIN_LEVEL_CHANGERS(NMI, Z80);
|
||||||
DEFINE_PIN_LEVEL_CHANGERS(M1, Z80);
|
DEFINE_PIN_LEVEL_CHANGERS(M1, Z80);
|
||||||
|
DEFINE_PIN_LEVEL_CHANGERS(IORQ, Z80);
|
||||||
|
|
||||||
EightBit::register16_t& EightBit::Z80::AF() {
|
EightBit::register16_t& EightBit::Z80::AF() {
|
||||||
return m_accumulatorFlags[m_accumulatorFlagsSet];
|
return m_accumulatorFlags[m_accumulatorFlagsSet];
|
||||||
@ -57,23 +58,31 @@ void EightBit::Z80::handleNMI() {
|
|||||||
raiseNMI();
|
raiseNMI();
|
||||||
raiseHALT();
|
raiseHALT();
|
||||||
IFF1() = false;
|
IFF1() = false;
|
||||||
|
lowerM1();
|
||||||
|
const auto discarded = BUS().DATA();
|
||||||
|
raiseM1();
|
||||||
restart(0x66);
|
restart(0x66);
|
||||||
tick(13);
|
tick(13);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EightBit::Z80::handleINT() {
|
void EightBit::Z80::handleINT() {
|
||||||
IntelProcessor::handleINT();
|
IntelProcessor::handleINT();
|
||||||
|
lowerM1();
|
||||||
|
lowerIORQ();
|
||||||
|
const auto data = BUS().DATA();
|
||||||
|
raiseIORQ();
|
||||||
|
raiseM1();
|
||||||
di();
|
di();
|
||||||
switch (IM()) {
|
switch (IM()) {
|
||||||
case 0: // i8080 equivalent
|
case 0: // i8080 equivalent
|
||||||
execute(BUS().DATA());
|
execute(data);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
restart(7 << 3);
|
restart(7 << 3);
|
||||||
tick(13);
|
tick(13);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
call(MEMPTR() = register16_t(BUS().DATA(), IV()));
|
call(MEMPTR() = register16_t(data, IV()));
|
||||||
tick(19);
|
tick(19);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1026,6 +1035,8 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in
|
|||||||
case 0: // Relative jumps and assorted ops
|
case 0: // Relative jumps and assorted ops
|
||||||
switch (y) {
|
switch (y) {
|
||||||
case 0: // NOP
|
case 0: // NOP
|
||||||
|
if (m_prefixDD)
|
||||||
|
tick(4);
|
||||||
tick(4);
|
tick(4);
|
||||||
break;
|
break;
|
||||||
case 1: // EX AF AF'
|
case 1: // EX AF AF'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user