From 19a25e55fb8d8b5901cf9e37d8cfd9e95685dfcc Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Sun, 30 Sep 2018 12:21:47 -0500 Subject: [PATCH] z80: IORQ signal interrupt acknowledge --- .../CPUs/Z80A/Interrupts.cs | 18 ++++++------------ BizHawk.Emulation.Cores/CPUs/Z80A/Z80A.cs | 5 +++++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/BizHawk.Emulation.Cores/CPUs/Z80A/Interrupts.cs b/BizHawk.Emulation.Cores/CPUs/Z80A/Interrupts.cs index dbc90454de..5eec6cf45f 100644 --- a/BizHawk.Emulation.Cores/CPUs/Z80A/Interrupts.cs +++ b/BizHawk.Emulation.Cores/CPUs/Z80A/Interrupts.cs @@ -64,8 +64,8 @@ namespace BizHawk.Emulation.Cores.Components.Z80A cur_instr = new ushort[] {IDLE, IDLE, - IDLE, - IDLE, + IORQ, + WAIT, IDLE, WAIT, RD_INC, ALU, PCl, PCh }; @@ -73,8 +73,6 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, 0, 0, 0, PCh, 0, 0 }; MEMRQ = new ushort[] { 0, 0, 0, 0, PCh, 0, 0 }; IRQS = new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; - - IRQACKCallback(); } // Just jump to $0038 @@ -83,8 +81,8 @@ namespace BizHawk.Emulation.Cores.Components.Z80A cur_instr = new ushort[] {IDLE, IDLE, - IDLE, - IDLE, + IORQ, + WAIT, IDLE, TR, ALU, PCl, DEC16, SPl, SPh, @@ -98,8 +96,6 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, 0, 0, 0, I, 0, 0, SPh, 0, 0, SPh, 0, 0 }; MEMRQ = new ushort[] { 0, 0, 0, 0, I, 0, 0, SPh, 0, 0, SPh, 0, 0 }; IRQS = new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; - - IRQACKCallback(); } // Interrupt mode 2 uses the I vector combined with a byte on the data bus @@ -108,8 +104,8 @@ namespace BizHawk.Emulation.Cores.Components.Z80A cur_instr = new ushort[] {IDLE, IDLE, - IDLE, - IDLE, + IORQ, + WAIT, FTCH_DB, IDLE, DEC16, SPl, SPh, @@ -129,8 +125,6 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, 0, 0, 0, I, 0, 0, SPh, 0, 0, SPh, 0, 0, W, 0, 0, W, 0 ,0 }; MEMRQ = new ushort[] { 0, 0, 0, 0, I, 0, 0, SPh, 0, 0, SPh, 0, 0, W, 0, 0, W, 0, 0 }; IRQS = new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; - - IRQACKCallback(); } private void ResetInterrupts() diff --git a/BizHawk.Emulation.Cores/CPUs/Z80A/Z80A.cs b/BizHawk.Emulation.Cores/CPUs/Z80A/Z80A.cs index 3f886389ae..6c7c9f3e50 100644 --- a/BizHawk.Emulation.Cores/CPUs/Z80A/Z80A.cs +++ b/BizHawk.Emulation.Cores/CPUs/Z80A/Z80A.cs @@ -87,6 +87,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A public const ushort IN_INC = 72; public const ushort WR_INC_WA = 73; // A -> W after WR_INC public const ushort RD_OP = 74; + public const ushort IORQ = 75; // non-state variables public ushort Ztemp1, Ztemp2, Ztemp3, Ztemp4; @@ -627,6 +628,10 @@ namespace BizHawk.Emulation.Cores.Components.Z80A I_skip = true; } break; + + case IORQ: + IRQACKCallback(); + break; } if (I_skip)