[Z80] fixed state of CPU registers on reset: fixes missing sound in Defender/Defender 2 (Williams Arcade Classics)

This commit is contained in:
ekeeke31 2010-08-08 17:28:11 +00:00
parent efc7c3000a
commit cd14774e03
2 changed files with 9 additions and 11 deletions

View File

@ -41,6 +41,7 @@ of samples per frame and keeping PSG & FM chips in sync.
---------------
* updated Z80 core to last version (fixes interrupt Mode 0 timing and some BIT instructions).
* fixed some Z80 instructions timing.
* fixed state of Z80 registers on reset (sound issues with Defender & Defender 2 in Williams Arcade Classics)
* improved Z80 interrupt accuracy
* improved 68k accuracy (initial Reset timing + auto-vectored interrupts handling).
* improved 68k timing accuracy for DIVU/DVIS (thanks to Jorge Cwik) & MULU/MULS instructions.

View File

@ -3353,6 +3353,9 @@ void z80_init(const void *config, int (*irqcallback)(int))
}
/* Reset registers to their initial values */
memset(&Z80, 0, sizeof(Z80));
IX = IY = 0xffff; /* IX and IY are FFFF after a reset! */
F = ZF; /* Zero flag is set */
Z80.daisy = config;
Z80.irq_callback = irqcallback;
@ -3370,25 +3373,19 @@ void z80_init(const void *config, int (*irqcallback)(int))
****************************************************************************/
void z80_reset(void)
{
/* save previous values */
void *config = (void *) Z80.daisy;
int (*irqcallback)(int) = Z80.irq_callback;
/* Reset registers to their initial values */
memset(&Z80, 0, sizeof(Z80));
Z80.daisy = config;
Z80.irq_callback = irqcallback;
IX = IY = 0xffff; /* IX and IY are FFFF after a reset! */
F = ZF; /* Zero flag is set */
PC = 0x0000;
I = 0;
R = 0;
R2 = 0;
IM = 0;
IFF1 = IFF2 = 0;
HALT = 0;
Z80.nmi_state = CLEAR_LINE;
Z80.nmi_pending = FALSE;
Z80.irq_state = CLEAR_LINE;
Z80.after_ei = FALSE;
WZ=PCD;
}