anotherlin/z80emu

Interrupt modes

cdesp opened this issue · 3 comments

cdesp commented

Hi,

i took the liberty of using your emulator on my project that emulates a 1980s home computer and i think there is a bug on selecting the Interrupt Mode.
The byte that Selects IM 1 are ED 56 and the original code selects IM 0
I replaced that code with this one and it worked ok (haven't tested the other modes):
``
case IM_N: {

							/* "IM 0/1" (0xed prefixed opcodes 0x4e and
                             * 0x6e) is treated like a "IM 0".
							 */

							if ((opcode & 0x08)) //IM2
								state->im = Z80_INTERRUPT_MODE_2;
							else if ((opcode & 0x10))

									state->im = Z80_INTERRUPT_MODE_1;

							else
									state->im = Z80_INTERRUPT_MODE_0;

                            break;

``

Very good work.

Hi Chris,

Thank you for your bug report.
After re-reading the code, this part is totally wrong !
I have a fix ready, I'll do the update tomorrow evening after re-verifying everything..

The interrupt mode is not tested at all by zextests.
And most system emulated so far, don't change the mode.
So until you, this part of code wasn't tested at all !

Best regards,

Hi Chris,

I've uploaded the bug fix and credited you.
Can you please verify it works?
Thank you.

Best regards,

cdesp commented

Hi Lin,

the bug has been fixed (at least with IM1 i don't use the other two so i can't confirm).
Thanks for the quick fix.

Regards,

Chris