Re: [hatari-devel] WinUAE core freeze with ST emulation |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Am Mon, 16 Jan 2012 23:56:58 +0100
schrieb Laurent Sallafranque <laurent.sallafranque@xxxxxxx>:
> OK, I've finaly found it : it's in m68000.c
>
> /**
> * Reset CPU 68000 variables
> */
> void M68000_Reset(bool bCold)
> {
> /* Clear registers */
> if (bCold)
> {
> memset(®s, 0, sizeof(regs));
> }
>
>
> The memset clears the regs (and spcflags is into this structure).
>
> It's because we come from change.c which calls Reset_Cold();
Good finding!
> Should I change the reset cold by a reset warm or add some ifs to
> avoid the problem ? (This may complexify the understanding of the
> code).
First, I think you do not have to reset the emulator when you only
change the bCompatibleCpu or bCycleExactCpu settings, do you?
(I am talking about the code in Change_DoNeedReset()).
But for the rest, you're right of course, _BRK and _MODECHANGE flags
should not be altered here. I'd suggest some code like this:
if (bCold)
{
/* Need to keep SPCFLAG_BRK and SPCFLAG_MODECHANGE */
int spcflags = regs.spcflags & (SPCFLAG_BRK|SPCFLAG_MODECHANGE);
memset(®s, 0, sizeof(regs));
regs.spcflags = spcflags;
}
That should fix the problem without ifdefs and is still pretty
readable, I think.
Thomas