CD<- now works as well as CD:<-

This commit is contained in:
Stephen White 2019-04-28 16:36:55 +10:00
parent 520d6e6540
commit cf0d4e11dd
1 changed files with 28 additions and 26 deletions

View File

@ -557,6 +557,29 @@ void UpdateScreen()
} }
} }
static bool Snoop(u8 a)
{
if (a == snoopBackCommand[snoopIndex] || (snoopIndex == 2 && (a == snoopBackCommand[3])))
{
if ((snoopIndex + 1) == sizeof(snoopBackCommand) || (snoopIndex == 2 && (a == snoopBackCommand[3])))
{
// Exit full emulation back to IEC commands level simulation.
snoopIndex = 0;
return true;
}
else
{
snoopIndex++;
}
}
else
{
snoopIndex = 0;
snoopPC = 0;
}
return false;
}
EmulatingMode BeginEmulating(FileBrowser* fileBrowser, const char* filenameForIcon) EmulatingMode BeginEmulating(FileBrowser* fileBrowser, const char* filenameForIcon)
{ {
DiskImage* diskImage = diskCaddy.SelectFirstImage(); DiskImage* diskImage = diskCaddy.SelectFirstImage();
@ -695,23 +718,14 @@ EXIT_TYPE Emulate1541(FileBrowser* fileBrowser)
if (pc == snoopPC) if (pc == snoopPC)
{ {
u8 a = pi1541.m6502.GetA(); if (pc == snoopPC)
if (a == snoopBackCommand[snoopIndex])
{ {
snoopIndex++; if (Snoop(pi1541.m6502.GetA()))
if (snoopIndex == sizeof(snoopBackCommand))
{ {
// Exit full emulation back to IEC commands level simulation.
snoopIndex = 0;
emulating = IEC_COMMANDS; emulating = IEC_COMMANDS;
exitReason = EXIT_CD; exitReason = EXIT_CD;
} }
} }
else
{
snoopIndex = 0;
snoopPC = 0;
}
} }
} }
@ -902,22 +916,10 @@ EXIT_TYPE Emulate1581(FileBrowser* fileBrowser)
if (pc == snoopPC) if (pc == snoopPC)
{ {
u8 a = pi1581.m6502.GetA(); if (Snoop(pi1581.m6502.GetA()))
if (a == snoopBackCommand[snoopIndex])
{ {
snoopIndex++; emulating = IEC_COMMANDS;
if (snoopIndex == sizeof(snoopBackCommand)) exitReason = EXIT_CD;
{
// Exit full emulation back to IEC commands level simulation.
snoopIndex = 0;
emulating = IEC_COMMANDS;
exitReason = EXIT_CD;
}
}
else
{
snoopIndex = 0;
snoopPC = 0;
} }
} }
} }