mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-26 22:31:38 +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 {
|
||||
m_cpu.run(allowedCycles);
|
||||
check();
|
||||
} catch (std::logic_error& error) {
|
||||
} catch (std::logic_error& error) {
|
||||
m_unimplemented = true;
|
||||
std::cerr << "**** Error: " << error.what() << std::endl;
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ namespace EightBit {
|
||||
|
||||
DECLARE_PIN_INPUT(NMI)
|
||||
DECLARE_PIN_OUTPUT(M1)
|
||||
DECLARE_PIN_OUTPUT(IORQ)
|
||||
|
||||
protected:
|
||||
void handleRESET() final;
|
||||
|
@ -30,6 +30,7 @@ EightBit::Z80::Z80(Bus& bus, InputOutput& ports)
|
||||
|
||||
DEFINE_PIN_LEVEL_CHANGERS(NMI, Z80);
|
||||
DEFINE_PIN_LEVEL_CHANGERS(M1, Z80);
|
||||
DEFINE_PIN_LEVEL_CHANGERS(IORQ, Z80);
|
||||
|
||||
EightBit::register16_t& EightBit::Z80::AF() {
|
||||
return m_accumulatorFlags[m_accumulatorFlagsSet];
|
||||
@ -57,23 +58,31 @@ void EightBit::Z80::handleNMI() {
|
||||
raiseNMI();
|
||||
raiseHALT();
|
||||
IFF1() = false;
|
||||
lowerM1();
|
||||
const auto discarded = BUS().DATA();
|
||||
raiseM1();
|
||||
restart(0x66);
|
||||
tick(13);
|
||||
}
|
||||
|
||||
void EightBit::Z80::handleINT() {
|
||||
IntelProcessor::handleINT();
|
||||
lowerM1();
|
||||
lowerIORQ();
|
||||
const auto data = BUS().DATA();
|
||||
raiseIORQ();
|
||||
raiseM1();
|
||||
di();
|
||||
switch (IM()) {
|
||||
case 0: // i8080 equivalent
|
||||
execute(BUS().DATA());
|
||||
execute(data);
|
||||
break;
|
||||
case 1:
|
||||
restart(7 << 3);
|
||||
tick(13);
|
||||
break;
|
||||
case 2:
|
||||
call(MEMPTR() = register16_t(BUS().DATA(), IV()));
|
||||
call(MEMPTR() = register16_t(data, IV()));
|
||||
tick(19);
|
||||
break;
|
||||
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
|
||||
switch (y) {
|
||||
case 0: // NOP
|
||||
if (m_prefixDD)
|
||||
tick(4);
|
||||
tick(4);
|
||||
break;
|
||||
case 1: // EX AF AF'
|
||||
|
Loading…
x
Reference in New Issue
Block a user