Merge remote-tracking branch 'upstream/master'
# Conflicts: # source/Speaker.cpp
This commit is contained in:
commit
b100ed1ae0
47 changed files with 890 additions and 463 deletions
|
@ -757,6 +757,14 @@
|
|||
RelativePath=".\source\Speech.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\SynchronousEventManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\SynchronousEventManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Tape.cpp"
|
||||
>
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
<ClInclude Include="source\Speech.h" />
|
||||
<ClInclude Include="source\SSI263Phonemes.h" />
|
||||
<ClInclude Include="source\StdAfx.h" />
|
||||
<ClInclude Include="source\SynchronousEventManager.h" />
|
||||
<ClInclude Include="source\Tape.h" />
|
||||
<ClInclude Include="source\Tfe\Bittypes.h" />
|
||||
<ClInclude Include="source\Tfe\Bpf.h" />
|
||||
|
@ -184,6 +185,7 @@
|
|||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release NoDX|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\SynchronousEventManager.cpp" />
|
||||
<ClCompile Include="source\Tape.cpp" />
|
||||
<ClCompile Include="source\Tfe\Tfe.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
|
|
|
@ -199,6 +199,9 @@
|
|||
<ClCompile Include="source\Disk2CardManager.cpp">
|
||||
<Filter>Source Files\Disk</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\SynchronousEventManager.cpp">
|
||||
<Filter>Source Files\Emulator</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="source\Applewin.h">
|
||||
|
@ -483,6 +486,9 @@
|
|||
<ClInclude Include="source\Card.h">
|
||||
<Filter>Source Files\Emulator</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\SynchronousEventManager.h">
|
||||
<Filter>Source Files\Emulator</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="resource\Applewin.bmp">
|
||||
|
|
|
@ -53,6 +53,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#ifdef USE_SPEECH_API
|
||||
#include "Speech.h"
|
||||
#endif
|
||||
#include "SynchronousEventManager.h"
|
||||
#include "Video.h"
|
||||
#include "RGBMonitor.h"
|
||||
#include "NTSC.h"
|
||||
|
@ -109,9 +110,10 @@ bool g_bDisableDirectSound = false;
|
|||
bool g_bDisableDirectSoundMockingboard = false;
|
||||
int g_nMemoryClearType = MIP_FF_FF_00_00; // Note: -1 = random MIP in Memory.cpp MemReset()
|
||||
|
||||
CardManager g_CardMgr;
|
||||
IPropertySheet& sg_PropertySheet = * new CPropertySheet;
|
||||
|
||||
SynchronousEventManager g_SynchronousEventMgr;
|
||||
|
||||
HANDLE g_hCustomRomF8 = INVALID_HANDLE_VALUE; // Cmd-line specified custom F8 ROM at $F800..$FFFF
|
||||
static bool g_bCustomRomF8Failed = false; // Set if custom F8 ROM file failed
|
||||
HANDLE g_hCustomRom = INVALID_HANDLE_VALUE; // Cmd-line specified custom ROM at $C000..$FFFF(16KiB) or $D000..$FFFF(12KiB)
|
||||
|
@ -232,6 +234,12 @@ bool GetHookAltGrControl(void)
|
|||
return g_bHookAltGrControl;
|
||||
}
|
||||
|
||||
CardManager& GetCardMgr(void)
|
||||
{
|
||||
static CardManager g_CardMgr; // singleton
|
||||
return g_CardMgr;
|
||||
}
|
||||
|
||||
static void ResetToLogoMode(void)
|
||||
{
|
||||
g_nAppMode = MODE_LOGO;
|
||||
|
@ -318,7 +326,7 @@ static void ContinueExecution(void)
|
|||
const bool bWasFullSpeed = g_bFullSpeed;
|
||||
g_bFullSpeed = (g_dwSpeed == SPEED_MAX) ||
|
||||
bScrollLock_FullSpeed ||
|
||||
(g_CardMgr.GetDisk2CardMgr().IsConditionForFullSpeed() && !Spkr_IsActive() && !MB_IsActive()) ||
|
||||
(GetCardMgr().GetDisk2CardMgr().IsConditionForFullSpeed() && !Spkr_IsActive() && !MB_IsActive()) ||
|
||||
IsDebugSteppingAtFullSpeed();
|
||||
|
||||
if (g_bFullSpeed)
|
||||
|
@ -365,7 +373,7 @@ static void ContinueExecution(void)
|
|||
const DWORD uActualCyclesExecuted = CpuExecute(uCyclesToExecute, bVideoUpdate);
|
||||
g_dwCyclesThisFrame += uActualCyclesExecuted;
|
||||
|
||||
g_CardMgr.GetDisk2CardMgr().UpdateDriveState(uActualCyclesExecuted);
|
||||
GetCardMgr().GetDisk2CardMgr().UpdateDriveState(uActualCyclesExecuted);
|
||||
JoyUpdateButtonLatch(nExecutionPeriodUsec); // Button latch time is independent of CPU clock frequency
|
||||
PrintUpdate(uActualCyclesExecuted);
|
||||
MB_PeriodicUpdate(uActualCyclesExecuted);
|
||||
|
@ -699,8 +707,8 @@ void LoadConfiguration(void)
|
|||
serialPortName,
|
||||
CSuperSerialCard::SIZEOF_SERIALCHOICE_ITEM))
|
||||
{
|
||||
if (g_CardMgr.IsSSCInstalled())
|
||||
g_CardMgr.GetSSC()->SetSerialPortName(serialPortName);
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
GetCardMgr().GetSSC()->SetSerialPortName(serialPortName);
|
||||
}
|
||||
|
||||
REGLOAD_DEFAULT(TEXT(REGVALUE_EMULATION_SPEED), &g_dwSpeed, SPEED_NORMAL);
|
||||
|
@ -709,7 +717,7 @@ void LoadConfiguration(void)
|
|||
|
||||
DWORD dwEnhanceDisk;
|
||||
REGLOAD_DEFAULT(TEXT(REGVALUE_ENHANCE_DISK_SPEED), &dwEnhanceDisk, 1);
|
||||
g_CardMgr.GetDisk2CardMgr().SetEnhanceDisk(dwEnhanceDisk ? true : false);
|
||||
GetCardMgr().GetDisk2CardMgr().SetEnhanceDisk(dwEnhanceDisk ? true : false);
|
||||
|
||||
//
|
||||
|
||||
|
@ -770,9 +778,9 @@ void LoadConfiguration(void)
|
|||
sg_PropertySheet.SetMouseRestrictToWindow(dwTmp);
|
||||
|
||||
if(REGLOAD(TEXT(REGVALUE_SLOT4), &dwTmp))
|
||||
g_CardMgr.Insert(4, (SS_CARDTYPE)dwTmp);
|
||||
GetCardMgr().Insert(4, (SS_CARDTYPE)dwTmp);
|
||||
if(REGLOAD(TEXT(REGVALUE_SLOT5), &dwTmp))
|
||||
g_CardMgr.Insert(5, (SS_CARDTYPE)dwTmp);
|
||||
GetCardMgr().Insert(5, (SS_CARDTYPE)dwTmp);
|
||||
|
||||
//
|
||||
|
||||
|
@ -794,7 +802,7 @@ void LoadConfiguration(void)
|
|||
GetCurrentDirectory(sizeof(szFilename), szFilename);
|
||||
SetCurrentImageDir(szFilename);
|
||||
|
||||
g_CardMgr.GetDisk2CardMgr().LoadLastDiskImage();
|
||||
GetCardMgr().GetDisk2CardMgr().LoadLastDiskImage();
|
||||
|
||||
//
|
||||
|
||||
|
@ -1166,7 +1174,7 @@ static void SetCurrentDir(std::string pathname)
|
|||
|
||||
static bool DoDiskInsert(const UINT slot, const int nDrive, LPCSTR szFileName)
|
||||
{
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(slot));
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot));
|
||||
|
||||
std::string strPathName = GetFullPath(szFileName);
|
||||
if (strPathName.empty()) return false;
|
||||
|
@ -1414,7 +1422,7 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||
MB_Reset();
|
||||
LogFileOutput("Main: MB_Reset()\n");
|
||||
|
||||
CMouseInterface* pMouseCard = g_CardMgr.GetMouseCard();
|
||||
CMouseInterface* pMouseCard = GetCardMgr().GetMouseCard();
|
||||
if (pMouseCard)
|
||||
{
|
||||
pMouseCard->Reset(); // Deassert any pending IRQs - GH#514
|
||||
|
@ -1424,6 +1432,9 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||
DSUninit();
|
||||
LogFileOutput("Main: DSUninit()\n");
|
||||
|
||||
if (g_bRestart)
|
||||
g_SynchronousEventMgr.Reset();
|
||||
|
||||
if (g_bHookSystemKey)
|
||||
{
|
||||
UninitHookThread();
|
||||
|
@ -1736,8 +1747,8 @@ static bool ProcessCmdLine(LPSTR lpCmdLine)
|
|||
}
|
||||
else if ((strcmp(lpCmdLine, "-dcd") == 0) || (strcmp(lpCmdLine, "-modem") == 0)) // GH#386
|
||||
{
|
||||
if (g_CardMgr.IsSSCInstalled())
|
||||
g_CardMgr.GetSSC()->SupportDCD(true);
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
GetCardMgr().GetSSC()->SupportDCD(true);
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "-alt-enter=toggle-full-screen") == 0) // GH#556
|
||||
{
|
||||
|
@ -2052,23 +2063,23 @@ static void RepeatInitialization(void)
|
|||
// NB. this state is not persisted to the Registry/conf.ini (just as '-s7 empty' isn't)
|
||||
// TODO: support bSlotEmpty[] for slots: 0,4,5
|
||||
if (g_cmdLine.bSlotEmpty[SLOT1])
|
||||
g_CardMgr.Remove(SLOT1);
|
||||
GetCardMgr().Remove(SLOT1);
|
||||
if (g_cmdLine.bSlotEmpty[SLOT2])
|
||||
g_CardMgr.Remove(SLOT2);
|
||||
GetCardMgr().Remove(SLOT2);
|
||||
if (g_cmdLine.bSlotEmpty[SLOT3])
|
||||
g_CardMgr.Remove(SLOT3);
|
||||
GetCardMgr().Remove(SLOT3);
|
||||
if (g_cmdLine.bSlotEmpty[SLOT6])
|
||||
g_CardMgr.Remove(SLOT6);
|
||||
GetCardMgr().Remove(SLOT6);
|
||||
|
||||
if (g_cmdLine.slotInsert[SLOT5] != CT_Empty)
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(SLOT4) == CT_MockingboardC && g_cmdLine.slotInsert[SLOT5] != CT_MockingboardC) // Currently MB occupies slot4+5 when enabled
|
||||
if (GetCardMgr().QuerySlot(SLOT4) == CT_MockingboardC && g_cmdLine.slotInsert[SLOT5] != CT_MockingboardC) // Currently MB occupies slot4+5 when enabled
|
||||
{
|
||||
g_CardMgr.Remove(SLOT4);
|
||||
g_CardMgr.Remove(SLOT5);
|
||||
GetCardMgr().Remove(SLOT4);
|
||||
GetCardMgr().Remove(SLOT5);
|
||||
}
|
||||
|
||||
g_CardMgr.Insert(SLOT5, g_cmdLine.slotInsert[SLOT5]);
|
||||
GetCardMgr().Insert(SLOT5, g_cmdLine.slotInsert[SLOT5]);
|
||||
}
|
||||
|
||||
// Pre: may need g_hFrameWindow for MessageBox errors
|
||||
|
@ -2120,7 +2131,7 @@ static void RepeatInitialization(void)
|
|||
}
|
||||
|
||||
// Need to test if it's safe to call ResetMachineState(). In the meantime, just call Disk2Card's Reset():
|
||||
g_CardMgr.GetDisk2CardMgr().Reset(true); // Switch from a booting A][+ to a non-autostart A][, so need to turn off floppy motor
|
||||
GetCardMgr().GetDisk2CardMgr().Reset(true); // Switch from a booting A][+ to a non-autostart A][, so need to turn off floppy motor
|
||||
LogFileOutput("Main: DiskReset()\n");
|
||||
HD_Reset(); // GH#515
|
||||
LogFileOutput("Main: HDDReset()\n");
|
||||
|
@ -2214,8 +2225,6 @@ static void RepeatInitialization(void)
|
|||
g_cmdLine.bBoot = false;
|
||||
}
|
||||
}
|
||||
|
||||
SetMouseCardInstalled( g_CardMgr.IsMouseCardInstalled() );
|
||||
}
|
||||
|
||||
static void Shutdown(void)
|
||||
|
|
|
@ -52,7 +52,8 @@ extern bool g_bDisableDirectSound; // Cmd line switch: don't init DS (s
|
|||
extern bool g_bDisableDirectSoundMockingboard; // Cmd line switch: don't init MB support
|
||||
extern int g_nMemoryClearType; // Cmd line switch: use specific MIP (Memory Initialization Pattern)
|
||||
|
||||
extern class CardManager g_CardMgr;
|
||||
extern class CardManager& GetCardMgr(void);
|
||||
extern class SynchronousEventManager g_SynchronousEventMgr;
|
||||
|
||||
extern HANDLE g_hCustomRomF8; // INVALID_HANDLE_VALUE if no custom F8 rom
|
||||
extern HANDLE g_hCustomRom; // INVALID_HANDLE_VALUE if no custom rom
|
||||
|
|
|
@ -96,6 +96,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#ifdef USE_SPEECH_API
|
||||
#include "Speech.h"
|
||||
#endif
|
||||
#include "SynchronousEventManager.h"
|
||||
#include "Video.h"
|
||||
#include "NTSC.h"
|
||||
#include "Log.h"
|
||||
|
@ -149,8 +150,6 @@ static volatile BOOL g_bNmiFlank = FALSE; // Positive going flank on NMI line
|
|||
|
||||
static bool g_irqDefer1Opcode = false;
|
||||
|
||||
static bool g_isMouseCardInstalled = false;
|
||||
|
||||
//
|
||||
|
||||
static eCpuType g_MainCPU = CPU_65C02;
|
||||
|
@ -206,11 +205,6 @@ void ResetCyclesExecutedForDebugger(void)
|
|||
g_nCyclesExecuted = 0;
|
||||
}
|
||||
|
||||
void SetMouseCardInstalled(bool installed)
|
||||
{
|
||||
g_isMouseCardInstalled = installed;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
#include "CPU/cpu_general.inl"
|
||||
|
@ -403,8 +397,13 @@ static __forceinline void NMI(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn,
|
|||
#endif
|
||||
}
|
||||
|
||||
// NB. No need to save to save-state, as IRQ() follows CheckInterruptSources(), and IRQ() always sets it to false.
|
||||
static bool g_irqOnLastOpcodeCycle = false;
|
||||
static __forceinline void CheckSynchronousInterruptSources(UINT cycles, ULONG uExecutedCycles)
|
||||
{
|
||||
g_SynchronousEventMgr.Update(cycles, uExecutedCycles);
|
||||
}
|
||||
|
||||
// NB. No need to save to save-state, as IRQ() follows CheckSynchronousInterruptSources(), and IRQ() always sets it to false.
|
||||
bool g_irqOnLastOpcodeCycle = false;
|
||||
|
||||
static __forceinline void IRQ(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn, BOOL& flagv, BOOL& flagz)
|
||||
{
|
||||
|
@ -428,46 +427,19 @@ static __forceinline void IRQ(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn,
|
|||
PUSH(regs.pc & 0xFF)
|
||||
EF_TO_AF
|
||||
PUSH(regs.ps & ~AF_BREAK)
|
||||
regs.ps = regs.ps | AF_INTERRUPT & ~AF_DECIMAL;
|
||||
regs.ps = (regs.ps | AF_INTERRUPT) & (~AF_DECIMAL);
|
||||
regs.pc = * (WORD*) (mem+0xFFFE);
|
||||
UINT uExtraCycles = 0; // Needed for CYC(a) macro
|
||||
CYC(7)
|
||||
#if defined(_DEBUG) && LOG_IRQ_TAKEN_AND_RTI
|
||||
LogOutput("IRQ\n");
|
||||
#endif
|
||||
CheckSynchronousInterruptSources(7, uExecutedCycles);
|
||||
}
|
||||
|
||||
g_irqOnLastOpcodeCycle = false;
|
||||
}
|
||||
|
||||
const int IRQ_CHECK_OPCODE_FULL_SPEED = 40; // ~128 cycles (assume 3 cycles per opcode)
|
||||
static int g_fullSpeedOpcodeCount = IRQ_CHECK_OPCODE_FULL_SPEED;
|
||||
|
||||
static __forceinline void CheckInterruptSources(ULONG uExecutedCycles, const bool bVideoUpdate)
|
||||
{
|
||||
if (!bVideoUpdate)
|
||||
{
|
||||
g_fullSpeedOpcodeCount--;
|
||||
if (g_fullSpeedOpcodeCount >= 0)
|
||||
return;
|
||||
g_fullSpeedOpcodeCount = IRQ_CHECK_OPCODE_FULL_SPEED;
|
||||
}
|
||||
|
||||
if (MB_UpdateCycles(uExecutedCycles))
|
||||
g_irqOnLastOpcodeCycle = true;
|
||||
|
||||
if (g_isMouseCardInstalled)
|
||||
g_CardMgr.GetMouseCard()->SetVBlank( !VideoGetVblBar(uExecutedCycles) );
|
||||
}
|
||||
|
||||
// GH#608: IRQ needs to occur within 17 cycles (6 opcodes) of configuring the timer interrupt
|
||||
void CpuAdjustIrqCheck(UINT uCyclesUntilInterrupt)
|
||||
{
|
||||
const UINT opcodesUntilInterrupt = uCyclesUntilInterrupt/3; // assume 3 cycles per opcode
|
||||
if (g_bFullSpeed && opcodesUntilInterrupt < IRQ_CHECK_OPCODE_FULL_SPEED)
|
||||
g_fullSpeedOpcodeCount = opcodesUntilInterrupt;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
#define READ _READ
|
||||
|
@ -506,7 +478,7 @@ void CpuAdjustIrqCheck(UINT uCyclesUntilInterrupt)
|
|||
|
||||
static DWORD InternalCpuExecute(const DWORD uTotalCycles, const bool bVideoUpdate)
|
||||
{
|
||||
if (g_nAppMode == MODE_RUNNING)
|
||||
if (g_nAppMode == MODE_RUNNING || g_nAppMode == MODE_BENCHMARK)
|
||||
{
|
||||
if (GetMainCpu() == CPU_6502)
|
||||
return Cpu6502(uTotalCycles, bVideoUpdate); // Apple ][, ][+, //e, Clones
|
||||
|
|
|
@ -14,7 +14,6 @@ struct regsrec
|
|||
extern regsrec regs;
|
||||
extern unsigned __int64 g_nCumulativeCycles;
|
||||
|
||||
void CpuAdjustIrqCheck(UINT uCyclesUntilInterrupt);
|
||||
void CpuDestroy ();
|
||||
void CpuCalcCycles(ULONG nExecutedCycles);
|
||||
DWORD CpuExecute(const DWORD uCycles, const bool bVideoUpdate);
|
||||
|
@ -45,4 +44,3 @@ void SetActiveCpu(eCpuType cpu);
|
|||
|
||||
bool Is6502InterruptEnabled(void);
|
||||
void ResetCyclesExecutedForDebugger(void);
|
||||
void SetMouseCardInstalled(bool installed);
|
||||
|
|
|
@ -317,7 +317,7 @@ static DWORD Cpu6502(DWORD uTotalCycles, const bool bVideoUpdate)
|
|||
}
|
||||
}
|
||||
|
||||
CheckInterruptSources(uExecutedCycles, bVideoUpdate);
|
||||
CheckSynchronousInterruptSources(uExecutedCycles - uPreviousCycles, uExecutedCycles);
|
||||
NMI(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||
IRQ(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||
|
||||
|
|
|
@ -317,7 +317,7 @@ static DWORD Cpu65C02(DWORD uTotalCycles, const bool bVideoUpdate)
|
|||
}
|
||||
}
|
||||
|
||||
CheckInterruptSources(uExecutedCycles, bVideoUpdate);
|
||||
CheckSynchronousInterruptSources(uExecutedCycles - uPreviousCycles, uExecutedCycles);
|
||||
NMI(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||
IRQ(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ enum AppMode_e
|
|||
, MODE_RUNNING // 6502 is running at normal/full speed (Debugger breakpoints may or may not be active)
|
||||
, MODE_DEBUG // 6502 is paused
|
||||
, MODE_STEPPING // 6502 is running at normal/full speed (Debugger breakpoints always active)
|
||||
, MODE_BENCHMARK
|
||||
};
|
||||
|
||||
#define SPEED_MIN 0
|
||||
|
|
|
@ -20,9 +20,9 @@ public:
|
|||
m_bEnableTheFreezesF8Rom = bEnableTheFreezesF8Rom;
|
||||
memset(&m_Slot, 0, sizeof(m_Slot));
|
||||
m_SlotAux = CT_Empty;
|
||||
m_Slot[SLOT4] = g_CardMgr.QuerySlot(SLOT4);
|
||||
m_Slot[SLOT5] = g_CardMgr.QuerySlot(SLOT5);
|
||||
m_Slot[SLOT7] = g_CardMgr.QuerySlot(SLOT7);
|
||||
m_Slot[SLOT4] = GetCardMgr().QuerySlot(SLOT4);
|
||||
m_Slot[SLOT5] = GetCardMgr().QuerySlot(SLOT5);
|
||||
m_Slot[SLOT7] = GetCardMgr().QuerySlot(SLOT7);
|
||||
}
|
||||
|
||||
const CConfigNeedingRestart& operator= (const CConfigNeedingRestart& other)
|
||||
|
|
|
@ -206,9 +206,9 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM
|
|||
CheckDlgButton(hWnd, IDC_CHECK_VERTICAL_BLEND, IsVideoStyle(VS_COLOR_VERTICAL_BLEND) ? BST_CHECKED : BST_UNCHECKED);
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_CHECK_VERTICAL_BLEND), (GetVideoType() == VT_COLOR_MONITOR_RGB) ? TRUE : FALSE);
|
||||
|
||||
if (g_CardMgr.IsSSCInstalled())
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
{
|
||||
CSuperSerialCard* pSSC = g_CardMgr.GetSSC();
|
||||
CSuperSerialCard* pSSC = GetCardMgr().GetSSC();
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_SERIALPORT, pSSC->GetSerialPortChoices(), pSSC->GetSerialPort());
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_SERIALPORT), !pSSC->IsActive() ? TRUE : FALSE);
|
||||
}
|
||||
|
@ -344,9 +344,9 @@ void CPageConfig::DlgOK(HWND hWnd)
|
|||
|
||||
//
|
||||
|
||||
if (g_CardMgr.IsSSCInstalled())
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
{
|
||||
CSuperSerialCard* pSSC = g_CardMgr.GetSSC();
|
||||
CSuperSerialCard* pSSC = GetCardMgr().GetSSC();
|
||||
const DWORD uNewSerialPort = (DWORD) SendDlgItemMessage(hWnd, IDC_SERIALPORT, CB_GETCURSEL, 0, 0);
|
||||
pSSC->CommSetSerialPort(hWnd, uNewSerialPort);
|
||||
RegSaveString( TEXT(REG_CONFIG),
|
||||
|
|
|
@ -131,9 +131,9 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
|
|||
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_DISKTYPE, m_discchoices, g_CardMgr.GetDisk2CardMgr().GetEnhanceDisk() ? 1 : 0);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_DISKTYPE, m_discchoices, GetCardMgr().GetDisk2CardMgr().GetEnhanceDisk() ? 1 : 0);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
InitComboFloppyDrive(hWnd, SLOT6);
|
||||
else
|
||||
EnableFloppyDrive(hWnd, FALSE);
|
||||
|
@ -160,7 +160,7 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
|
|||
|
||||
void CPageDisk::InitComboFloppyDrive(HWND hWnd, UINT slot)
|
||||
{
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(slot));
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot));
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK1, m_defaultDiskOptions, -1);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK2, m_defaultDiskOptions, -1);
|
||||
|
@ -199,9 +199,9 @@ void CPageDisk::InitComboHDD(HWND hWnd, UINT /*slot*/)
|
|||
void CPageDisk::DlgOK(HWND hWnd)
|
||||
{
|
||||
const bool bNewEnhanceDisk = SendDlgItemMessage(hWnd, IDC_DISKTYPE,CB_GETCURSEL, 0, 0) ? true : false;
|
||||
if (bNewEnhanceDisk != g_CardMgr.GetDisk2CardMgr().GetEnhanceDisk())
|
||||
if (bNewEnhanceDisk != GetCardMgr().GetDisk2CardMgr().GetEnhanceDisk())
|
||||
{
|
||||
g_CardMgr.GetDisk2CardMgr().SetEnhanceDisk(bNewEnhanceDisk);
|
||||
GetCardMgr().GetDisk2CardMgr().SetEnhanceDisk(bNewEnhanceDisk);
|
||||
REGSAVE(TEXT(REGVALUE_ENHANCE_DISK_SPEED), (DWORD)bNewEnhanceDisk);
|
||||
}
|
||||
|
||||
|
@ -302,13 +302,13 @@ void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected
|
|||
|
||||
void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT comboSelected)
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(SLOT6) != CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2)
|
||||
{
|
||||
_ASSERT(0); // Shouldn't come here, as the combo is disabled
|
||||
return;
|
||||
}
|
||||
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6));
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
|
||||
|
||||
// Search from "select floppy drive"
|
||||
DWORD dwOpenDialogIndex = (DWORD)SendDlgItemMessage(hWnd, comboSelected, CB_FINDSTRINGEXACT, -1, (LPARAM)&m_defaultDiskOptions[0]);
|
||||
|
|
|
@ -117,7 +117,7 @@ BOOL CPageSound::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM
|
|||
SendDlgItemMessage(hWnd,IDC_MB_VOLUME,TBM_SETTICFREQ,10,0);
|
||||
SendDlgItemMessage(hWnd,IDC_MB_VOLUME,TBM_SETPOS,1,MB_GetVolume());
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT5) == CT_SAM)
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_SAM)
|
||||
m_NewCardType = CT_SAM;
|
||||
else
|
||||
m_NewCardType = MB_GetSoundcardType(); // Reinit 1st time page is activated (fires before PSN_SETACTIVE)
|
||||
|
|
|
@ -128,8 +128,8 @@ void CPropertySheetHelper::SetSlot(UINT slot, SS_CARDTYPE newCardType)
|
|||
// Two paths:
|
||||
// 1) Via Config dialog: card not inserted yet
|
||||
// 2) Snapshot_LoadState_v2(): card already inserted
|
||||
if (g_CardMgr.QuerySlot(slot) != newCardType)
|
||||
g_CardMgr.Insert(slot, newCardType);
|
||||
if (GetCardMgr().QuerySlot(slot) != newCardType)
|
||||
GetCardMgr().Insert(slot, newCardType);
|
||||
|
||||
std::string slotText;
|
||||
switch (slot)
|
||||
|
@ -214,10 +214,10 @@ void CPropertySheetHelper::SaveStateUpdate()
|
|||
|
||||
void CPropertySheetHelper::GetDiskBaseNameWithAWS(std::string & pszFilename)
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(SLOT6) != CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2)
|
||||
return;
|
||||
|
||||
const std::string& diskName = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).GetBaseName(DRIVE_1);
|
||||
const std::string& diskName = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).GetBaseName(DRIVE_1);
|
||||
if (!diskName.empty())
|
||||
{
|
||||
pszFilename = diskName + ".aws.yaml";
|
||||
|
@ -453,8 +453,8 @@ void CPropertySheetHelper::SaveCurrentConfig(void)
|
|||
// NB. clone-type is encoded in g_Apple2Type
|
||||
m_ConfigOld.m_Apple2Type = GetApple2Type();
|
||||
m_ConfigOld.m_CpuType = GetMainCpu();
|
||||
m_ConfigOld.m_Slot[SLOT4] = g_CardMgr.QuerySlot(SLOT4);
|
||||
m_ConfigOld.m_Slot[SLOT5] = g_CardMgr.QuerySlot(SLOT5);
|
||||
m_ConfigOld.m_Slot[SLOT4] = GetCardMgr().QuerySlot(SLOT4);
|
||||
m_ConfigOld.m_Slot[SLOT5] = GetCardMgr().QuerySlot(SLOT5);
|
||||
m_ConfigOld.m_bEnableHDD = HD_CardIsEnabled();
|
||||
m_ConfigOld.m_bEnableTheFreezesF8Rom = sg_PropertySheet.GetTheFreezesF8Rom();
|
||||
m_ConfigOld.m_videoRefreshRate = GetVideoRefreshRate();
|
||||
|
@ -472,8 +472,8 @@ void CPropertySheetHelper::RestoreCurrentConfig(void)
|
|||
// NB. clone-type is encoded in g_Apple2Type
|
||||
SetApple2Type(m_ConfigOld.m_Apple2Type);
|
||||
SetMainCpu(m_ConfigOld.m_CpuType);
|
||||
g_CardMgr.Insert(SLOT4, m_ConfigOld.m_Slot[SLOT4]);
|
||||
g_CardMgr.Insert(SLOT5, m_ConfigOld.m_Slot[SLOT5]);
|
||||
GetCardMgr().Insert(SLOT4, m_ConfigOld.m_Slot[SLOT4]);
|
||||
GetCardMgr().Insert(SLOT5, m_ConfigOld.m_Slot[SLOT5]);
|
||||
HD_SetEnabled(m_ConfigOld.m_bEnableHDD);
|
||||
sg_PropertySheet.SetTheFreezesF8Rom(m_ConfigOld.m_bEnableTheFreezesF8Rom);
|
||||
SetVideoRefreshRate(m_ConfigOld.m_videoRefreshRate);
|
||||
|
|
|
@ -297,8 +297,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
|
||||
static bool g_bBenchmarking = false;
|
||||
|
||||
static BOOL fulldisp = 0;
|
||||
|
||||
static BOOL g_bProfiling = 0;
|
||||
static int g_nDebugSteps = 0;
|
||||
static DWORD g_nDebugStepCycles = 0;
|
||||
|
@ -900,7 +898,7 @@ static void SetDebugBreakOnInvalid( int iOpcodeType, int nValue )
|
|||
Update_t CmdBreakInvalid (int nArgs) // Breakpoint IFF Full-speed!
|
||||
{
|
||||
if (nArgs > 2) // || (nArgs == 0))
|
||||
goto _Help;
|
||||
return HelpLastCommand();
|
||||
|
||||
int iType = AM_IMPLIED; // default to BRK
|
||||
int nActive = 0;
|
||||
|
@ -1828,7 +1826,13 @@ Update_t _CmdAssemble( WORD nAddress, int iArg, int nArgs )
|
|||
|
||||
bool bStatus = Assemble( iArg, nArgs, nAddress );
|
||||
if ( bStatus)
|
||||
{
|
||||
// move disassembler to current address
|
||||
g_nDisasmCurAddress = g_nAssemblerAddress;
|
||||
WindowUpdateDisasmSize(); // calc cur line
|
||||
DisasmCalcTopBotAddress();
|
||||
return UPDATE_ALL;
|
||||
}
|
||||
|
||||
return UPDATE_CONSOLE_DISPLAY; // UPDATE_NOTHING;
|
||||
}
|
||||
|
@ -1847,6 +1851,14 @@ Update_t CmdAssemble (int nArgs)
|
|||
// 1 : A address
|
||||
// 2+: A address mnemonic...
|
||||
|
||||
if (nArgs > 0)
|
||||
g_nAssemblerAddress = g_aArgs[1].nValue;
|
||||
|
||||
// move disassembler window to current assembler address
|
||||
g_nDisasmCurAddress = g_nAssemblerAddress; // (2)
|
||||
WindowUpdateDisasmSize(); // calc cur line
|
||||
DisasmCalcTopBotAddress();
|
||||
|
||||
if (! nArgs)
|
||||
{
|
||||
// return Help_Arg_1( CMD_ASSEMBLE );
|
||||
|
@ -1855,8 +1867,6 @@ Update_t CmdAssemble (int nArgs)
|
|||
AssemblerOn();
|
||||
return UPDATE_CONSOLE_DISPLAY;
|
||||
}
|
||||
|
||||
g_nAssemblerAddress = g_aArgs[1].nValue;
|
||||
|
||||
if (nArgs == 1)
|
||||
{
|
||||
|
@ -2192,7 +2202,7 @@ Update_t CmdNOP (int nArgs)
|
|||
int iOpmode;
|
||||
int nOpbytes;
|
||||
|
||||
_6502_GetOpcodeOpmodeOpbyte( iOpcode, iOpmode, nOpbytes );
|
||||
_6502_GetOpcodeOpmodeOpbyte( iOpcode, iOpmode, nOpbytes );
|
||||
|
||||
while (nOpbytes--)
|
||||
{
|
||||
|
@ -3036,7 +3046,7 @@ void DisasmCalcTopFromCurAddress( bool bUpdateTop )
|
|||
break;
|
||||
}
|
||||
iTop++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! bFound)
|
||||
{
|
||||
|
@ -3063,7 +3073,7 @@ void DisasmCalcTopFromCurAddress( bool bUpdateTop )
|
|||
MessageBox( g_hFrameWindow, sText, "ERROR", MB_OK );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
|
@ -3756,12 +3766,12 @@ Update_t CmdFlag (int nArgs)
|
|||
Update_t CmdDisk ( int nArgs)
|
||||
{
|
||||
if (! nArgs)
|
||||
goto _Help;
|
||||
return HelpLastCommand();
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT6) != CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2)
|
||||
return ConsoleDisplayError("No DiskII card in slot-6");
|
||||
|
||||
Disk2InterfaceCard& diskCard = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6));
|
||||
Disk2InterfaceCard& diskCard = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
|
||||
|
||||
// check for info command
|
||||
int iParam = 0;
|
||||
|
@ -3770,7 +3780,7 @@ Update_t CmdDisk ( int nArgs)
|
|||
if (iParam == PARAM_DISK_INFO)
|
||||
{
|
||||
if (nArgs > 2)
|
||||
goto _Help;
|
||||
return HelpLastCommand();
|
||||
|
||||
char buffer[200] = "";
|
||||
ConsoleBufferPushFormat(buffer, "FW%2d: D%d at T$%s, phase $%s, offset $%X, mask $%02X, extraCycles %.2f, %s",
|
||||
|
@ -3788,7 +3798,7 @@ Update_t CmdDisk ( int nArgs)
|
|||
}
|
||||
|
||||
if (nArgs < 2)
|
||||
goto _Help;
|
||||
return HelpLastCommand();
|
||||
|
||||
// first param should be drive
|
||||
int iDrive = g_aArgs[ 1 ].nValue;
|
||||
|
@ -3802,12 +3812,12 @@ Update_t CmdDisk ( int nArgs)
|
|||
int nFound = FindParam( g_aArgs[ 2 ].sArg, MATCH_EXACT, iParam, _PARAM_DISK_BEGIN, _PARAM_DISK_END );
|
||||
|
||||
if (! nFound)
|
||||
goto _Help;
|
||||
return HelpLastCommand();
|
||||
|
||||
if (iParam == PARAM_DISK_EJECT)
|
||||
{
|
||||
if (nArgs > 2)
|
||||
goto _Help;
|
||||
return HelpLastCommand();
|
||||
|
||||
diskCard.EjectDisk( iDrive );
|
||||
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
|
||||
|
@ -3816,7 +3826,7 @@ Update_t CmdDisk ( int nArgs)
|
|||
if (iParam == PARAM_DISK_PROTECT)
|
||||
{
|
||||
if (nArgs > 3)
|
||||
goto _Help;
|
||||
return HelpLastCommand();
|
||||
|
||||
bool bProtect = true;
|
||||
|
||||
|
@ -3829,7 +3839,7 @@ Update_t CmdDisk ( int nArgs)
|
|||
else
|
||||
{
|
||||
if (nArgs != 3)
|
||||
goto _Help;
|
||||
return HelpLastCommand();
|
||||
|
||||
LPCTSTR pDiskName = g_aArgs[ 3 ].sArg;
|
||||
|
||||
|
@ -3839,9 +3849,6 @@ Update_t CmdDisk ( int nArgs)
|
|||
}
|
||||
|
||||
return UPDATE_CONSOLE_DISPLAY;
|
||||
|
||||
_Help:
|
||||
return HelpLastCommand();
|
||||
}
|
||||
|
||||
|
||||
|
@ -4767,7 +4774,7 @@ Update_t CmdMemorySave (int nArgs)
|
|||
// if (g_aArgs[1].bType & TOKEN_QUOTE_DOUBLE)
|
||||
// bHaveFileName = true;
|
||||
|
||||
int iArgComma1 = 2;
|
||||
// int iArgComma1 = 2;
|
||||
int iArgAddress = 3;
|
||||
int iArgComma2 = 4;
|
||||
int iArgLength = 5;
|
||||
|
@ -4776,7 +4783,7 @@ Update_t CmdMemorySave (int nArgs)
|
|||
|
||||
if (! bHaveFileName)
|
||||
{
|
||||
iArgComma1 = 1;
|
||||
// iArgComma1 = 1;
|
||||
iArgAddress = 2;
|
||||
iArgComma2 = 3;
|
||||
iArgLength = 4;
|
||||
|
@ -5772,8 +5779,6 @@ int _SearchMemoryFind(
|
|||
// if next block matches, then this block matches (since we are wild)
|
||||
if ((iBlock + 1) == nMemBlocks) // there is no next block, hence we match
|
||||
continue;
|
||||
|
||||
MemorySearch_t ms2 = vMemorySearchValues.at( iBlock + 1 );
|
||||
|
||||
WORD nAddress3 = nAddress2;
|
||||
for (nAddress3 = nAddress2; nAddress3 < nAddressEnd; nAddress3++ )
|
||||
|
@ -6338,12 +6343,11 @@ Update_t CmdOutputPrintf (int nArgs)
|
|||
int nValue = 0;
|
||||
|
||||
if (! nArgs)
|
||||
goto _Help;
|
||||
return Help_Arg_1( CMD_OUTPUT_PRINTF );
|
||||
|
||||
int nLen = 0;
|
||||
|
||||
PrintState_e eThis = PS_LITERAL;
|
||||
// PrintState_e eNext = PS_NEXT_ARG_HEX; // PS_LITERAL;
|
||||
|
||||
int nWidth = 0;
|
||||
|
||||
|
@ -6503,7 +6507,7 @@ Update_t CmdOutputRun (int nArgs)
|
|||
|
||||
// if (g_aArgs[1].bType & TYPE_QUOTED_2)
|
||||
|
||||
sMiniFileName = pFileName.substr(0, min(pFileName.size(), CONSOLE_WIDTH));
|
||||
sMiniFileName = pFileName.substr(0, MIN(pFileName.size(), CONSOLE_WIDTH));
|
||||
// _tcscat( sMiniFileName, ".aws" ); // HACK: MAGIC STRING
|
||||
|
||||
if (pFileName[0] == '\\' || pFileName[1] == ':') // NB. Any prefix quote has already been stripped
|
||||
|
@ -6780,7 +6784,7 @@ Update_t CmdSource (int nArgs)
|
|||
const std::string sFileName = g_sProgramDir + pFileName;
|
||||
|
||||
const int MAX_MINI_FILENAME = 20;
|
||||
const std::string sMiniFileName = sFileName.substr(0, min(MAX_MINI_FILENAME, sFileName.size()));
|
||||
const std::string sMiniFileName = sFileName.substr(0, MIN(MAX_MINI_FILENAME, sFileName.size()));
|
||||
|
||||
TCHAR buffer[MAX_PATH] = { 0 };
|
||||
|
||||
|
@ -7845,7 +7849,7 @@ int FindCommand( LPCTSTR pName, CmdFuncPtr_t & pFunction_, int * iCommand_ )
|
|||
if (iCommand_)
|
||||
*iCommand_ = iCommand;
|
||||
// !_tcscmp
|
||||
if (!_tcsicmp(pName, pCommandName)) // exact match?
|
||||
if (!_tcsicmp(sCommand, pCommandName)) // exact match?
|
||||
{
|
||||
// if (iCommand_)
|
||||
// *iCommand_ = iCommand;
|
||||
|
@ -7973,8 +7977,9 @@ Update_t ExecuteCommand (int nArgs)
|
|||
}
|
||||
else
|
||||
// ####L -> Unassemble $address
|
||||
if ((pCommand[nLen-1] == 'L') ||
|
||||
(pCommand[nLen-1] == 'l'))
|
||||
if (((pCommand[nLen-1] == 'L') ||
|
||||
(pCommand[nLen-1] == 'l'))&&
|
||||
(strcmp("cl", pCommand) != 0)) // workaround for ambiguous "cl": must be handled by "clear flag" command
|
||||
{
|
||||
pCommand[nLen-1] = 0;
|
||||
ArgsGetValue( pArg, & nAddress );
|
||||
|
|
|
@ -858,10 +858,10 @@ bool _6502_IsOpcodeValid ( int iOpcode )
|
|||
|
||||
|
||||
//===========================================================================
|
||||
int AssemblerHashMnemonic ( const TCHAR * pMnemonic )
|
||||
Hash_t AssemblerHashMnemonic ( const TCHAR * pMnemonic )
|
||||
{
|
||||
const TCHAR *pText = pMnemonic;
|
||||
int nMnemonicHash = 0;
|
||||
Hash_t nMnemonicHash = 0;
|
||||
int iHighBits;
|
||||
|
||||
const int NUM_LOW_BITS = 19; // 24 -> 19 prime
|
||||
|
@ -1471,7 +1471,7 @@ bool Assemble( int iArg, int nArgs, WORD nAddress )
|
|||
m_nAsmBaseAddress = nAddress;
|
||||
|
||||
TCHAR *pMnemonic = g_aArgs[ iArg ].sArg;
|
||||
int nMnemonicHash = AssemblerHashMnemonic( pMnemonic );
|
||||
Hash_t nMnemonicHash = AssemblerHashMnemonic( pMnemonic );
|
||||
|
||||
#if DEBUG_ASSEMBLER
|
||||
char sText[ CONSOLE_WIDTH * 2 ];
|
||||
|
|
|
@ -199,7 +199,7 @@ extern int g_aAssemblerFirstDirective[ NUM_ASSEMBLERS ];
|
|||
bool _6502_IsOpcodeBranch( int nOpcode );
|
||||
bool _6502_IsOpcodeValid( int nOpcode );
|
||||
|
||||
int AssemblerHashMnemonic ( const TCHAR * pMnemonic );
|
||||
Hash_t AssemblerHashMnemonic ( const TCHAR * pMnemonic );
|
||||
// bool AssemblerGetAddressingMode ( int iArg, int nArgs, WORD nAddress, std::vector<int> & vOpcodes );
|
||||
void _CmdAssembleHashDump ();
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ bool DebuggerSetColor( const int iScheme, const int iColor, const COLORREF nColo
|
|||
bStatus = true;
|
||||
}
|
||||
|
||||
// Propogate to console since it has its own copy of colors
|
||||
// Propagate to console since it has its own copy of colors
|
||||
if (iColor == FG_CONSOLE_OUTPUT)
|
||||
{
|
||||
COLORREF nConsole = DebuggerGetColor( FG_CONSOLE_OUTPUT );
|
||||
|
|
|
@ -116,7 +116,7 @@ WORD _CmdDefineByteRange(int nArgs,int iArg,DisasmData_t & tData_)
|
|||
else
|
||||
sprintf( aSymbolName, "B_%04X", tData_.nStartAddress ); // DB range
|
||||
|
||||
pSymbolName = aSymbolName;
|
||||
pSymbolName = aSymbolName;
|
||||
}
|
||||
|
||||
// bRemoveSymbol = false // use arg[2]
|
||||
|
|
|
@ -3528,7 +3528,7 @@ void DrawZeroPagePointers ( int line )
|
|||
}
|
||||
else
|
||||
{
|
||||
int nMin = min( nLen1, nMaxSymbolLen );
|
||||
int nMin = MIN( nLen1, nMaxSymbolLen );
|
||||
memcpy(sText, pSymbol1, nMin);
|
||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_SYMBOL ) );
|
||||
}
|
||||
|
@ -3970,7 +3970,7 @@ void DrawSubWindow_Source2 (Update_t bUpdate)
|
|||
|
||||
// Draw Title
|
||||
std::string sTitle = " Source: " + g_aSourceFileName;
|
||||
sTitle.resize(min(sTitle.size(), size_t(g_nConsoleDisplayWidth)));
|
||||
sTitle.resize(MIN(sTitle.size(), size_t(g_nConsoleDisplayWidth)));
|
||||
|
||||
DebuggerSetColorBG( DebuggerGetColor( BG_SOURCE_TITLE ));
|
||||
DebuggerSetColorFG( DebuggerGetColor( FG_SOURCE_TITLE ));
|
||||
|
|
|
@ -877,7 +877,8 @@ Update_t CmdHelpSpecific (int nArgs)
|
|||
{
|
||||
// CPU / General
|
||||
case CMD_ASSEMBLE:
|
||||
ConsoleBufferPush( " Built-in assember isn't functional yet." );
|
||||
ConsoleColorizePrint( sText, " Usage: [address | symbol]" );
|
||||
ConsoleBufferPush( " Enter mini-assembler mode [starting at optional address or symbol]." );
|
||||
break;
|
||||
case CMD_UNASSEMBLE:
|
||||
ConsoleColorizePrint( sText, " Usage: [address | symbol]" );
|
||||
|
|
|
@ -556,7 +556,7 @@ int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSym
|
|||
char sText[ CONSOLE_WIDTH * 3 ];
|
||||
bool bFileDisplayed = false;
|
||||
|
||||
const int nMaxLen = min(MAX_TARGET_LEN,MAX_SYMBOLS_LEN);
|
||||
const int nMaxLen = MIN(MAX_TARGET_LEN,MAX_SYMBOLS_LEN);
|
||||
|
||||
int nSymbolsLoaded = 0;
|
||||
|
||||
|
|
|
@ -1543,19 +1543,7 @@ const DisasmData_t* pDisasmData; // If != NULL then bytes are marked up as data
|
|||
|
||||
struct WindowSplit_t
|
||||
{
|
||||
RECT tBoundingBox; //
|
||||
|
||||
int nWidth ; // Width & Height are always valid
|
||||
int nHeight; // If window is split/join, then auto-updated (right,bottom)
|
||||
|
||||
int nCursorY; // Address
|
||||
int nCursorX; // or line,col of text file ...
|
||||
|
||||
int bSplit ;
|
||||
|
||||
int iParent;// index into g_aWindowConfig
|
||||
int iChild ; // index into g_aWindowConfig
|
||||
|
||||
Window_e eTop;
|
||||
Window_e eBot;
|
||||
};
|
||||
|
|
|
@ -38,9 +38,9 @@ bool Disk2CardManager::IsConditionForFullSpeed(void)
|
|||
{
|
||||
for (UINT i = 0; i < NUM_SLOTS; i++)
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(i) == CT_Disk2)
|
||||
{
|
||||
if (dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).IsConditionForFullSpeed())
|
||||
if (dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).IsConditionForFullSpeed())
|
||||
return true; // if any card is true then the condition for full-speed is true
|
||||
}
|
||||
}
|
||||
|
@ -52,9 +52,9 @@ void Disk2CardManager::UpdateDriveState(UINT cycles)
|
|||
{
|
||||
for (UINT i = 0; i < NUM_SLOTS; i++)
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(i) == CT_Disk2)
|
||||
{
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).UpdateDriveState(cycles);
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).UpdateDriveState(cycles);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,9 +63,9 @@ void Disk2CardManager::Reset(const bool powerCycle /*=false*/)
|
|||
{
|
||||
for (UINT i = 0; i < NUM_SLOTS; i++)
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(i) == CT_Disk2)
|
||||
{
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).Reset(powerCycle);
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).Reset(powerCycle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,10 +74,10 @@ bool Disk2CardManager::GetEnhanceDisk(void)
|
|||
{
|
||||
for (UINT i = 0; i < NUM_SLOTS; i++)
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(i) == CT_Disk2)
|
||||
{
|
||||
// All Disk2 cards should have the same setting, so just return the state of the first card
|
||||
return dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).GetEnhanceDisk();
|
||||
return dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).GetEnhanceDisk();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -87,9 +87,9 @@ void Disk2CardManager::SetEnhanceDisk(bool enhanceDisk)
|
|||
{
|
||||
for (UINT i = 0; i < NUM_SLOTS; i++)
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(i) == CT_Disk2)
|
||||
{
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).SetEnhanceDisk(enhanceDisk);
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).SetEnhanceDisk(enhanceDisk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,10 +100,10 @@ void Disk2CardManager::LoadLastDiskImage(void)
|
|||
{
|
||||
if (i != SLOT6) continue; // FIXME
|
||||
|
||||
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(i) == CT_Disk2)
|
||||
{
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).LoadLastDiskImage(DRIVE_1);
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).LoadLastDiskImage(DRIVE_2);
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).LoadLastDiskImage(DRIVE_1);
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).LoadLastDiskImage(DRIVE_2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,9 +112,9 @@ void Disk2CardManager::Destroy(void)
|
|||
{
|
||||
for (UINT i = 0; i < NUM_SLOTS; i++)
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(i) == CT_Disk2)
|
||||
{
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).Destroy();
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,10 +123,10 @@ bool Disk2CardManager::IsAnyFirmware13Sector(void)
|
|||
{
|
||||
for (UINT i = 0; i < NUM_SLOTS; i++)
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(i) == CT_Disk2)
|
||||
{
|
||||
// If any Disk2 card has 13-sector firmware then return true
|
||||
if (dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).GetCurrentFirmware() == 13)
|
||||
if (dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).GetCurrentFirmware() == 13)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
155
source/Frame.cpp
155
source/Frame.cpp
|
@ -281,7 +281,7 @@ static void GetAppleWindowTitle()
|
|||
|
||||
g_pAppTitle += VideoGetAppWindowTitle();
|
||||
|
||||
if (g_CardMgr.GetDisk2CardMgr().IsAnyFirmware13Sector())
|
||||
if (GetCardMgr().GetDisk2CardMgr().IsAnyFirmware13Sector())
|
||||
g_pAppTitle += " (S6-13) ";
|
||||
|
||||
if (g_hCustomRomF8 != INVALID_HANDLE_VALUE)
|
||||
|
@ -328,7 +328,7 @@ static void FrameShowCursor(BOOL bShow)
|
|||
// . AppleWin's main window is activated/deactivated
|
||||
static void RevealCursor()
|
||||
{
|
||||
CMouseInterface* pMouseCard = g_CardMgr.GetMouseCard();
|
||||
CMouseInterface* pMouseCard = GetCardMgr().GetMouseCard();
|
||||
|
||||
if (!pMouseCard || !pMouseCard->IsActiveAndEnabled())
|
||||
return;
|
||||
|
@ -355,7 +355,7 @@ static void FullScreenRevealCursor(void)
|
|||
if (!g_bIsFullScreen)
|
||||
return;
|
||||
|
||||
if (g_CardMgr.IsMouseCardInstalled())
|
||||
if (GetCardMgr().IsMouseCardInstalled())
|
||||
return;
|
||||
|
||||
if (!g_bUsingCursor && !g_bShowingCursor)
|
||||
|
@ -521,8 +521,8 @@ static void DrawButton (HDC passdc, int number) {
|
|||
SetTextAlign(dc,TA_CENTER | TA_TOP);
|
||||
SetBkMode(dc,TRANSPARENT);
|
||||
|
||||
LPCTSTR pszBaseName = (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
? dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).GetBaseName(number-BTN_DRIVE1).c_str()
|
||||
LPCTSTR pszBaseName = (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
? dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).GetBaseName(number-BTN_DRIVE1).c_str()
|
||||
: "";
|
||||
|
||||
ExtTextOut(dc,x+offset+22,rect.top,ETO_CLIPPED,&rect,
|
||||
|
@ -717,15 +717,15 @@ void FrameDrawDiskLEDS( HDC passdc )
|
|||
g_eStatusDrive2 = DISK_STATUS_OFF;
|
||||
|
||||
// Slot6 drive takes priority unless it's off:
|
||||
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).GetLightStatus(&g_eStatusDrive1, &g_eStatusDrive2);
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).GetLightStatus(&g_eStatusDrive1, &g_eStatusDrive2);
|
||||
|
||||
// Slot5:
|
||||
{
|
||||
Disk_Status_e eDrive1StatusSlot5 = DISK_STATUS_OFF;
|
||||
Disk_Status_e eDrive2StatusSlot5 = DISK_STATUS_OFF;
|
||||
if (g_CardMgr.QuerySlot(SLOT5) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT5)).GetLightStatus(&eDrive1StatusSlot5, &eDrive2StatusSlot5);
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT5)).GetLightStatus(&eDrive1StatusSlot5, &eDrive2StatusSlot5);
|
||||
|
||||
if (g_eStatusDrive1 == DISK_STATUS_OFF) g_eStatusDrive1 = eDrive1StatusSlot5;
|
||||
if (g_eStatusDrive2 == DISK_STATUS_OFF) g_eStatusDrive2 = eDrive2StatusSlot5;
|
||||
|
@ -783,10 +783,10 @@ void FrameDrawDiskStatus( HDC passdc )
|
|||
// Sector $B7ED LC1 $D357
|
||||
// RWTS LC1 $D300
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT6) != CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2)
|
||||
return;
|
||||
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6));
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
|
||||
int nActiveFloppy = disk2Card.GetCurrentDrive();
|
||||
int nDisk1Track = disk2Card.GetTrack(DRIVE_1);
|
||||
int nDisk2Track = disk2Card.GetTrack(DRIVE_2);
|
||||
|
@ -1149,13 +1149,13 @@ LRESULT CALLBACK FrameWndProc (
|
|||
Snapshot_Shutdown();
|
||||
DebugDestroy();
|
||||
if (!g_bRestart) {
|
||||
g_CardMgr.GetDisk2CardMgr().Destroy();
|
||||
GetCardMgr().GetDisk2CardMgr().Destroy();
|
||||
ImageDestroy();
|
||||
HD_Destroy();
|
||||
}
|
||||
PrintDestroy();
|
||||
if (g_CardMgr.IsSSCInstalled())
|
||||
g_CardMgr.GetSSC()->CommDestroy();
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
GetCardMgr().GetSSC()->CommDestroy();
|
||||
CpuDestroy();
|
||||
MemDestroy();
|
||||
SpkrDestroy();
|
||||
|
@ -1207,9 +1207,9 @@ LRESULT CALLBACK FrameWndProc (
|
|||
case WM_DDE_EXECUTE:
|
||||
{
|
||||
LogFileOutput("WM_DDE_EXECUTE\n");
|
||||
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
{
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6));
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
|
||||
LPTSTR filename = (LPTSTR)GlobalLock((HGLOBAL)lparam);
|
||||
ImageError_e Error = disk2Card.InsertDisk(DRIVE_1, filename, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
|
||||
if (Error == eIMAGE_ERROR_NONE)
|
||||
|
@ -1235,9 +1235,9 @@ LRESULT CALLBACK FrameWndProc (
|
|||
|
||||
case WM_DROPFILES:
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
{
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6));
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
|
||||
TCHAR filename[MAX_PATH];
|
||||
DragQueryFile((HDROP)wparam,0,filename,sizeof(filename));
|
||||
POINT point;
|
||||
|
@ -1569,7 +1569,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
DrawButton((HDC)0,buttonactive);
|
||||
SetCapture(window);
|
||||
}
|
||||
else if (g_bUsingCursor && !g_CardMgr.IsMouseCardInstalled())
|
||||
else if (g_bUsingCursor && !GetCardMgr().IsMouseCardInstalled())
|
||||
{
|
||||
if (wparam & (MK_CONTROL | MK_SHIFT))
|
||||
{
|
||||
|
@ -1584,7 +1584,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
{
|
||||
SetUsingCursor(TRUE);
|
||||
}
|
||||
else if (g_CardMgr.IsMouseCardInstalled())
|
||||
else if (GetCardMgr().IsMouseCardInstalled())
|
||||
{
|
||||
if (wparam & (MK_CONTROL | MK_SHIFT))
|
||||
{
|
||||
|
@ -1592,7 +1592,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
}
|
||||
else if (g_nAppMode == MODE_RUNNING || g_nAppMode == MODE_STEPPING)
|
||||
{
|
||||
CMouseInterface* pMouseCard = g_CardMgr.GetMouseCard();
|
||||
CMouseInterface* pMouseCard = GetCardMgr().GetMouseCard();
|
||||
|
||||
if (pMouseCard)
|
||||
{
|
||||
|
@ -1634,13 +1634,13 @@ LRESULT CALLBACK FrameWndProc (
|
|||
}
|
||||
buttonactive = -1;
|
||||
}
|
||||
else if (g_bUsingCursor && !g_CardMgr.IsMouseCardInstalled())
|
||||
else if (g_bUsingCursor && !GetCardMgr().IsMouseCardInstalled())
|
||||
{
|
||||
JoySetButton(BUTTON0, BUTTON_UP);
|
||||
}
|
||||
else if (g_CardMgr.IsMouseCardInstalled())
|
||||
else if (GetCardMgr().IsMouseCardInstalled())
|
||||
{
|
||||
g_CardMgr.GetMouseCard()->SetButton(BUTTON0, BUTTON_UP);
|
||||
GetCardMgr().GetMouseCard()->SetButton(BUTTON0, BUTTON_UP);
|
||||
}
|
||||
RelayEvent(WM_LBUTTONUP,wparam,lparam);
|
||||
break;
|
||||
|
@ -1668,12 +1668,12 @@ LRESULT CALLBACK FrameWndProc (
|
|||
if (buttonover != -1)
|
||||
DrawButton((HDC)0,buttonover);
|
||||
}
|
||||
else if (g_bUsingCursor && !g_CardMgr.IsMouseCardInstalled())
|
||||
else if (g_bUsingCursor && !GetCardMgr().IsMouseCardInstalled())
|
||||
{
|
||||
DrawCrosshairs(x,y);
|
||||
JoySetPosition(x-viewportx-2, g_nViewportCX-4, y-viewporty-2, g_nViewportCY-4);
|
||||
}
|
||||
else if (g_CardMgr.IsMouseCardInstalled() && g_CardMgr.GetMouseCard()->IsActiveAndEnabled() && (g_nAppMode == MODE_RUNNING || g_nAppMode == MODE_STEPPING))
|
||||
else if (GetCardMgr().IsMouseCardInstalled() && GetCardMgr().GetMouseCard()->IsActiveAndEnabled() && (g_nAppMode == MODE_RUNNING || g_nAppMode == MODE_STEPPING))
|
||||
{
|
||||
if (g_bLastCursorInAppleViewport)
|
||||
break;
|
||||
|
@ -1706,7 +1706,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
if (wparam == IDEVENT_TIMER_MOUSE)
|
||||
{
|
||||
// NB. Need to check /g_bAppActive/ since WM_TIMER events still occur after AppleWin app has lost focus
|
||||
if (g_bAppActive && g_CardMgr.IsMouseCardInstalled() && g_CardMgr.GetMouseCard()->IsActiveAndEnabled() && (g_nAppMode == MODE_RUNNING || g_nAppMode == MODE_STEPPING))
|
||||
if (g_bAppActive && GetCardMgr().IsMouseCardInstalled() && GetCardMgr().GetMouseCard()->IsActiveAndEnabled() && (g_nAppMode == MODE_RUNNING || g_nAppMode == MODE_STEPPING))
|
||||
{
|
||||
if (!g_bLastCursorInAppleViewport)
|
||||
break;
|
||||
|
@ -1717,7 +1717,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
|
||||
long dX,dY;
|
||||
if (DIMouse::ReadImmediateData(&dX, &dY) == S_OK)
|
||||
g_CardMgr.GetMouseCard()->SetPositionRel(dX, dY, &iOutOfBoundsX, &iOutOfBoundsY);
|
||||
GetCardMgr().GetMouseCard()->SetPositionRel(dX, dY, &iOutOfBoundsX, &iOutOfBoundsY);
|
||||
|
||||
UpdateMouseInAppleViewport(iOutOfBoundsX, iOutOfBoundsY);
|
||||
}
|
||||
|
@ -1725,7 +1725,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
else if (wparam == IDEVENT_TIMER_100MSEC) // GH#504
|
||||
{
|
||||
if (g_bIsFullScreen
|
||||
&& !g_CardMgr.IsMouseCardInstalled() // Don't interfere if there's a mousecard present!
|
||||
&& !GetCardMgr().IsMouseCardInstalled() // Don't interfere if there's a mousecard present!
|
||||
&& !g_bUsingCursor // Using mouse for joystick emulation (or mousecard restricted to window)
|
||||
&& g_bShowingCursor
|
||||
&& g_bFrameActive) // Frame inactive when eg. Config or 'Select Disk Image' dialogs are opened
|
||||
|
@ -1766,10 +1766,10 @@ LRESULT CALLBACK FrameWndProc (
|
|||
|
||||
Disk2InterfaceCard *pDisk2Slot5 = NULL, *pDisk2Slot6 = NULL;
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT5) == CT_Disk2)
|
||||
pDisk2Slot5 = dynamic_cast<Disk2InterfaceCard*>(g_CardMgr.GetObj(SLOT5));
|
||||
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
pDisk2Slot6 = dynamic_cast<Disk2InterfaceCard*>(g_CardMgr.GetObj(SLOT6));
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
|
||||
pDisk2Slot5 = dynamic_cast<Disk2InterfaceCard*>(GetCardMgr().GetObj(SLOT5));
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
pDisk2Slot6 = dynamic_cast<Disk2InterfaceCard*>(GetCardMgr().GetObj(SLOT6));
|
||||
|
||||
std::string slot5 = pDisk2Slot5 ? pDisk2Slot5->GetFullDiskFilename(((LPNMTTDISPINFO)lparam)->hdr.idFrom) : "";
|
||||
std::string slot6 = pDisk2Slot6 ? pDisk2Slot6->GetFullDiskFilename(((LPNMTTDISPINFO)lparam)->hdr.idFrom) : "";
|
||||
|
@ -1845,10 +1845,10 @@ LRESULT CALLBACK FrameWndProc (
|
|||
}
|
||||
}
|
||||
|
||||
if (g_bUsingCursor && !g_CardMgr.IsMouseCardInstalled())
|
||||
if (g_bUsingCursor && !GetCardMgr().IsMouseCardInstalled())
|
||||
JoySetButton(BUTTON1, (message == WM_RBUTTONDOWN) ? BUTTON_DOWN : BUTTON_UP);
|
||||
else if (g_CardMgr.IsMouseCardInstalled())
|
||||
g_CardMgr.GetMouseCard()->SetButton(BUTTON1, (message == WM_RBUTTONDOWN) ? BUTTON_DOWN : BUTTON_UP);
|
||||
else if (GetCardMgr().IsMouseCardInstalled())
|
||||
GetCardMgr().GetMouseCard()->SetButton(BUTTON1, (message == WM_RBUTTONDOWN) ? BUTTON_DOWN : BUTTON_UP);
|
||||
|
||||
RelayEvent(message,wparam,lparam);
|
||||
break;
|
||||
|
@ -1911,10 +1911,11 @@ LRESULT CALLBACK FrameWndProc (
|
|||
case WM_USER_BENCHMARK: {
|
||||
UpdateWindow(window);
|
||||
ResetMachineState();
|
||||
g_nAppMode = MODE_LOGO;
|
||||
DrawStatusArea((HDC)0,DRAW_TITLE);
|
||||
HCURSOR oldcursor = SetCursor(LoadCursor(0,IDC_WAIT));
|
||||
g_nAppMode = MODE_BENCHMARK;
|
||||
VideoBenchmark();
|
||||
g_nAppMode = MODE_LOGO;
|
||||
ResetMachineState();
|
||||
SetCursor(oldcursor);
|
||||
break;
|
||||
|
@ -1947,13 +1948,13 @@ LRESULT CALLBACK FrameWndProc (
|
|||
case WSAECONNRESET:
|
||||
case WSAENOTCONN:
|
||||
case WSAETIMEDOUT:
|
||||
if (g_CardMgr.IsSSCInstalled())
|
||||
g_CardMgr.GetSSC()->CommTcpSerialClose();
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
GetCardMgr().GetSSC()->CommTcpSerialClose();
|
||||
break;
|
||||
|
||||
default:
|
||||
if (g_CardMgr.IsSSCInstalled())
|
||||
g_CardMgr.GetSSC()->CommTcpSerialCleanup();
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
GetCardMgr().GetSSC()->CommTcpSerialCleanup();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1963,18 +1964,18 @@ LRESULT CALLBACK FrameWndProc (
|
|||
switch(wSelectEvent)
|
||||
{
|
||||
case FD_ACCEPT:
|
||||
if (g_CardMgr.IsSSCInstalled())
|
||||
g_CardMgr.GetSSC()->CommTcpSerialAccept();
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
GetCardMgr().GetSSC()->CommTcpSerialAccept();
|
||||
break;
|
||||
|
||||
case FD_CLOSE:
|
||||
if (g_CardMgr.IsSSCInstalled())
|
||||
g_CardMgr.GetSSC()->CommTcpSerialClose();
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
GetCardMgr().GetSSC()->CommTcpSerialClose();
|
||||
break;
|
||||
|
||||
case FD_READ:
|
||||
if (g_CardMgr.IsSSCInstalled())
|
||||
g_CardMgr.GetSSC()->CommTcpSerialReceive();
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
GetCardMgr().GetSSC()->CommTcpSerialReceive();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2089,8 +2090,8 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
|
|||
|
||||
if (g_nAppMode == MODE_LOGO)
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).Boot();
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).Boot();
|
||||
|
||||
LogFileTimeUntilFirstKeyReadReset();
|
||||
g_nAppMode = MODE_RUNNING;
|
||||
|
@ -2114,18 +2115,18 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
|
|||
|
||||
case BTN_DRIVE1:
|
||||
case BTN_DRIVE2:
|
||||
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
{
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).UserSelectNewDiskImage(button-BTN_DRIVE1);
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).UserSelectNewDiskImage(button-BTN_DRIVE1);
|
||||
if (!g_bIsFullScreen)
|
||||
DrawButton((HDC)0,button);
|
||||
}
|
||||
break;
|
||||
|
||||
case BTN_DRIVESWAP:
|
||||
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
{
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).DriveSwap();
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).DriveSwap();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2181,10 +2182,10 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
|
|||
|
||||
void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(SLOT6) != CT_Disk2)
|
||||
if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2)
|
||||
return;
|
||||
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6));
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
|
||||
|
||||
// This is the default installation path of CiderPress.
|
||||
// It shall not be left blank, otherwise an explorer window will be open.
|
||||
|
@ -2323,24 +2324,24 @@ void RelayEvent (UINT message, WPARAM wparam, LPARAM lparam) {
|
|||
// todo: consolidate CtrlReset() and ResetMachineState()
|
||||
void ResetMachineState ()
|
||||
{
|
||||
g_CardMgr.GetDisk2CardMgr().Reset(true);
|
||||
GetCardMgr().GetDisk2CardMgr().Reset(true);
|
||||
HD_Reset();
|
||||
g_bFullSpeed = 0; // Might've hit reset in middle of InternalCpuExecute() - so beep may get (partially) muted
|
||||
|
||||
MemReset(); // calls CpuInitialize(), CNoSlotClock.Reset()
|
||||
PravetsReset();
|
||||
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).Boot();
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).Boot();
|
||||
VideoResetState();
|
||||
KeybReset();
|
||||
if (g_CardMgr.IsSSCInstalled())
|
||||
g_CardMgr.GetSSC()->CommReset();
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
GetCardMgr().GetSSC()->CommReset();
|
||||
PrintReset();
|
||||
JoyReset();
|
||||
MB_Reset();
|
||||
SpkrReset();
|
||||
if (g_CardMgr.IsMouseCardInstalled())
|
||||
g_CardMgr.GetMouseCard()->Reset();
|
||||
if (GetCardMgr().IsMouseCardInstalled())
|
||||
GetCardMgr().GetMouseCard()->Reset();
|
||||
SetActiveCpu( GetMainCpu() );
|
||||
#ifdef USE_SPEECH_API
|
||||
g_Speech.Reset();
|
||||
|
@ -2378,14 +2379,14 @@ void CtrlReset()
|
|||
}
|
||||
|
||||
PravetsReset();
|
||||
g_CardMgr.GetDisk2CardMgr().Reset();
|
||||
GetCardMgr().GetDisk2CardMgr().Reset();
|
||||
HD_Reset();
|
||||
KeybReset();
|
||||
if (g_CardMgr.IsSSCInstalled())
|
||||
g_CardMgr.GetSSC()->CommReset();
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
GetCardMgr().GetSSC()->CommReset();
|
||||
MB_Reset();
|
||||
if (g_CardMgr.IsMouseCardInstalled())
|
||||
g_CardMgr.GetMouseCard()->Reset(); // Deassert any pending IRQs - GH#514
|
||||
if (GetCardMgr().IsMouseCardInstalled())
|
||||
GetCardMgr().GetMouseCard()->Reset(); // Deassert any pending IRQs - GH#514
|
||||
#ifdef USE_SPEECH_API
|
||||
g_Speech.Reset();
|
||||
#endif
|
||||
|
@ -2791,8 +2792,8 @@ static bool FileExists(std::string strFilename)
|
|||
// . UpdateMouseInAppleViewport() is called and inside Apple screen
|
||||
void FrameSetCursorPosByMousePos()
|
||||
{
|
||||
// _ASSERT(g_CardMgr.IsMouseCardInstalled()); // CMouseInterface::ctor calls this function, ie. before g_CardMgr::m_pMouseCard is setup
|
||||
if (!g_CardMgr.IsMouseCardInstalled())
|
||||
// _ASSERT(GetCardMgr().IsMouseCardInstalled()); // CMouseInterface::ctor calls this function, ie. before GetCardMgr()::m_pMouseCard is setup
|
||||
if (!GetCardMgr().IsMouseCardInstalled())
|
||||
return;
|
||||
|
||||
if (!g_hFrameWindow || g_bShowingCursor)
|
||||
|
@ -2800,7 +2801,7 @@ void FrameSetCursorPosByMousePos()
|
|||
|
||||
int iX, iMinX, iMaxX;
|
||||
int iY, iMinY, iMaxY;
|
||||
g_CardMgr.GetMouseCard()->GetXY(iX, iMinX, iMaxX, iY, iMinY, iMaxY);
|
||||
GetCardMgr().GetMouseCard()->GetXY(iX, iMinX, iMaxX, iY, iMinY, iMaxY);
|
||||
|
||||
float fScaleX = (float)(iX-iMinX) / ((float)(iMaxX-iMinX));
|
||||
float fScaleY = (float)(iY-iMinY) / ((float)(iMaxY-iMinY));
|
||||
|
@ -2830,8 +2831,8 @@ void FrameSetCursorPosByMousePos()
|
|||
// . NB. Not called when leaving & mouse clipped to Apple screen area
|
||||
static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeavingAppleScreen)
|
||||
{
|
||||
_ASSERT(g_CardMgr.IsMouseCardInstalled());
|
||||
if (!g_CardMgr.IsMouseCardInstalled())
|
||||
_ASSERT(GetCardMgr().IsMouseCardInstalled());
|
||||
if (!GetCardMgr().IsMouseCardInstalled())
|
||||
return;
|
||||
|
||||
// char szDbg[200];
|
||||
|
@ -2840,7 +2841,7 @@ static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeav
|
|||
|
||||
int iX, iMinX, iMaxX;
|
||||
int iY, iMinY, iMaxY;
|
||||
g_CardMgr.GetMouseCard()->GetXY(iX, iMinX, iMaxX, iY, iMinY, iMaxY);
|
||||
GetCardMgr().GetMouseCard()->GetXY(iX, iMinX, iMaxX, iY, iMinY, iMaxY);
|
||||
|
||||
if (bLeavingAppleScreen)
|
||||
{
|
||||
|
@ -2878,7 +2879,7 @@ static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeav
|
|||
int iAppleX = iMinX + (int)(fScaleX * (float)(iMaxX-iMinX));
|
||||
int iAppleY = iMinY + (int)(fScaleY * (float)(iMaxY-iMinY));
|
||||
|
||||
g_CardMgr.GetMouseCard()->SetCursorPos(iAppleX, iAppleY); // Set new entry position
|
||||
GetCardMgr().GetMouseCard()->SetCursorPos(iAppleX, iAppleY); // Set new entry position
|
||||
|
||||
// Dump initial deltas (otherwise can get big deltas since last read when entering Apple screen area)
|
||||
DIMouse::ReadImmediateData();
|
||||
|
@ -2887,8 +2888,8 @@ static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeav
|
|||
|
||||
static void DrawCrosshairsMouse()
|
||||
{
|
||||
_ASSERT(g_CardMgr.IsMouseCardInstalled());
|
||||
if (!g_CardMgr.IsMouseCardInstalled())
|
||||
_ASSERT(GetCardMgr().IsMouseCardInstalled());
|
||||
if (!GetCardMgr().IsMouseCardInstalled())
|
||||
return;
|
||||
|
||||
if (!sg_PropertySheet.GetMouseShowCrosshair())
|
||||
|
@ -2896,7 +2897,7 @@ static void DrawCrosshairsMouse()
|
|||
|
||||
int iX, iMinX, iMaxX;
|
||||
int iY, iMinY, iMaxY;
|
||||
g_CardMgr.GetMouseCard()->GetXY(iX, iMinX, iMaxX, iY, iMinY, iMaxY);
|
||||
GetCardMgr().GetMouseCard()->GetXY(iX, iMinX, iMaxX, iY, iMinY, iMaxY);
|
||||
_ASSERT(iMinX == 0 && iMinY == 0);
|
||||
|
||||
float fScaleX = (float)(iX-iMinX) / ((float)(iMaxX-iMinX));
|
||||
|
|
|
@ -279,9 +279,9 @@ void HD_SetEnabled(const bool bEnabled)
|
|||
g_bHD_Enabled = bEnabled;
|
||||
|
||||
if (bEnabled)
|
||||
g_CardMgr.Insert(SLOT7, CT_GenericHDD);
|
||||
GetCardMgr().Insert(SLOT7, CT_GenericHDD);
|
||||
else
|
||||
g_CardMgr.Remove(SLOT7);
|
||||
GetCardMgr().Remove(SLOT7);
|
||||
|
||||
#if 0
|
||||
// FIXME: For LoadConfiguration(), g_uSlot=7 (see definition at start of file)
|
||||
|
|
|
@ -305,8 +305,8 @@ void SetExpansionMemType(const SS_CARDTYPE type)
|
|||
newSlotAuxCard = type;
|
||||
}
|
||||
|
||||
g_CardMgr.Insert(SLOT0, newSlot0Card);
|
||||
g_CardMgr.InsertAux(newSlotAuxCard);
|
||||
GetCardMgr().Insert(SLOT0, newSlot0Card);
|
||||
GetCardMgr().InsertAux(newSlotAuxCard);
|
||||
}
|
||||
|
||||
void CreateLanguageCard(void)
|
||||
|
@ -316,9 +316,9 @@ void CreateLanguageCard(void)
|
|||
|
||||
if (IsApple2PlusOrClone(GetApple2Type()))
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(SLOT0) == CT_Saturn128K)
|
||||
if (GetCardMgr().QuerySlot(SLOT0) == CT_Saturn128K)
|
||||
g_pLanguageCard = new Saturn128K(g_uSaturnBanksFromCmdLine);
|
||||
else if (g_CardMgr.QuerySlot(SLOT0) == CT_LanguageCard)
|
||||
else if (GetCardMgr().QuerySlot(SLOT0) == CT_LanguageCard)
|
||||
g_pLanguageCard = new LanguageCardSlot0;
|
||||
else
|
||||
g_pLanguageCard = NULL;
|
||||
|
@ -332,9 +332,9 @@ void CreateLanguageCard(void)
|
|||
SS_CARDTYPE GetCurrentExpansionMemType(void)
|
||||
{
|
||||
if (IsApple2PlusOrClone(GetApple2Type()))
|
||||
return g_CardMgr.QuerySlot(SLOT0);
|
||||
return GetCardMgr().QuerySlot(SLOT0);
|
||||
else
|
||||
return g_CardMgr.QueryAux();
|
||||
return GetCardMgr().QueryAux();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1077,7 +1077,7 @@ static void ResetPaging(BOOL initialize)
|
|||
{
|
||||
SetLastRamWrite(0);
|
||||
|
||||
if (IsApple2PlusOrClone(GetApple2Type()) && g_CardMgr.QuerySlot(SLOT0) == CT_Empty)
|
||||
if (IsApple2PlusOrClone(GetApple2Type()) && GetCardMgr().QuerySlot(SLOT0) == CT_Empty)
|
||||
SetMemMode(0);
|
||||
else
|
||||
SetMemMode(LanguageCardUnit::kMemModeInitialState);
|
||||
|
@ -1495,7 +1495,7 @@ void MemInitialize()
|
|||
SetExpansionMemTypeDefault();
|
||||
|
||||
#ifdef RAMWORKS
|
||||
if (g_CardMgr.QueryAux() == CT_RamWorksIII)
|
||||
if (GetCardMgr().QueryAux() == CT_RamWorksIII)
|
||||
{
|
||||
// allocate memory for RAMWorks III - up to 8MB
|
||||
g_uActiveBank = 0;
|
||||
|
@ -1606,7 +1606,7 @@ void MemInitializeCustomF8ROM(void)
|
|||
const UINT F8RomSize = 0x800;
|
||||
const UINT F8RomOffset = Apple2RomSize-F8RomSize;
|
||||
|
||||
if (IsApple2Original(GetApple2Type()) && g_CardMgr.QuerySlot(SLOT0) == CT_LanguageCard)
|
||||
if (IsApple2Original(GetApple2Type()) && GetCardMgr().QuerySlot(SLOT0) == CT_LanguageCard)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1729,13 +1729,13 @@ void MemInitializeIO(void)
|
|||
else
|
||||
RegisterIoHandler(LanguageCardUnit::kSlot0, IO_Null, IO_Null, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT1) == CT_GenericPrinter)
|
||||
if (GetCardMgr().QuerySlot(SLOT1) == CT_GenericPrinter)
|
||||
PrintLoadRom(pCxRomPeripheral, SLOT1); // $C100 : Parallel printer f/w
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT2) == CT_SSC)
|
||||
dynamic_cast<CSuperSerialCard&>(g_CardMgr.GetRef(SLOT2)).CommInitialize(pCxRomPeripheral, SLOT2); // $C200 : SSC
|
||||
if (GetCardMgr().QuerySlot(SLOT2) == CT_SSC)
|
||||
dynamic_cast<CSuperSerialCard&>(GetCardMgr().GetRef(SLOT2)).CommInitialize(pCxRomPeripheral, SLOT2); // $C200 : SSC
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT3) == CT_Uthernet)
|
||||
if (GetCardMgr().QuerySlot(SLOT3) == CT_Uthernet)
|
||||
{
|
||||
// Slot 3 contains the Uthernet card (which can coexist with an 80-col+Ram card in AUX slot)
|
||||
// . Uthernet card has no ROM and only IO mapped at $C0Bx
|
||||
|
@ -1744,40 +1744,40 @@ void MemInitializeIO(void)
|
|||
|
||||
// Apple//e: Auxilary slot contains Extended 80 Column card or RamWorksIII card
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT4) == CT_MouseInterface)
|
||||
if (GetCardMgr().QuerySlot(SLOT4) == CT_MouseInterface)
|
||||
{
|
||||
dynamic_cast<CMouseInterface&>(g_CardMgr.GetRef(SLOT4)).Initialize(pCxRomPeripheral, SLOT4); // $C400 : Mouse f/w
|
||||
dynamic_cast<CMouseInterface&>(GetCardMgr().GetRef(SLOT4)).Initialize(pCxRomPeripheral, SLOT4); // $C400 : Mouse f/w
|
||||
}
|
||||
else if (g_CardMgr.QuerySlot(SLOT4) == CT_MockingboardC || g_CardMgr.QuerySlot(SLOT4) == CT_Phasor)
|
||||
else if (GetCardMgr().QuerySlot(SLOT4) == CT_MockingboardC || GetCardMgr().QuerySlot(SLOT4) == CT_Phasor)
|
||||
{
|
||||
MB_InitializeIO(pCxRomPeripheral, SLOT4, SLOT5);
|
||||
}
|
||||
else if (g_CardMgr.QuerySlot(SLOT4) == CT_Z80)
|
||||
else if (GetCardMgr().QuerySlot(SLOT4) == CT_Z80)
|
||||
{
|
||||
ConfigureSoftcard(pCxRomPeripheral, SLOT4); // $C400 : Z80 card
|
||||
}
|
||||
// else if (g_CardMgr.QuerySlot(SLOT4) == CT_GenericClock)
|
||||
// else if (GetCardMgr().QuerySlot(SLOT4) == CT_GenericClock)
|
||||
// {
|
||||
// LoadRom_Clock_Generic(pCxRomPeripheral, SLOT4);
|
||||
// }
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT5) == CT_Z80)
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_Z80)
|
||||
{
|
||||
ConfigureSoftcard(pCxRomPeripheral, SLOT5); // $C500 : Z80 card
|
||||
}
|
||||
else if (g_CardMgr.QuerySlot(SLOT5) == CT_SAM)
|
||||
else if (GetCardMgr().QuerySlot(SLOT5) == CT_SAM)
|
||||
{
|
||||
ConfigureSAM(pCxRomPeripheral, SLOT5); // $C500 : Z80 card
|
||||
}
|
||||
else if (g_CardMgr.QuerySlot(SLOT5) == CT_Disk2)
|
||||
else if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
|
||||
{
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT5)).Initialize(pCxRomPeripheral, SLOT5); // $C500 : Disk][ card
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT5)).Initialize(pCxRomPeripheral, SLOT5); // $C500 : Disk][ card
|
||||
}
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).Initialize(pCxRomPeripheral, SLOT6); // $C600 : Disk][ card
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).Initialize(pCxRomPeripheral, SLOT6); // $C600 : Disk][ card
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT7) == CT_GenericHDD)
|
||||
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
|
||||
HD_Load_Rom(pCxRomPeripheral, SLOT7); // $C700 : HDD f/w
|
||||
}
|
||||
|
||||
|
@ -1840,12 +1840,12 @@ void MemReset()
|
|||
// F2. Ctrl-F2. CALL-151, C050 C053 C057
|
||||
// OR
|
||||
// F2, Ctrl-F2, F7, HGR
|
||||
DWORD clock = getRandomTime();
|
||||
DWORD randTime = getRandomTime();
|
||||
MemoryInitPattern_e eMemoryInitPattern = static_cast<MemoryInitPattern_e>(g_nMemoryClearType);
|
||||
|
||||
if (g_nMemoryClearType < 0) // random
|
||||
{
|
||||
eMemoryInitPattern = static_cast<MemoryInitPattern_e>( clock % NUM_MIP );
|
||||
eMemoryInitPattern = static_cast<MemoryInitPattern_e>( randTime % NUM_MIP );
|
||||
|
||||
// Don't use unless manually specified as a
|
||||
// few badly written programs will not work correctly
|
||||
|
@ -1866,12 +1866,12 @@ void MemReset()
|
|||
// Exceptions: xx28 xx29 xx68 xx69 Apple //e
|
||||
for( iByte = 0x0000; iByte < 0xC000; iByte += 512 )
|
||||
{
|
||||
clock = getRandomTime();
|
||||
memmain[ iByte + 0x28 ] = (clock >> 0) & 0xFF;
|
||||
memmain[ iByte + 0x29 ] = (clock >> 8) & 0xFF;
|
||||
clock = getRandomTime();
|
||||
memmain[ iByte + 0x68 ] = (clock >> 0) & 0xFF;
|
||||
memmain[ iByte + 0x69 ] = (clock >> 8) & 0xFF;
|
||||
randTime = getRandomTime();
|
||||
memmain[ iByte + 0x28 ] = (randTime >> 0) & 0xFF;
|
||||
memmain[ iByte + 0x29 ] = (randTime >> 8) & 0xFF;
|
||||
randTime = getRandomTime();
|
||||
memmain[ iByte + 0x68 ] = (randTime >> 0) & 0xFF;
|
||||
memmain[ iByte + 0x69 ] = (randTime >> 8) & 0xFF;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1907,9 +1907,9 @@ void MemReset()
|
|||
{
|
||||
for( int i = 0; i < 256; i++ )
|
||||
{
|
||||
clock = getRandomTime();
|
||||
random[ (i+0) & 0xFF ] = (clock >> 0) & 0xFF;
|
||||
random[ (i+1) & 0xFF ] = (clock >> 11) & 0xFF;
|
||||
randTime = getRandomTime();
|
||||
random[ (i+0) & 0xFF ] = (randTime >> 0) & 0xFF;
|
||||
random[ (i+1) & 0xFF ] = (randTime >> 11) & 0xFF;
|
||||
}
|
||||
|
||||
memcpy( &memmain[ iByte ], random, 256 );
|
||||
|
@ -1932,9 +1932,9 @@ void MemReset()
|
|||
|
||||
// https://github.com/AppleWin/AppleWin/issues/206
|
||||
// Work-around for a cold-booting bug in "Pooyan" which expects RNDL and RNDH to be non-zero.
|
||||
clock = getRandomTime();
|
||||
memmain[ 0x4E ] = 0x20 | (clock >> 0) & 0xFF;
|
||||
memmain[ 0x4F ] = 0x20 | (clock >> 8) & 0xFF;
|
||||
randTime = getRandomTime();
|
||||
memmain[ 0x4E ] = 0x20 | (randTime >> 0) & 0xFF;
|
||||
memmain[ 0x4F ] = 0x20 | (randTime >> 8) & 0xFF;
|
||||
|
||||
// https://github.com/AppleWin/AppleWin/issues/222
|
||||
// MIP_PAGE_ADDRESS_LOW breaks a few badly written programs!
|
||||
|
@ -2475,8 +2475,8 @@ static void MemLoadSnapshotAuxCommon(YamlLoadHelper& yamlLoadHelper, const std::
|
|||
yamlLoadHelper.PopMap();
|
||||
}
|
||||
|
||||
g_CardMgr.Remove(SLOT0);
|
||||
g_CardMgr.InsertAux(type);
|
||||
GetCardMgr().Remove(SLOT0);
|
||||
GetCardMgr().InsertAux(type);
|
||||
|
||||
memaux = RWpages[g_uActiveBank];
|
||||
// NB. MemUpdatePaging(TRUE) called at end of Snapshot_LoadState_v2()
|
||||
|
|
|
@ -86,6 +86,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Memory.h"
|
||||
#include "Mockingboard.h"
|
||||
#include "SoundCore.h"
|
||||
#include "SynchronousEventManager.h"
|
||||
#include "YamlHelper.h"
|
||||
#include "Riff.h"
|
||||
|
||||
|
@ -115,10 +116,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#define SY6522B_Offset 0x80
|
||||
#define SSI263_Offset 0x40
|
||||
|
||||
#define Phasor_SY6522A_CS 4
|
||||
#define Phasor_SY6522B_CS 7
|
||||
#define Phasor_SY6522A_Offset (1<<Phasor_SY6522A_CS)
|
||||
#define Phasor_SY6522B_Offset (1<<Phasor_SY6522B_CS)
|
||||
//#define Phasor_SY6522A_CS 4
|
||||
//#define Phasor_SY6522B_CS 7
|
||||
//#define Phasor_SY6522A_Offset (1<<Phasor_SY6522A_CS)
|
||||
//#define Phasor_SY6522B_Offset (1<<Phasor_SY6522B_CS)
|
||||
|
||||
enum MockingboardUnitState_e {AY_NOP0, AY_NOP1, AY_INACTIVE, AY_READ, AY_NOP4, AY_NOP5, AY_WRITE, AY_LATCH};
|
||||
|
||||
|
@ -132,10 +133,6 @@ struct SY6522_AY8910
|
|||
SSI263A SpeechChip;
|
||||
MockingboardUnitState_e state; // Where a unit is a 6522+AY8910 pair
|
||||
MockingboardUnitState_e stateB; // Phasor: 6522 & 2nd AY8910
|
||||
|
||||
// NB. No need to save to save-state, as it will be done immediately after opcode completes in MB_UpdateCycles()
|
||||
bool bLoadT1C; // Load T1C with T1L after opcode completes
|
||||
bool bLoadT2C; // Load T2C with T2L after opcode completes
|
||||
};
|
||||
|
||||
|
||||
|
@ -162,6 +159,11 @@ struct SY6522_AY8910
|
|||
// Support 2 MB's, each with 2x SY6522/AY8910 pairs.
|
||||
static SY6522_AY8910 g_MB[NUM_AY8910];
|
||||
|
||||
const UINT kExtraTimerCycles = 2; // Rockwell, Fig.16: period = N+2 cycles
|
||||
const UINT kNumTimersPer6522 = 2;
|
||||
const UINT kNumSyncEvents = NUM_MB * NUM_SY6522 * kNumTimersPer6522;
|
||||
static SyncEvent* g_syncEvent[kNumSyncEvents];
|
||||
|
||||
// Timer vars
|
||||
static const UINT kTIMERDEVICE_INVALID = -1;
|
||||
static UINT g_nMBTimerDevice = kTIMERDEVICE_INVALID; // SY6522 device# which is generating timer IRQ
|
||||
|
@ -222,6 +224,7 @@ static UINT g_cyclesThisAudioFrame = 0;
|
|||
// Forward refs:
|
||||
static DWORD WINAPI SSI263Thread(LPVOID);
|
||||
static void Votrax_Write(BYTE nDevice, BYTE nValue);
|
||||
static int MB_SyncEventCallback(int id, int cycles, ULONG uExecutedCycles);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
@ -340,6 +343,99 @@ static void AY8910_Write(BYTE nDevice, BYTE /*nReg*/, BYTE nValue, BYTE nAYDevic
|
|||
}
|
||||
}
|
||||
|
||||
static UINT GetOpcodeCycles(BYTE reg)
|
||||
{
|
||||
UINT opcodeCycles = 0;
|
||||
BYTE opcode = 0;
|
||||
bool abs16 = false;
|
||||
|
||||
const BYTE opcodeMinus3 = mem[(regs.pc-3)&0xffff];
|
||||
const BYTE opcodeMinus2 = mem[(regs.pc-2)&0xffff];
|
||||
|
||||
if ( (opcodeMinus3 == 0x8C) || // sty abs16
|
||||
(opcodeMinus3 == 0x8D) || // sta abs16
|
||||
(opcodeMinus3 == 0x8E) ) // stx abs16
|
||||
{ // Eg. FT demos: CHIP, MADEF, MAD2
|
||||
opcodeCycles = 4;
|
||||
opcode = opcodeMinus3;
|
||||
abs16 = true;
|
||||
}
|
||||
else if ( (opcodeMinus3 == 0x99) || // sta abs16,y
|
||||
(opcodeMinus3 == 0x9D) ) // sta abs16,x
|
||||
{ // Eg. Paleotronic microTracker demo
|
||||
opcodeCycles = 5;
|
||||
opcode = opcodeMinus3;
|
||||
abs16 = true;
|
||||
}
|
||||
else if (opcodeMinus2 == 0x81) // sta (zp,x)
|
||||
{
|
||||
opcodeCycles = 6;
|
||||
opcode = opcodeMinus2;
|
||||
}
|
||||
else if (opcodeMinus2 == 0x91) // sta (zp),y
|
||||
{ // Eg. FT demos: OMT, PLS
|
||||
opcodeCycles = 6;
|
||||
opcode = opcodeMinus2;
|
||||
}
|
||||
else if (opcodeMinus2 == 0x92 && GetMainCpu() == CPU_65C02) // sta (zp) : 65C02-only
|
||||
{
|
||||
opcodeCycles = 5;
|
||||
opcode = opcodeMinus2;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ASSERT(0);
|
||||
opcodeCycles = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
WORD addr16 = 0;
|
||||
|
||||
if (!abs16)
|
||||
{
|
||||
BYTE zp = mem[(regs.pc-1)&0xffff];
|
||||
if (opcode == 0x81) zp += regs.x;
|
||||
addr16 = (mem[zp] | (mem[(zp+1)&0xff]<<8));
|
||||
if (opcode == 0x91) addr16 += regs.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
addr16 = mem[(regs.pc-2)&0xffff] | (mem[(regs.pc-1)&0xffff]<<8);
|
||||
if (opcode == 0x99) addr16 += regs.y;
|
||||
if (opcode == 0x9D) addr16 += regs.x;
|
||||
}
|
||||
|
||||
// Check we've reverse looked-up the 6502 opcode correctly
|
||||
if ((addr16 & 0xF80F) != (0xC000+reg))
|
||||
{
|
||||
_ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return opcodeCycles;
|
||||
}
|
||||
|
||||
// Insert a new synchronous event whenever the 6522 timer's counter is written.
|
||||
// . NB. it doesn't matter if the timer's interrupt enable (IER) is set or not
|
||||
// - the state of IER is only important when the counter underflows - see: MB_SyncEventCallback()
|
||||
static USHORT SetTimerSyncEvent(UINT id, BYTE reg, USHORT timerLatch)
|
||||
{
|
||||
// NB. This TIMER adjustment value gets subtracted when this current opcode completes, so no need to persist to save-state
|
||||
const UINT opcodeCycleAdjust = GetOpcodeCycles(reg);
|
||||
|
||||
SyncEvent* pSyncEvent = g_syncEvent[id];
|
||||
if (pSyncEvent->m_active)
|
||||
g_SynchronousEventMgr.Remove(id);
|
||||
|
||||
pSyncEvent->SetCycles(timerLatch + kExtraTimerCycles + opcodeCycleAdjust);
|
||||
g_SynchronousEventMgr.Insert(pSyncEvent);
|
||||
|
||||
// It doesn't matter if this overflows (ie. >0xFFFF), since on completion of current opcode it'll be corrected
|
||||
return (USHORT) (timerLatch + opcodeCycleAdjust);
|
||||
}
|
||||
|
||||
static void UpdateIFR(SY6522_AY8910* pMB, BYTE clr_ifr, BYTE set_ifr=0)
|
||||
{
|
||||
// Need critical section to avoid data-race: main thread & SSI263Thread can both access IFR
|
||||
|
@ -425,34 +521,29 @@ static void SY6522_Write(BYTE nDevice, BYTE nReg, BYTE nValue)
|
|||
pMB->sy6522.TIMER1_LATCH.l = nValue;
|
||||
break;
|
||||
case 0x05: // TIMER1H_COUNTER
|
||||
/* Initiates timer1 & clears time-out of timer1 */
|
||||
|
||||
// Clear Timer Interrupt Flag.
|
||||
UpdateIFR(pMB, IxR_TIMER1);
|
||||
|
||||
pMB->sy6522.TIMER1_LATCH.h = nValue;
|
||||
pMB->bLoadT1C = true;
|
||||
|
||||
StartTimer1(pMB);
|
||||
CpuAdjustIrqCheck(pMB->sy6522.TIMER1_LATCH.w); // Sync IRQ check timeout with 6522 counter underflow - GH#608
|
||||
{
|
||||
UpdateIFR(pMB, IxR_TIMER1); // Clear Timer1 Interrupt Flag
|
||||
pMB->sy6522.TIMER1_LATCH.h = nValue;
|
||||
const UINT id = nDevice*kNumTimersPer6522+0; // TIMER1
|
||||
pMB->sy6522.TIMER1_COUNTER.w = SetTimerSyncEvent(id, nReg, pMB->sy6522.TIMER1_LATCH.w);
|
||||
StartTimer1(pMB);
|
||||
}
|
||||
break;
|
||||
case 0x07: // TIMER1H_LATCH
|
||||
// Clear Timer1 Interrupt Flag.
|
||||
UpdateIFR(pMB, IxR_TIMER1);
|
||||
UpdateIFR(pMB, IxR_TIMER1); // Clear Timer1 Interrupt Flag
|
||||
pMB->sy6522.TIMER1_LATCH.h = nValue;
|
||||
break;
|
||||
case 0x08: // TIMER2L
|
||||
pMB->sy6522.TIMER2_LATCH.l = nValue;
|
||||
break;
|
||||
case 0x09: // TIMER2H
|
||||
// Clear Timer2 Interrupt Flag.
|
||||
UpdateIFR(pMB, IxR_TIMER2);
|
||||
|
||||
pMB->sy6522.TIMER2_LATCH.h = nValue; // NB. Real 6522 doesn't have TIMER2_LATCH.h
|
||||
pMB->sy6522.TIMER2_COUNTER.w = pMB->sy6522.TIMER2_LATCH.w;
|
||||
|
||||
StartTimer2(pMB);
|
||||
CpuAdjustIrqCheck(pMB->sy6522.TIMER2_LATCH.w); // Sync IRQ check timeout with 6522 counter underflow - GH#608
|
||||
{
|
||||
UpdateIFR(pMB, IxR_TIMER2); // Clear Timer2 Interrupt Flag
|
||||
pMB->sy6522.TIMER2_LATCH.h = nValue; // NB. Real 6522 doesn't have TIMER2_LATCH.h
|
||||
const UINT id = nDevice*kNumTimersPer6522+1; // TIMER2
|
||||
pMB->sy6522.TIMER2_COUNTER.w = SetTimerSyncEvent(id, nReg, pMB->sy6522.TIMER2_LATCH.w);
|
||||
StartTimer2(pMB);
|
||||
}
|
||||
break;
|
||||
case 0x0a: // SERIAL_SHIFT
|
||||
break;
|
||||
|
@ -1509,6 +1600,11 @@ void MB_Initialize()
|
|||
|
||||
InitializeCriticalSection(&g_CriticalSection);
|
||||
g_bCritSectionValid = true;
|
||||
|
||||
for (int id=0; id<kNumSyncEvents; id++)
|
||||
{
|
||||
g_syncEvent[id] = new SyncEvent(id, 0, MB_SyncEventCallback);
|
||||
}
|
||||
}
|
||||
|
||||
static void MB_SetSoundcardType(SS_CARDTYPE NewSoundcardType);
|
||||
|
@ -1550,6 +1646,12 @@ void MB_Destroy()
|
|||
DeleteCriticalSection(&g_CriticalSection);
|
||||
g_bCritSectionValid = false;
|
||||
}
|
||||
|
||||
for (int id=0; id<kNumSyncEvents; id++)
|
||||
{
|
||||
delete g_syncEvent[id];
|
||||
g_syncEvent[id] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -1574,6 +1676,12 @@ static void ResetState()
|
|||
g_uLastMBUpdateCycle = 0;
|
||||
g_cyclesThisAudioFrame = 0;
|
||||
|
||||
for (int id = 0; id < kNumSyncEvents; id++)
|
||||
{
|
||||
if (g_syncEvent[id] && g_syncEvent[id]->m_active)
|
||||
g_SynchronousEventMgr.Remove(id);
|
||||
}
|
||||
|
||||
// Not these, as they don't change on a CTRL+RESET or power-cycle:
|
||||
// g_bMBAvailable = false;
|
||||
// g_SoundcardType = CT_Empty; // Don't uncomment, else _ASSERT will fire in MB_Read() after an F2->MB_Reset()
|
||||
|
@ -1601,8 +1709,7 @@ void MB_Reset() // CTRL+RESET or power-cycle
|
|||
|
||||
static BYTE __stdcall MB_Read(WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, ULONG nExecutedCycles)
|
||||
{
|
||||
if (g_bFullSpeed)
|
||||
MB_UpdateCycles(nExecutedCycles);
|
||||
MB_UpdateCycles(nExecutedCycles);
|
||||
|
||||
#ifdef _DEBUG
|
||||
if(!IS_APPLE2 && MemCheckINTCXROM())
|
||||
|
@ -1665,8 +1772,7 @@ static BYTE __stdcall MB_Read(WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, ULO
|
|||
|
||||
static BYTE __stdcall MB_Write(WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, ULONG nExecutedCycles)
|
||||
{
|
||||
if (g_bFullSpeed)
|
||||
MB_UpdateCycles(nExecutedCycles);
|
||||
MB_UpdateCycles(nExecutedCycles);
|
||||
|
||||
#ifdef _DEBUG
|
||||
if(!IS_APPLE2 && MemCheckINTCXROM())
|
||||
|
@ -1827,21 +1933,21 @@ void MB_InitializeIO(LPBYTE pCxRomPeripheral, UINT uSlot4, UINT uSlot5)
|
|||
// Phasor : Slot 4
|
||||
// <other> : Slot 4 & 5
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT4) != CT_MockingboardC && g_CardMgr.QuerySlot(SLOT4) != CT_Phasor)
|
||||
if (GetCardMgr().QuerySlot(SLOT4) != CT_MockingboardC && GetCardMgr().QuerySlot(SLOT4) != CT_Phasor)
|
||||
{
|
||||
MB_SetSoundcardType(CT_Empty);
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT4) == CT_MockingboardC)
|
||||
if (GetCardMgr().QuerySlot(SLOT4) == CT_MockingboardC)
|
||||
RegisterIoHandler(uSlot4, IO_Null, IO_Null, MB_Read, MB_Write, NULL, NULL);
|
||||
else // Phasor
|
||||
RegisterIoHandler(uSlot4, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT5) == CT_MockingboardC)
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_MockingboardC)
|
||||
RegisterIoHandler(uSlot5, IO_Null, IO_Null, MB_Read, MB_Write, NULL, NULL);
|
||||
|
||||
MB_SetSoundcardType(g_CardMgr.QuerySlot(SLOT4));
|
||||
MB_SetSoundcardType(GetCardMgr().QuerySlot(SLOT4));
|
||||
|
||||
if (g_bDisableDirectSound || g_bDisableDirectSoundMockingboard)
|
||||
return;
|
||||
|
@ -1928,7 +2034,7 @@ void MB_PeriodicUpdate(UINT executedCycles)
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static bool CheckTimerUnderflowAndIrq(USHORT& timerCounter, int& timerIrqDelay, const USHORT nClocks)
|
||||
static bool CheckTimerUnderflow(USHORT& timerCounter, int& timerIrqDelay, const USHORT nClocks)
|
||||
{
|
||||
if (nClocks == 0)
|
||||
return false;
|
||||
|
@ -1960,96 +2066,83 @@ static bool CheckTimerUnderflowAndIrq(USHORT& timerCounter, int& timerIrqDelay,
|
|||
}
|
||||
|
||||
// Called by:
|
||||
// . CpuExecute() every ~1000 @ 1MHz
|
||||
// . CheckInterruptSources() every opcode (or every 40 opcodes at full-speed)
|
||||
// . MB_Read() / MB_Write() (only for full-speed)
|
||||
bool MB_UpdateCycles(ULONG uExecutedCycles)
|
||||
// . CpuExecute() every ~1000 cycles @ 1MHz
|
||||
// . MB_SyncEventCallback() on a TIMER1/2 underflow
|
||||
// . MB_Read() / MB_Write() (for both normal & full-speed)
|
||||
void MB_UpdateCycles(ULONG uExecutedCycles)
|
||||
{
|
||||
if (g_SoundcardType == CT_Empty)
|
||||
return false;
|
||||
return;
|
||||
|
||||
CpuCalcCycles(uExecutedCycles);
|
||||
UINT64 uCycles = g_nCumulativeCycles - g_uLastCumulativeCycles;
|
||||
_ASSERT(uCycles >= 0);
|
||||
if (uCycles == 0)
|
||||
return false; // Likely when called from CpuExecute()
|
||||
|
||||
const bool isOpcode = (uCycles <= 7); // todo: better to pass in a flag?
|
||||
return;
|
||||
|
||||
g_uLastCumulativeCycles = g_nCumulativeCycles;
|
||||
_ASSERT(uCycles < 0x10000);
|
||||
USHORT nClocks = (USHORT) uCycles;
|
||||
_ASSERT(uCycles < 0x10000 || g_nAppMode == MODE_BENCHMARK);
|
||||
USHORT nClocks = (USHORT)uCycles;
|
||||
|
||||
bool bIrqOnLastOpcodeCycle = false;
|
||||
|
||||
for (int i=0; i<NUM_SY6522; i++)
|
||||
for (int i = 0; i < NUM_SY6522; i++)
|
||||
{
|
||||
SY6522_AY8910* pMB = &g_MB[i];
|
||||
|
||||
bool bTimer1Irq = false;
|
||||
bool bTimer1IrqOnLastCycle = false;
|
||||
const bool bTimer1Underflow = CheckTimerUnderflow(pMB->sy6522.TIMER1_COUNTER.w, pMB->sy6522.timer1IrqDelay, nClocks);
|
||||
const bool bTimer2Underflow = CheckTimerUnderflow(pMB->sy6522.TIMER2_COUNTER.w, pMB->sy6522.timer2IrqDelay, nClocks);
|
||||
|
||||
if (isOpcode)
|
||||
if (pMB->bTimer1Active && bTimer1Underflow)
|
||||
{
|
||||
bTimer1Irq = CheckTimerUnderflowAndIrq(pMB->sy6522.TIMER1_COUNTER.w, pMB->sy6522.timer1IrqDelay, nClocks-1);
|
||||
bTimer1IrqOnLastCycle = CheckTimerUnderflowAndIrq(pMB->sy6522.TIMER1_COUNTER.w, pMB->sy6522.timer1IrqDelay, 1);
|
||||
bTimer1Irq = bTimer1Irq || bTimer1IrqOnLastCycle;
|
||||
}
|
||||
else
|
||||
{
|
||||
bTimer1Irq = CheckTimerUnderflowAndIrq(pMB->sy6522.TIMER1_COUNTER.w, pMB->sy6522.timer1IrqDelay, nClocks);
|
||||
}
|
||||
|
||||
const bool bTimer2Irq = CheckTimerUnderflowAndIrq(pMB->sy6522.TIMER2_COUNTER.w, pMB->sy6522.timer2IrqDelay, nClocks);
|
||||
|
||||
if (pMB->bTimer1Active && bTimer1Irq)
|
||||
{
|
||||
UpdateIFR(pMB, 0, IxR_TIMER1);
|
||||
bIrqOnLastOpcodeCycle = bTimer1IrqOnLastCycle;
|
||||
|
||||
MB_Update();
|
||||
|
||||
if ((pMB->sy6522.ACR & RUNMODE) == RM_ONESHOT)
|
||||
pMB->sy6522.TIMER1_COUNTER.w += pMB->sy6522.TIMER1_LATCH.w; // GH#651: account for underflowed cycles too
|
||||
pMB->sy6522.TIMER1_COUNTER.w += kExtraTimerCycles; // GH#652: account for extra 2 cycles
|
||||
// EG. T1C=0xFFFE, T1L=0x0001
|
||||
// . T1C += T1L = 0xFFFF
|
||||
// . T1C += 2 = 0x0001
|
||||
if (pMB->sy6522.TIMER1_COUNTER.w > pMB->sy6522.TIMER1_LATCH.w)
|
||||
{
|
||||
// One-shot mode
|
||||
// - Phasor's playback code uses one-shot mode
|
||||
StopTimer1(pMB);
|
||||
if (pMB->sy6522.TIMER1_LATCH.w)
|
||||
pMB->sy6522.TIMER1_COUNTER.w %= pMB->sy6522.TIMER1_LATCH.w; // Only occurs if LATCH.w<0x0007 (# cycles for longest opcode)
|
||||
else
|
||||
pMB->sy6522.TIMER1_COUNTER.w = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Free-running mode
|
||||
// - Ultima4/5 change ACCESS_TIMER1 after a couple of IRQs into tune
|
||||
pMB->sy6522.TIMER1_COUNTER.w += pMB->sy6522.TIMER1_LATCH.w; // GH#651: account for underflowed cycles too
|
||||
pMB->sy6522.TIMER1_COUNTER.w += 2; // GH#652: account for extra 2 cycles (Rockwell, Fig.16: period=N+2cycles)
|
||||
// EG. T1C=0xFFFE, T1L=0x0001
|
||||
// . T1C += T1L = 0xFFFF
|
||||
// . T1C += 2 = 0x0001
|
||||
if (pMB->sy6522.TIMER1_COUNTER.w > pMB->sy6522.TIMER1_LATCH.w)
|
||||
{
|
||||
if (pMB->sy6522.TIMER1_LATCH.w)
|
||||
pMB->sy6522.TIMER1_COUNTER.w %= pMB->sy6522.TIMER1_LATCH.w; // Only occurs if LATCH.w<0x0007 (# cycles for longest opcode)
|
||||
else
|
||||
pMB->sy6522.TIMER1_COUNTER.w = 0;
|
||||
}
|
||||
StartTimer1(pMB);
|
||||
}
|
||||
}
|
||||
|
||||
if (pMB->bLoadT1C)
|
||||
{
|
||||
pMB->bLoadT1C = false;
|
||||
pMB->sy6522.TIMER1_COUNTER.w = pMB->sy6522.TIMER1_LATCH.w;
|
||||
}
|
||||
|
||||
if (pMB->bTimer2Active && bTimer2Irq)
|
||||
{
|
||||
UpdateIFR(pMB, 0, IxR_TIMER2);
|
||||
|
||||
// TIMER2 only runs in one-shot mode
|
||||
StopTimer2(pMB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bIrqOnLastOpcodeCycle;
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static int MB_SyncEventCallback(int id, int /*cycles*/, ULONG uExecutedCycles)
|
||||
{
|
||||
SY6522_AY8910* pMB = &g_MB[id / kNumTimersPer6522];
|
||||
|
||||
if ((id & 1) == 0)
|
||||
{
|
||||
_ASSERT(pMB->bTimer1Active);
|
||||
MB_Update();
|
||||
|
||||
UpdateIFR(pMB, 0, IxR_TIMER1);
|
||||
|
||||
if ((pMB->sy6522.ACR & RUNMODE) == RM_ONESHOT)
|
||||
{
|
||||
// One-shot mode
|
||||
// - Phasor's playback code uses one-shot mode
|
||||
StopTimer1(pMB);
|
||||
return 0; // Don't repeat event
|
||||
}
|
||||
|
||||
MB_UpdateCycles(uExecutedCycles);
|
||||
|
||||
StartTimer1(pMB);
|
||||
return pMB->sy6522.TIMER1_COUNTER.w + kExtraTimerCycles;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ASSERT(pMB->bTimer2Active);
|
||||
UpdateIFR(pMB, 0, IxR_TIMER2);
|
||||
|
||||
StopTimer2(pMB); // TIMER2 only runs in one-shot mode
|
||||
return 0; // Don't repeat event
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -2350,6 +2443,21 @@ bool MB_LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version)
|
|||
StartTimer1(pMB); // Attempt to start timer
|
||||
}
|
||||
|
||||
if (pMB->bTimer1Active)
|
||||
{
|
||||
const UINT id = nDeviceNum*kNumTimersPer6522+0; // TIMER1
|
||||
SyncEvent* pSyncEvent = g_syncEvent[id];
|
||||
pSyncEvent->SetCycles(pMB->sy6522.TIMER1_COUNTER.w + kExtraTimerCycles); // NB. use COUNTER, not LATCH
|
||||
g_SynchronousEventMgr.Insert(pSyncEvent);
|
||||
}
|
||||
if (pMB->bTimer2Active)
|
||||
{
|
||||
const UINT id = nDeviceNum*kNumTimersPer6522+1; // TIMER2
|
||||
SyncEvent* pSyncEvent = g_syncEvent[id];
|
||||
pSyncEvent->SetCycles(pMB->sy6522.TIMER2_COUNTER.w + kExtraTimerCycles); // NB. use COUNTER, not LATCH
|
||||
g_SynchronousEventMgr.Insert(pSyncEvent);
|
||||
}
|
||||
|
||||
// FIXME: currently only support a single speech chip
|
||||
// NB. g_bVotraxPhoneme is never true, as the phoneme playback completes in SSI263Thread() before this point in the save-state.
|
||||
// NB. SpeechChip.DurationPhoneme will mostly be non-zero during speech playback, as this is the SSI263 register, not whether the phonene is active.
|
||||
|
@ -2487,6 +2595,21 @@ bool Phasor_LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version
|
|||
StartTimer1(pMB); // Attempt to start timer
|
||||
}
|
||||
|
||||
if (pMB->bTimer1Active)
|
||||
{
|
||||
const UINT id = nDeviceNum*kNumTimersPer6522+0; // TIMER1
|
||||
SyncEvent* pSyncEvent = g_syncEvent[id];
|
||||
pSyncEvent->SetCycles(pMB->sy6522.TIMER1_COUNTER.w + kExtraTimerCycles); // NB. use COUNTER, not LATCH
|
||||
g_SynchronousEventMgr.Insert(pSyncEvent);
|
||||
}
|
||||
if (pMB->bTimer2Active)
|
||||
{
|
||||
const UINT id = nDeviceNum*kNumTimersPer6522+1; // TIMER2
|
||||
SyncEvent* pSyncEvent = g_syncEvent[id];
|
||||
pSyncEvent->SetCycles(pMB->sy6522.TIMER2_COUNTER.w + kExtraTimerCycles); // NB. use COUNTER, not LATCH
|
||||
g_SynchronousEventMgr.Insert(pSyncEvent);
|
||||
}
|
||||
|
||||
// FIXME: currently only support a single speech chip
|
||||
if (pMB->SpeechChip.DurationPhoneme || g_bVotraxPhoneme)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ void MB_CheckCumulativeCycles(); // DEBUG
|
|||
void MB_SetCumulativeCycles();
|
||||
void MB_PeriodicUpdate(UINT executedCycles);
|
||||
void MB_CheckIRQ();
|
||||
bool MB_UpdateCycles(ULONG uExecutedCycles);
|
||||
void MB_UpdateCycles(ULONG uExecutedCycles);
|
||||
SS_CARDTYPE MB_GetSoundcardType();
|
||||
bool MB_IsActive();
|
||||
DWORD MB_GetVolume();
|
||||
|
|
|
@ -44,11 +44,14 @@ Etc.
|
|||
#include "SaveState_Structs_common.h"
|
||||
#include "Common.h"
|
||||
|
||||
#include "AppleWin.h" // g_SynchronousEventMgr
|
||||
#include "CardManager.h"
|
||||
#include "CPU.h"
|
||||
#include "Frame.h" // FrameSetCursorPosByMousePos()
|
||||
#include "Log.h"
|
||||
#include "Memory.h"
|
||||
#include "MouseInterface.h"
|
||||
#include "NTSC.h" // NTSC_GetCyclesUntilVBlank()
|
||||
#include "YamlHelper.h"
|
||||
|
||||
#include "../resource/resource.h"
|
||||
|
@ -131,8 +134,9 @@ void M6821_Listener_A( void* objTo, BYTE byData )
|
|||
|
||||
CMouseInterface::CMouseInterface(UINT slot) :
|
||||
Card(CT_MouseInterface),
|
||||
m_pSlotRom(NULL),
|
||||
m_uSlot(slot),
|
||||
m_pSlotRom(NULL)
|
||||
m_syncEvent(slot, 0, SyncEventCallback) // use slot# as "unique" id for MouseInterfaces
|
||||
{
|
||||
m_6821.SetListenerB( this, M6821_Listener_B );
|
||||
m_6821.SetListenerA( this, M6821_Listener_A );
|
||||
|
@ -145,6 +149,9 @@ CMouseInterface::CMouseInterface(UINT slot) :
|
|||
CMouseInterface::~CMouseInterface()
|
||||
{
|
||||
delete [] m_pSlotRom;
|
||||
|
||||
if (m_syncEvent.m_active)
|
||||
g_SynchronousEventMgr.Remove(m_syncEvent.m_id);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -184,6 +191,10 @@ void CMouseInterface::Initialize(LPBYTE pCxRomPeripheral, UINT uSlot)
|
|||
_ASSERT(m_uSlot == uSlot);
|
||||
SetSlotRom(); // Pre: m_bActive == true
|
||||
RegisterIoHandler(uSlot, &CMouseInterface::IORead, &CMouseInterface::IOWrite, NULL, NULL, this, NULL);
|
||||
|
||||
if (m_syncEvent.m_active) g_SynchronousEventMgr.Remove(m_syncEvent.m_id);
|
||||
m_syncEvent.m_cyclesRemaining = NTSC_GetCyclesUntilVBlank(0);
|
||||
g_SynchronousEventMgr.Insert(&m_syncEvent);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -221,6 +232,8 @@ void CMouseInterface::Reset()
|
|||
Clear();
|
||||
memset( m_byBuff, 0, sizeof( m_byBuff ) );
|
||||
SetSlotRom();
|
||||
|
||||
// NB. Leave the syncEvent in the list - otherwise nothing else will re-add it!
|
||||
}
|
||||
|
||||
void CMouseInterface::SetSlotRom()
|
||||
|
@ -475,16 +488,10 @@ void CMouseInterface::OnMouseEvent(bool bEventVBL)
|
|||
}
|
||||
}
|
||||
|
||||
void CMouseInterface::SetVBlank(bool bVBL)
|
||||
int CMouseInterface::SyncEventCallback(int id, int cycles, ULONG /*uExecutedCycles*/)
|
||||
{
|
||||
// _ASSERT(m_bActive); // Only called from CheckInterruptSources()
|
||||
|
||||
if ( m_bVBL != bVBL )
|
||||
{
|
||||
m_bVBL = bVBL;
|
||||
if ( m_bVBL ) // Rising edge
|
||||
OnMouseEvent(true);
|
||||
}
|
||||
GetCardMgr().GetMouseCard()->OnMouseEvent(true);
|
||||
return NTSC_GetCyclesUntilVBlank(cycles);
|
||||
}
|
||||
|
||||
void CMouseInterface::Clear()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "6821.h"
|
||||
#include "Common.h"
|
||||
#include "Card.h"
|
||||
#include "SynchronousEventManager.h"
|
||||
|
||||
class CMouseInterface : public Card
|
||||
{
|
||||
|
@ -23,7 +24,6 @@ public:
|
|||
bool IsEnabled() { return m_bEnabled; } // NB. m_bEnabled == true implies that m_bActive == true
|
||||
bool IsActiveAndEnabled() { return /*IsActive() &&*/ IsEnabled(); } // todo: just use IsEnabled()
|
||||
void SetEnabled(bool bEnabled) { m_bEnabled = bEnabled; }
|
||||
void SetVBlank(bool bVBL);
|
||||
void GetXY(int& iX, int& iMinX, int& iMaxX, int& iY, int& iMinY, int& iMaxY)
|
||||
{
|
||||
iX = m_iX;
|
||||
|
@ -62,6 +62,8 @@ protected:
|
|||
void SetClampX(int iMinX, int iMaxX);
|
||||
void SetClampY(int iMinY, int iMaxY);
|
||||
|
||||
static int SyncEventCallback(int id, int cycles, ULONG uExecutedCycles);
|
||||
|
||||
void SaveSnapshotMC6821(class YamlSaveHelper& yamlSaveHelper, std::string key);
|
||||
void LoadSnapshotMC6821(class YamlLoadHelper& yamlLoadHelper, std::string key);
|
||||
|
||||
|
@ -102,6 +104,8 @@ protected:
|
|||
bool m_bEnabled; // Windows' mouse events get passed to Apple]['s mouse h/w (m_bEnabled == true implies that m_bActive == true)
|
||||
LPBYTE m_pSlotRom;
|
||||
UINT m_uSlot;
|
||||
|
||||
SyncEvent m_syncEvent;
|
||||
};
|
||||
|
||||
namespace DIMouse
|
||||
|
|
|
@ -2609,6 +2609,24 @@ UINT NTSC_GetVideoLines(void)
|
|||
return (GetVideoRefreshRate() == VR_50HZ) ? VIDEO_SCANNER_MAX_VERT_PAL : VIDEO_SCANNER_MAX_VERT;
|
||||
}
|
||||
|
||||
// Get # cycles until rising Vbl edge: !VBl -> VBl at (0,192)
|
||||
// . NB. Called from CMouseInterface::SyncEventCallback(), which occurs *before* NTSC_VideoUpdateCycles()
|
||||
// therefore g_nVideoClockVert/Horz will be behind, so correct 'cycleCurrentPos' by adding 'cycles'.
|
||||
UINT NTSC_GetCyclesUntilVBlank(int cycles)
|
||||
{
|
||||
const UINT cyclesPerFrames = NTSC_GetCyclesPerFrame();
|
||||
|
||||
if (g_bFullSpeed)
|
||||
return cyclesPerFrames; // g_nVideoClockVert/Horz not correct & accuracy isn't important: so just wait a frame's worth of cycles
|
||||
|
||||
const UINT cycleVBl = VIDEO_SCANNER_Y_DISPLAY * VIDEO_SCANNER_MAX_HORZ;
|
||||
const UINT cycleCurrentPos = (g_nVideoClockVert * VIDEO_SCANNER_MAX_HORZ + g_nVideoClockHorz + cycles) % cyclesPerFrames;
|
||||
|
||||
return (cycleCurrentPos < cycleVBl) ?
|
||||
(cycleVBl - cycleCurrentPos) :
|
||||
(cyclesPerFrames - cycleCurrentPos + cycleVBl);
|
||||
}
|
||||
|
||||
bool NTSC_IsVisible(void)
|
||||
{
|
||||
return (g_nVideoClockVert < VIDEO_SCANNER_Y_DISPLAY) && (g_nVideoClockHorz >= VIDEO_SCANNER_HORZ_START);
|
||||
|
|
|
@ -23,4 +23,5 @@
|
|||
UINT NTSC_GetCyclesPerFrame(void);
|
||||
UINT NTSC_GetCyclesPerLine(void);
|
||||
UINT NTSC_GetVideoLines(void);
|
||||
UINT NTSC_GetCyclesUntilVBlank(int cycles);
|
||||
bool NTSC_IsVisible(void);
|
||||
|
|
|
@ -159,17 +159,17 @@ static BYTE __stdcall PrintStatus(WORD, WORD, BYTE, BYTE, ULONG)
|
|||
//===========================================================================
|
||||
static BYTE __stdcall PrintTransmit(WORD, WORD, BYTE, BYTE value, ULONG)
|
||||
{
|
||||
char Lat8A[]= "abwgdevzijklmnoprstufhc~{}yx`q|]";
|
||||
char Lat82[]= "abwgdevzijklmnoprstufhc^[]yx@q{}~`";
|
||||
char Kir82[]= "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÜÞß[]^@";
|
||||
char Kir8ACapital[]= "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÜÞßÝ";
|
||||
char Lat8A[]= "abwgdevzijklmnoprstufhc~{}yx`q|]";
|
||||
char Lat82[]= "abwgdevzijklmnoprstufhc^[]yx@q{}~`";
|
||||
char Kir82[]= "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÜÞß[]^@";
|
||||
char Kir8ACapital[]= "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÜÞßÝ";
|
||||
char Kir8ALowerCase[]= "àáâãäåæçèéêëìíîïðñòóôõö÷øùúüþÿý";
|
||||
bool Pres = false;
|
||||
if (!CheckPrint())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (!CheckPrint())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
char c = 0;
|
||||
if ((g_Apple2Type == A2TYPE_PRAVETS8A) && g_bConvertEncoding) //This is print conversion for Pravets 8A/C. Print conversion for Pravets82/M is still to be done.
|
||||
{
|
||||
|
|
|
@ -283,14 +283,14 @@ static void ParseSlots(YamlLoadHelper& yamlLoadHelper, UINT unitVersion)
|
|||
else if (card == CSuperSerialCard::GetSnapshotCardName())
|
||||
{
|
||||
type = CT_SSC;
|
||||
g_CardMgr.Insert(slot, type);
|
||||
bRes = dynamic_cast<CSuperSerialCard&>(g_CardMgr.GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = dynamic_cast<CSuperSerialCard&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == CMouseInterface::GetSnapshotCardName())
|
||||
{
|
||||
type = CT_MouseInterface;
|
||||
g_CardMgr.Insert(slot, type);
|
||||
bRes = dynamic_cast<CMouseInterface&>(g_CardMgr.GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = dynamic_cast<CMouseInterface&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == Z80_GetSnapshotCardName())
|
||||
{
|
||||
|
@ -310,8 +310,8 @@ static void ParseSlots(YamlLoadHelper& yamlLoadHelper, UINT unitVersion)
|
|||
else if (card == Disk2InterfaceCard::GetSnapshotCardName())
|
||||
{
|
||||
type = CT_Disk2;
|
||||
g_CardMgr.Insert(slot, type);
|
||||
bRes = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == HD_GetSnapshotCardName())
|
||||
{
|
||||
|
@ -423,23 +423,23 @@ static void Snapshot_LoadState_v2(void)
|
|||
MemReset(); // Also calls CpuInitialize()
|
||||
PravetsReset();
|
||||
|
||||
if (g_CardMgr.IsSSCInstalled())
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
{
|
||||
g_CardMgr.GetSSC()->CommReset();
|
||||
GetCardMgr().GetSSC()->CommReset();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ASSERT(g_CardMgr.QuerySlot(SLOT2) == CT_Empty);
|
||||
_ASSERT(GetCardMgr().QuerySlot(SLOT2) == CT_Empty);
|
||||
ConfigOld.m_Slot[2] = CT_Empty;
|
||||
}
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT4) == CT_MouseInterface)
|
||||
g_CardMgr.Remove(SLOT4); // Remove Mouse card from slot-4
|
||||
if (GetCardMgr().QuerySlot(SLOT4) == CT_MouseInterface)
|
||||
GetCardMgr().Remove(SLOT4); // Remove Mouse card from slot-4
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT5) == CT_Disk2)
|
||||
g_CardMgr.Remove(SLOT5); // Remove Disk2 card from slot-5
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
|
||||
GetCardMgr().Remove(SLOT5); // Remove Disk2 card from slot-5
|
||||
|
||||
g_CardMgr.GetDisk2CardMgr().Reset(false);
|
||||
GetCardMgr().GetDisk2CardMgr().Reset(false);
|
||||
|
||||
HD_Reset();
|
||||
HD_SetEnabled(false);
|
||||
|
@ -479,7 +479,6 @@ static void Snapshot_LoadState_v2(void)
|
|||
|
||||
MemUpdatePaging(TRUE);
|
||||
|
||||
SetMouseCardInstalled( g_CardMgr.IsMouseCardInstalled() );
|
||||
DebugReset();
|
||||
if (g_nAppMode == MODE_DEBUG)
|
||||
DebugDisplay(TRUE);
|
||||
|
@ -551,43 +550,43 @@ void Snapshot_SaveState(void)
|
|||
yamlSaveHelper.UnitHdr(GetSnapshotUnitSlotsName(), UNIT_SLOTS_VER);
|
||||
YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT0) != CT_Empty && IsApple2PlusOrClone(GetApple2Type()))
|
||||
if (GetCardMgr().QuerySlot(SLOT0) != CT_Empty && IsApple2PlusOrClone(GetApple2Type()))
|
||||
GetLanguageCard()->SaveSnapshot(yamlSaveHelper); // Language Card or Saturn 128K
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT1) == CT_GenericPrinter)
|
||||
if (GetCardMgr().QuerySlot(SLOT1) == CT_GenericPrinter)
|
||||
Printer_SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT2) == CT_SSC)
|
||||
dynamic_cast<CSuperSerialCard&>(g_CardMgr.GetRef(SLOT2)).SaveSnapshot(yamlSaveHelper);
|
||||
if (GetCardMgr().QuerySlot(SLOT2) == CT_SSC)
|
||||
dynamic_cast<CSuperSerialCard&>(GetCardMgr().GetRef(SLOT2)).SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
// if (g_CardMgr.QuerySlot(SLOT3) == CT_Uthernet)
|
||||
// if (GetCardMgr().QuerySlot(SLOT3) == CT_Uthernet)
|
||||
// sg_Uthernet.SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT4) == CT_MouseInterface)
|
||||
dynamic_cast<CMouseInterface&>(g_CardMgr.GetRef(SLOT4)).SaveSnapshot(yamlSaveHelper);
|
||||
if (GetCardMgr().QuerySlot(SLOT4) == CT_MouseInterface)
|
||||
dynamic_cast<CMouseInterface&>(GetCardMgr().GetRef(SLOT4)).SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT4) == CT_Z80)
|
||||
if (GetCardMgr().QuerySlot(SLOT4) == CT_Z80)
|
||||
Z80_SaveSnapshot(yamlSaveHelper, SLOT4);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT5) == CT_Z80)
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_Z80)
|
||||
Z80_SaveSnapshot(yamlSaveHelper, SLOT5);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT4) == CT_MockingboardC)
|
||||
if (GetCardMgr().QuerySlot(SLOT4) == CT_MockingboardC)
|
||||
MB_SaveSnapshot(yamlSaveHelper, SLOT4);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT5) == CT_MockingboardC)
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_MockingboardC)
|
||||
MB_SaveSnapshot(yamlSaveHelper, SLOT5);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT4) == CT_Phasor)
|
||||
if (GetCardMgr().QuerySlot(SLOT4) == CT_Phasor)
|
||||
Phasor_SaveSnapshot(yamlSaveHelper, SLOT4);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT5) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT5)).SaveSnapshot(yamlSaveHelper);
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT5)).SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).SaveSnapshot(yamlSaveHelper);
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
if (g_CardMgr.QuerySlot(SLOT7) == CT_GenericHDD)
|
||||
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
|
||||
HD_SaveSnapshot(yamlSaveHelper);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ struct SS_CARD_DISK2
|
|||
{
|
||||
SS_CARD_HDR Hdr;
|
||||
DISK2_Unit Unit[2];
|
||||
WORD phases;
|
||||
WORD phases;
|
||||
WORD currdrive;
|
||||
BOOL diskaccessed;
|
||||
BOOL enhancedisk;
|
||||
|
|
|
@ -45,7 +45,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
//
|
||||
// [OLD: 23.191 Apple CLKs == 44100Hz (CLK_6502/44100)]
|
||||
// 23 Apple CLKS per PC sample (played back at 44.1KHz)
|
||||
//
|
||||
//
|
||||
//
|
||||
// The speaker's wave output drives how much 6502 emulation is done in real-time, eg:
|
||||
// If the speaker's wave buffer is running out of sample-data, then more 6502 cycles
|
||||
|
@ -79,8 +79,6 @@ double g_fClksPerSpkrSample; // Setup in SetClksPerSpkrSample()
|
|||
bool g_bQuieterSpeaker = false;
|
||||
|
||||
// Globals
|
||||
static DWORD lastcyclenum = 0;
|
||||
static DWORD toggles = 0;
|
||||
static unsigned __int64 g_nSpkrQuietCycleCount = 0;
|
||||
static unsigned __int64 g_nSpkrLastCycle = 0;
|
||||
static bool g_bSpkrToggleFlag = false;
|
||||
|
@ -93,6 +91,7 @@ static bool g_bSpkrAvailable = false;
|
|||
static ULONG Spkr_SubmitWaveBuffer_FullSpeed(short* pSpeakerBuffer, ULONG nNumSamples);
|
||||
static ULONG Spkr_SubmitWaveBuffer(short* pSpeakerBuffer, ULONG nNumSamples);
|
||||
static void Spkr_SetActive(bool bActive);
|
||||
static void Spkr_DSUninit();
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
@ -130,21 +129,21 @@ static void DisplayBenchmarkResults ()
|
|||
// and the samples are unaffected
|
||||
// - if the counter is < 32768 but > 0, it is used to scale the
|
||||
// sample to reduce +ve or -ve speaker states towards zero
|
||||
// - In the two cases above, the counter is decremented
|
||||
// - In the two cases above, the counter is decremented
|
||||
// - if the counter is zero, the speaker has been silent for a while
|
||||
// and the output is 0 regardless of the speaker state.
|
||||
//
|
||||
// - the initial "high value" is chosen so 10000/44100 = about a
|
||||
// - the initial "high value" is chosen so 10000/44100 = about a
|
||||
// quarter of a second of speaker inactivity is needed before attenuation
|
||||
// begins.
|
||||
//
|
||||
// NOTE: The attenuation is not ever reducing the level of audio, just
|
||||
// the DC offset at which the speaker has been left.
|
||||
// the DC offset at which the speaker has been left.
|
||||
//
|
||||
// This approach has zero impact on any speaker tones including PWM
|
||||
// due to the samples being unchanged for at least 0.25 seconds after
|
||||
// any speaker activity.
|
||||
//
|
||||
//
|
||||
|
||||
static UINT g_uDCFilterState = 0;
|
||||
|
||||
|
@ -215,7 +214,7 @@ void SpkrDestroy ()
|
|||
{
|
||||
delete [] g_pSpeakerBuffer;
|
||||
delete [] g_pRemainderBuffer;
|
||||
|
||||
|
||||
g_pSpeakerBuffer = NULL;
|
||||
g_pRemainderBuffer = NULL;
|
||||
}
|
||||
|
@ -611,7 +610,7 @@ static ULONG Spkr_SubmitWaveBuffer_FullSpeed(short* pSpeakerBuffer, ULONG nNumSa
|
|||
if(dwBufferSize1 > dwDSLockedBufferSize1)
|
||||
dwBufferSize1 = dwDSLockedBufferSize1;
|
||||
}
|
||||
|
||||
|
||||
memcpy(pDSLockedBuffer0, &pSpeakerBuffer[0], dwBufferSize0);
|
||||
#ifdef RIFF_SPKR
|
||||
RiffPutSamples(pDSLockedBuffer0, dwBufferSize0/sizeof(short));
|
||||
|
@ -926,7 +925,7 @@ bool Spkr_DSInit()
|
|||
return true;
|
||||
}
|
||||
|
||||
void Spkr_DSUninit()
|
||||
static void Spkr_DSUninit()
|
||||
{
|
||||
if(SpeakerVoice.lpDSBvoice && SpeakerVoice.bActive)
|
||||
{
|
||||
|
|
|
@ -24,15 +24,12 @@ void SpkrReset();
|
|||
BOOL SpkrSetEmulationType (HWND window, SoundType_e newSoundType);
|
||||
void SpkrUpdate (DWORD);
|
||||
void SpkrUpdate_Timer();
|
||||
void Spkr_SetErrorInc(const int nErrorInc);
|
||||
void Spkr_SetErrorMax(const int nErrorMax);
|
||||
DWORD SpkrGetVolume();
|
||||
void SpkrSetVolume(DWORD dwVolume, DWORD dwVolumeMax);
|
||||
void Spkr_Mute();
|
||||
void Spkr_Demute();
|
||||
bool Spkr_IsActive();
|
||||
bool Spkr_DSInit();
|
||||
void Spkr_DSUninit();
|
||||
void SpkrSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
void SpkrLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
||||
|
||||
|
|
168
source/SynchronousEventManager.cpp
Normal file
168
source/SynchronousEventManager.cpp
Normal file
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
AppleWin : An Apple //e emulator for Windows
|
||||
|
||||
Copyright (C) 1994-1996, Michael O'Brien
|
||||
Copyright (C) 1999-2001, Oliver Schmidt
|
||||
Copyright (C) 2002-2005, Tom Charlesworth
|
||||
Copyright (C) 2006-2020, Tom Charlesworth, Michael Pohoreski, Nick Westgate
|
||||
|
||||
AppleWin is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
AppleWin is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with AppleWin; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* Description: Synchronous Event Manager
|
||||
*
|
||||
* This manager class maintains a linked-list of ordered timer-based event,
|
||||
* where only the head of the list needs updating after every opcode.
|
||||
*
|
||||
* The Nth event in the list will expire in: event[1] + ... + event[N] cycles time.
|
||||
* (So each event has a cycle delta expiry time relative to the previous event.)
|
||||
*
|
||||
* A synchronous event is used for a deterministic event that will occur in N cycles' time,
|
||||
* eg. 6522 timer & Mousecard VBlank. (As opposed to async events, like SSC Rx/Tx interrupts.)
|
||||
*
|
||||
* Events that are active in the list can be removed before they expire,
|
||||
* eg. 6522 timer when the interval changes.
|
||||
*
|
||||
* Author: Various
|
||||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "AppleWin.h"
|
||||
#include "SynchronousEventManager.h"
|
||||
|
||||
void SynchronousEventManager::Insert(SyncEvent* pNewEvent)
|
||||
{
|
||||
pNewEvent->m_active = true; // add always succeeds
|
||||
|
||||
if (!m_syncEventHead)
|
||||
{
|
||||
m_syncEventHead = pNewEvent;
|
||||
return;
|
||||
}
|
||||
|
||||
// walk list to find where to insert new event
|
||||
|
||||
SyncEvent* pPrevEvent = NULL;
|
||||
SyncEvent* pCurrEvent = m_syncEventHead;
|
||||
int newEventExtraCycles = pNewEvent->m_cyclesRemaining;
|
||||
|
||||
while (pCurrEvent)
|
||||
{
|
||||
if (newEventExtraCycles >= pCurrEvent->m_cyclesRemaining)
|
||||
{
|
||||
newEventExtraCycles -= pCurrEvent->m_cyclesRemaining;
|
||||
|
||||
pPrevEvent = pCurrEvent;
|
||||
pCurrEvent = pCurrEvent->m_next;
|
||||
|
||||
if (!pCurrEvent) // end of list
|
||||
{
|
||||
pPrevEvent->m_next = pNewEvent;
|
||||
pNewEvent->m_cyclesRemaining = newEventExtraCycles;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// insert new event
|
||||
if (!pPrevEvent)
|
||||
m_syncEventHead = pNewEvent;
|
||||
else
|
||||
pPrevEvent->m_next = pNewEvent;
|
||||
pNewEvent->m_next = pCurrEvent;
|
||||
|
||||
pNewEvent->m_cyclesRemaining = newEventExtraCycles;
|
||||
|
||||
// update cycles for next event
|
||||
if (pCurrEvent)
|
||||
{
|
||||
pCurrEvent->m_cyclesRemaining -= newEventExtraCycles;
|
||||
_ASSERT(pCurrEvent->m_cyclesRemaining >= 0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool SynchronousEventManager::Remove(int id)
|
||||
{
|
||||
SyncEvent* pPrevEvent = NULL;
|
||||
SyncEvent* pCurrEvent = m_syncEventHead;
|
||||
|
||||
while (pCurrEvent)
|
||||
{
|
||||
if (pCurrEvent->m_id != id)
|
||||
{
|
||||
pPrevEvent = pCurrEvent;
|
||||
pCurrEvent = pCurrEvent->m_next;
|
||||
continue;
|
||||
}
|
||||
|
||||
// remove event
|
||||
if (!pPrevEvent)
|
||||
m_syncEventHead = pCurrEvent->m_next;
|
||||
else
|
||||
pPrevEvent->m_next = pCurrEvent->m_next;
|
||||
|
||||
int oldEventExtraCycles = pCurrEvent->m_cyclesRemaining;
|
||||
pPrevEvent = pCurrEvent;
|
||||
pCurrEvent = pCurrEvent->m_next;
|
||||
|
||||
pPrevEvent->m_active = false;
|
||||
pPrevEvent->m_next = NULL;
|
||||
|
||||
// update cycles for next event
|
||||
if (pCurrEvent)
|
||||
pCurrEvent->m_cyclesRemaining += oldEventExtraCycles;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_ASSERT(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
extern bool g_irqOnLastOpcodeCycle;
|
||||
|
||||
void SynchronousEventManager::Update(int cycles, ULONG uExecutedCycles)
|
||||
{
|
||||
SyncEvent* pCurrEvent = m_syncEventHead;
|
||||
|
||||
if (!pCurrEvent)
|
||||
return;
|
||||
|
||||
pCurrEvent->m_cyclesRemaining -= cycles;
|
||||
if (pCurrEvent->m_cyclesRemaining <= 0)
|
||||
{
|
||||
if (pCurrEvent->m_cyclesRemaining == 0)
|
||||
g_irqOnLastOpcodeCycle = true; // IRQ occurs on last cycle of opcode
|
||||
|
||||
int cyclesUnderflowed = -pCurrEvent->m_cyclesRemaining;
|
||||
|
||||
pCurrEvent->m_cyclesRemaining = pCurrEvent->m_callback(pCurrEvent->m_id, cycles, uExecutedCycles);
|
||||
m_syncEventHead = pCurrEvent->m_next; // unlink this event
|
||||
|
||||
pCurrEvent->m_active = false;
|
||||
pCurrEvent->m_next = NULL;
|
||||
|
||||
// Always Update even if cyclesUnderflowed=0, as next event may have cycleRemaining=0 (ie. the 2 events fire at the same time)
|
||||
Update(cyclesUnderflowed, uExecutedCycles); // update (potential) next event with underflow cycles
|
||||
|
||||
if (pCurrEvent->m_cyclesRemaining)
|
||||
Insert(pCurrEvent); // re-add event
|
||||
}
|
||||
}
|
50
source/SynchronousEventManager.h
Normal file
50
source/SynchronousEventManager.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
#pragma once
|
||||
|
||||
class SyncEvent;
|
||||
|
||||
class SynchronousEventManager
|
||||
{
|
||||
public:
|
||||
SynchronousEventManager() : m_syncEventHead(NULL)
|
||||
{}
|
||||
~SynchronousEventManager(){}
|
||||
|
||||
SyncEvent* GetHead(void) { return m_syncEventHead; }
|
||||
void SetHead(SyncEvent* head) { m_syncEventHead = head; }
|
||||
|
||||
void Insert(SyncEvent* pNewEvent);
|
||||
bool Remove(int id);
|
||||
void Update(int cycles, ULONG uExecutedCycles);
|
||||
void Reset(void) { m_syncEventHead = NULL; }
|
||||
|
||||
private:
|
||||
SyncEvent* m_syncEventHead;
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
typedef int (*syncEventCB)(int id, int cycles, ULONG uExecutedCycles);
|
||||
|
||||
class SyncEvent
|
||||
{
|
||||
public:
|
||||
SyncEvent(int id, int initCycles, syncEventCB callback)
|
||||
: m_id(id),
|
||||
m_cyclesRemaining(initCycles),
|
||||
m_active(false),
|
||||
m_callback(callback),
|
||||
m_next(NULL)
|
||||
{}
|
||||
~SyncEvent(){}
|
||||
|
||||
void SetCycles(int cycles)
|
||||
{
|
||||
m_cyclesRemaining = cycles;
|
||||
}
|
||||
|
||||
int m_id;
|
||||
int m_cyclesRemaining;
|
||||
bool m_active;
|
||||
syncEventCB m_callback;
|
||||
SyncEvent* m_next;
|
||||
};
|
|
@ -172,6 +172,7 @@ void VideoInitialize ()
|
|||
|
||||
//===========================================================================
|
||||
void VideoBenchmark () {
|
||||
_ASSERT(g_nAppMode == MODE_BENCHMARK);
|
||||
Sleep(500);
|
||||
|
||||
// PREPARE TWO DIFFERENT FRAME BUFFERS, EACH OF WHICH HAVE HALF OF THE
|
||||
|
@ -309,7 +310,7 @@ void VideoBenchmark () {
|
|||
while (cycles > 0) {
|
||||
DWORD executedcycles = CpuExecute(103, true);
|
||||
cycles -= executedcycles;
|
||||
g_CardMgr.GetDisk2CardMgr().UpdateDriveState(executedcycles);
|
||||
GetCardMgr().GetDisk2CardMgr().UpdateDriveState(executedcycles);
|
||||
JoyUpdateButtonLatch(executedcycles);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,10 +74,10 @@ public:
|
|||
YamlLoadHelper(YamlHelper& yamlHelper)
|
||||
: m_yamlHelper(yamlHelper),
|
||||
m_pMapYaml(&yamlHelper.m_mapYaml),
|
||||
m_bIteratingOverMap(false),
|
||||
m_bDoGetMapRemainder(true),
|
||||
m_topLevelMapName(yamlHelper.m_scalarName),
|
||||
m_currentMapName(m_topLevelMapName)
|
||||
m_currentMapName(m_topLevelMapName),
|
||||
m_bIteratingOverMap(false)
|
||||
{
|
||||
if (!m_yamlHelper.ParseMap(yamlHelper.m_mapYaml))
|
||||
{
|
||||
|
|
|
@ -194,6 +194,10 @@
|
|||
RelativePath=".\stdafx.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\SynchronousEventManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\TestCPU6502.cpp"
|
||||
>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\source\SynchronousEventManager.cpp" />
|
||||
<ClCompile Include="stdafx.cpp" />
|
||||
<ClCompile Include="TestCPU6502.cpp" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
<ClCompile Include="TestCPU6502.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\SynchronousEventManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
#include "../../source/Applewin.h"
|
||||
#include "../../source/CPU.h"
|
||||
#include "../../source/Memory.h"
|
||||
#include "../../source/SynchronousEventManager.h"
|
||||
|
||||
// From Applewin.cpp
|
||||
bool g_bFullSpeed = false;
|
||||
enum AppMode_e g_nAppMode = MODE_RUNNING;
|
||||
SynchronousEventManager g_SynchronousEventMgr;
|
||||
|
||||
// From Memory.cpp
|
||||
LPBYTE memwrite[0x100]; // TODO: Init
|
||||
|
@ -27,8 +29,7 @@ iofunction IOWrite[256] = {0}; // TODO: Init
|
|||
|
||||
regsrec regs;
|
||||
|
||||
static const int IRQ_CHECK_TIMEOUT = 128;
|
||||
static signed int g_nIrqCheckTimeout = IRQ_CHECK_TIMEOUT;
|
||||
bool g_irqOnLastOpcodeCycle = false;
|
||||
|
||||
static eCpuType g_ActiveCPU = CPU_65C02;
|
||||
|
||||
|
@ -54,7 +55,7 @@ static __forceinline void DoIrqProfiling(DWORD uCycles)
|
|||
{
|
||||
}
|
||||
|
||||
static __forceinline void CheckInterruptSources(ULONG uExecutedCycles, const bool bVideoUpdate)
|
||||
static __forceinline void CheckSynchronousInterruptSources(UINT cycles, ULONG uExecutedCycles)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1253,6 +1254,62 @@ int GH321_test()
|
|||
|
||||
//-------------------------------------
|
||||
|
||||
int testCB(int id, int cycles, ULONG uExecutedCycles)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SyncEvents_test(void)
|
||||
{
|
||||
SyncEvent syncEvent0(0, 0x10, testCB);
|
||||
SyncEvent syncEvent1(1, 0x20, testCB);
|
||||
SyncEvent syncEvent2(2, 0x30, testCB);
|
||||
SyncEvent syncEvent3(3, 0x40, testCB);
|
||||
|
||||
g_SynchronousEventMgr.Insert(&syncEvent0);
|
||||
g_SynchronousEventMgr.Insert(&syncEvent1);
|
||||
g_SynchronousEventMgr.Insert(&syncEvent2);
|
||||
g_SynchronousEventMgr.Insert(&syncEvent3);
|
||||
// id0 -> id1 -> id2 -> id3
|
||||
if (syncEvent0.m_cyclesRemaining != 0x10) return 1;
|
||||
if (syncEvent1.m_cyclesRemaining != 0x10) return 1;
|
||||
if (syncEvent2.m_cyclesRemaining != 0x10) return 1;
|
||||
if (syncEvent3.m_cyclesRemaining != 0x10) return 1;
|
||||
|
||||
g_SynchronousEventMgr.Remove(1);
|
||||
g_SynchronousEventMgr.Remove(3);
|
||||
g_SynchronousEventMgr.Remove(0);
|
||||
if (syncEvent2.m_cyclesRemaining != 0x30) return 1;
|
||||
g_SynchronousEventMgr.Remove(2);
|
||||
|
||||
//
|
||||
|
||||
syncEvent0.m_cyclesRemaining = 0x40;
|
||||
syncEvent1.m_cyclesRemaining = 0x30;
|
||||
syncEvent2.m_cyclesRemaining = 0x20;
|
||||
syncEvent3.m_cyclesRemaining = 0x10;
|
||||
|
||||
g_SynchronousEventMgr.Insert(&syncEvent0);
|
||||
g_SynchronousEventMgr.Insert(&syncEvent1);
|
||||
g_SynchronousEventMgr.Insert(&syncEvent2);
|
||||
g_SynchronousEventMgr.Insert(&syncEvent3);
|
||||
// id3 -> id2 -> id1 -> id0
|
||||
if (syncEvent0.m_cyclesRemaining != 0x10) return 1;
|
||||
if (syncEvent1.m_cyclesRemaining != 0x10) return 1;
|
||||
if (syncEvent2.m_cyclesRemaining != 0x10) return 1;
|
||||
if (syncEvent3.m_cyclesRemaining != 0x10) return 1;
|
||||
|
||||
g_SynchronousEventMgr.Remove(3);
|
||||
g_SynchronousEventMgr.Remove(0);
|
||||
g_SynchronousEventMgr.Remove(1);
|
||||
if (syncEvent2.m_cyclesRemaining != 0x20) return 1;
|
||||
g_SynchronousEventMgr.Remove(2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
int res = 1;
|
||||
|
@ -1277,5 +1334,8 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||
res = GH292_test();
|
||||
if (res) return res;
|
||||
|
||||
res = SyncEvents_test();
|
||||
if (res) return res;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue