mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-23 00:30:17 +00:00
WM_CREATE: call CpuCreateCriticalSection() instead of CpuInitialize()
This commit is contained in:
parent
3fe06faf65
commit
b519031de4
@ -636,6 +636,7 @@ DWORD CpuExecute(const DWORD uCycles, const bool bVideoUpdate)
|
|||||||
// Called by:
|
// Called by:
|
||||||
// . CpuInitialize()
|
// . CpuInitialize()
|
||||||
// . SY6522.Reset()
|
// . SY6522.Reset()
|
||||||
|
// . FrameCreateWindow() -> WM_CREATE
|
||||||
void CpuCreateCriticalSection(void)
|
void CpuCreateCriticalSection(void)
|
||||||
{
|
{
|
||||||
if (!g_bCritSectionValid)
|
if (!g_bCritSectionValid)
|
||||||
@ -648,15 +649,12 @@ void CpuCreateCriticalSection(void)
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
// Called from RepeatInitialization():
|
// Called from RepeatInitialization():
|
||||||
// 1) FrameCreateWindow() -> WM_CREATE
|
// . MemInitialize() -> MemReset()
|
||||||
// - done to init g_CriticalSection
|
void CpuInitialize(void)
|
||||||
// - but can't call CpuReset() as mem == NULL
|
|
||||||
// 2) MemInitialize() -> MemReset()
|
|
||||||
void CpuInitialize(bool reset)
|
|
||||||
{
|
{
|
||||||
regs.a = regs.x = regs.y = 0xFF;
|
regs.a = regs.x = regs.y = 0xFF;
|
||||||
regs.sp = 0x01FF;
|
regs.sp = 0x01FF;
|
||||||
if (reset)
|
|
||||||
CpuReset();
|
CpuReset();
|
||||||
|
|
||||||
CpuCreateCriticalSection();
|
CpuCreateCriticalSection();
|
||||||
@ -683,6 +681,8 @@ void CpuDestroy()
|
|||||||
|
|
||||||
void CpuReset()
|
void CpuReset()
|
||||||
{
|
{
|
||||||
|
_ASSERT(mem != NULL);
|
||||||
|
|
||||||
// 7 cycles
|
// 7 cycles
|
||||||
regs.ps = (regs.ps | AF_INTERRUPT) & ~AF_DECIMAL;
|
regs.ps = (regs.ps | AF_INTERRUPT) & ~AF_DECIMAL;
|
||||||
regs.pc = *(WORD*)(mem + 0xFFFC);
|
regs.pc = *(WORD*)(mem + 0xFFFC);
|
||||||
|
@ -33,7 +33,7 @@ void CpuCalcCycles(ULONG nExecutedCycles);
|
|||||||
DWORD CpuExecute(const DWORD uCycles, const bool bVideoUpdate);
|
DWORD CpuExecute(const DWORD uCycles, const bool bVideoUpdate);
|
||||||
ULONG CpuGetCyclesThisVideoFrame(ULONG nExecutedCycles);
|
ULONG CpuGetCyclesThisVideoFrame(ULONG nExecutedCycles);
|
||||||
void CpuCreateCriticalSection(void);
|
void CpuCreateCriticalSection(void);
|
||||||
void CpuInitialize(bool reset);
|
void CpuInitialize(void);
|
||||||
void CpuSetupBenchmark ();
|
void CpuSetupBenchmark ();
|
||||||
void CpuIrqReset();
|
void CpuIrqReset();
|
||||||
void CpuIrqAssert(eIRQSRC Device);
|
void CpuIrqAssert(eIRQSRC Device);
|
||||||
|
@ -1926,7 +1926,7 @@ void MemReset()
|
|||||||
|
|
||||||
// INITIALIZE & RESET THE CPU
|
// INITIALIZE & RESET THE CPU
|
||||||
// . Do this after ROM has been copied back to mem[], so that PC is correctly init'ed from 6502's reset vector
|
// . Do this after ROM has been copied back to mem[], so that PC is correctly init'ed from 6502's reset vector
|
||||||
CpuInitialize(true);
|
CpuInitialize();
|
||||||
//Sets Caps Lock = false (Pravets 8A/C only)
|
//Sets Caps Lock = false (Pravets 8A/C only)
|
||||||
|
|
||||||
z80_reset(); // NB. Also called above in CpuInitialize()
|
z80_reset(); // NB. Also called above in CpuInitialize()
|
||||||
|
@ -1001,8 +1001,8 @@ LRESULT Win32Frame::WndProc(
|
|||||||
DIMouse::DirectInputInit(window);
|
DIMouse::DirectInputInit(window);
|
||||||
LogFileOutput("WM_CREATE: DIMouse::DirectInputInit()\n");
|
LogFileOutput("WM_CREATE: DIMouse::DirectInputInit()\n");
|
||||||
|
|
||||||
CpuInitialize(false); // NB. Creates CriticalSection that's needed by MB_Initialize()
|
CpuCreateCriticalSection(); // NB. Creates CriticalSection that's needed by MB_Initialize() -- required on a VM restart
|
||||||
LogFileOutput("WM_CREATE: CpuInitialize()\n");
|
LogFileOutput("WM_CREATE: CpuCreateCriticalSection()\n");
|
||||||
|
|
||||||
MB_Initialize();
|
MB_Initialize();
|
||||||
LogFileOutput("WM_CREATE: MB_Initialize()\n");
|
LogFileOutput("WM_CREATE: MB_Initialize()\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user