Skip to content

Commit

Permalink
Merge pull request #183 from AppleWin/master
Browse files Browse the repository at this point in the history
Update from AW
  • Loading branch information
audetto committed Sep 3, 2024
2 parents f77634d + 8a3de55 commit 265f75c
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 25 deletions.
3 changes: 2 additions & 1 deletion help/cfg-advanced.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ <h2 style="color: rgb(0, 128, 0);">Advanced Settings</h2>
<li> Southwestern Data Systems' datakey - SpeedStar (copy protection dongle)
<li> Dynatech Microsoftware / Cortechs Corp's protection key - CodeWriter (copy protection dongle)
<li> Robocom Ltd's interface module - Robo 500/1000/1500 & RoboCAD 1/2 (copy protection dongle)
<li> Hayden Book Company, Inc's protection key - Applesoft Compiler (copy protection dongle)
</ul>
NB. Copy protection dongles can interfere with joysticks (eg. buttons may be hardwired to a fixed state), so only use dongles with the intended software.<br>
NB. Copy protection dongles can interfere with RGB cards (eg. unexpected video modes may get selected).<br>
NB. For Apple II/II+ models, when a joystick is selected (from the <a href="cfg-input.html">Input</a> tab), then there is also an implicit joystick connected at the same time as the device selected here.
NB. For Apple II/II+ models, when a joystick is selected (from the <a href="cfg-input.html">Input</a> tab), then there is also an implicit joystick connected at the same time as the device selected here (and some dongles even allowed 16-pin game connectors to be plugged in on top, eg. SDS and Robocom devices).
</p>

</body></html>
2 changes: 1 addition & 1 deletion source/Configuration/PageAdvanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const TCHAR CPageAdvanced::m_gameIOConnectorChoices[] =
"Robocom Ltd - Robo 500\0" /* Interface Module for Robocom Ltd's Robo 500 */
"Robocom Ltd - Robo 1000\0" /* Interface Module for Robocom Ltd's Robo 1000 */
"Robocom Ltd - Robo 1500, CAD-2P\0" /* Interface Module for Robocom Ltd's Robo 1500, Robo Systems CAD-2P */
"Hayden - Applesoft Compiler\0"; /* Protection key for Hayden's Applsoft Compiler (1981) */
"Hayden - Applesoft Compiler\0"; /* Protection key for Hayden Book Company, Inc's Applesoft Compiler (1981) */


INT_PTR CALLBACK CPageAdvanced::DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
Expand Down
2 changes: 1 addition & 1 deletion source/CopyProtectionDongles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
- Southwestern Data Systems' datakey for SpeedStar Applesoft Compiler (Matthew D'Asaro Dec 2022)
- Dynatech Microsoftware / Cortechs Corp's protection key for "CodeWriter"
- Robocom Ltd's Interface Module for Robo Graphics 500/1000/1500 & RoboCAD 1/2 (BitStik joystick plugs in on top)
- Hayden's protection key for "Applesoft Compiler"
- Hayden Book Company, Inc's protection key for "Applesoft Compiler"
*/
#include "StdAfx.h"
#include <sstream>
Expand Down
4 changes: 2 additions & 2 deletions source/Debugger/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4493,7 +4493,7 @@ Update_t CmdMemoryLoad (int nArgs)
}
const std::string sLoadSaveFilePath = g_sCurrentDir + g_sMemoryLoadSaveFileName; // TODO: g_sDebugDir

BYTE * const pMemBankBase = bBankSpecified ? MemGetBankPtr(nBank, true) : mem;
BYTE * const pMemBankBase = bBankSpecified ? MemGetBankPtr(nBank) : mem;
if (!pMemBankBase)
{
ConsoleBufferPush( TEXT( "Error: Bank out of range." ) );
Expand Down Expand Up @@ -4832,7 +4832,7 @@ Update_t CmdMemorySave (int nArgs)
}
sLoadSaveFilePath += g_sMemoryLoadSaveFileName;

const BYTE * const pMemBankBase = bBankSpecified ? MemGetBankPtr(nBank, true) : mem;
const BYTE * const pMemBankBase = bBankSpecified ? MemGetBankPtr(nBank) : mem;
if (!pMemBankBase)
{
ConsoleBufferPush( TEXT( "Error: Bank out of range." ) );
Expand Down
39 changes: 21 additions & 18 deletions source/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,8 +1274,11 @@ static void UpdatePaging(BOOL initialize)
// PAGING SHADOW TABLE
//
// NB. the condition 'loop <= 1' is there because:
// . Page0 (ZP) : memdirty[0] is set when the 6502 CPU does a ZP-write, but perhaps older versions didn't set this flag (eg. the asm version?).
// . Page1 (stack) : memdirty[1] is NOT set when the 6502 CPU writes to this page with JSR, etc.
// . Page0 (ZP) and Page1 (stack) are written to so often that it's almost certain that they'll be dirty every time this function is called.
// Note also that:
// . Page0 (ZP) : memdirty[0] is set when the 6502 CPU writes to ZP.
// . Page1 (stack) : memdirty[1] is NOT set when the 6502 CPU writes to this page with JSR, PHA, etc.
// Ultimately this is an optimisation (due to Page1 writes not setting memdirty[1]) and Page0 could be optimised to also not set memdirty[0].

for (loop = 0x00; loop < 0x100; loop++)
{
Expand Down Expand Up @@ -1352,19 +1355,6 @@ bool MemCheckINTCXROM()

//===========================================================================

static void BackMainImage(void)
{
for (UINT loop = 0; loop < 256; loop++)
{
if (memshadow[loop] && ((*(memdirty+loop) & 1) || (loop <= 1)))
memcpy(memshadow[loop], mem+(loop << 8), 256);

*(memdirty+loop) &= ~1;
}
}

//===========================================================================

static LPBYTE MemGetPtrBANK1(const WORD offset, const LPBYTE pMemBase)
{
if ((offset & 0xF000) != 0xC000) // Requesting RAM at physical addr $Cxxx (ie. 4K RAM BANK1)
Expand Down Expand Up @@ -1450,14 +1440,27 @@ LPBYTE MemGetMainPtr(const WORD offset)

//===========================================================================

static void BackMainImage(void)
{
for (UINT loop = 0; loop < 256; loop++)
{
if (memshadow[loop] && ((*(memdirty + loop) & 1) || (loop <= 1)))
memcpy(memshadow[loop], mem + (loop << 8), 256);

*(memdirty + loop) &= ~1;
}
}

//-------------------------------------

// Used by:
// . Savestate: MemSaveSnapshotMemory(), MemLoadSnapshotAux()
// . VidHD : SaveSnapshot(), LoadSnapshot()
// . Debugger : CmdMemorySave(), CmdMemoryLoad()
LPBYTE MemGetBankPtr(const UINT nBank, const bool isSaveSnapshotOrDebugging)
LPBYTE MemGetBankPtr(const UINT nBank, const bool isSaveSnapshotOrDebugging/*=true*/)
{
// Only call BackMainImage() when a consistent 64K bank is needed, eg. for saving snapshot or debugging
// - for snapshot loads it's pointless, and worse it can corrupt pages 0 & 1 for aux banks (GH#1262)
// - for snapshot *loads* it's redundant, and worse it can corrupt pages 0 & 1 for aux banks, so must be avoided (GH#1262)
if (isSaveSnapshotOrDebugging)
BackMainImage(); // Flush any dirty pages to back-buffer

Expand Down Expand Up @@ -2417,7 +2420,7 @@ static const std::string& MemGetSnapshotAuxMemStructName(void)

static void MemSaveSnapshotMemory(YamlSaveHelper& yamlSaveHelper, bool bIsMainMem, UINT bank=0, UINT size=64*1024)
{
LPBYTE pMemBase = MemGetBankPtr(bank, true);
LPBYTE pMemBase = MemGetBankPtr(bank);

if (bIsMainMem)
{
Expand Down
2 changes: 1 addition & 1 deletion source/Memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bool MemCheckSLOTC3ROM();
bool MemCheckINTCXROM();
LPBYTE MemGetAuxPtr(const WORD);
LPBYTE MemGetMainPtr(const WORD);
LPBYTE MemGetBankPtr(const UINT nBank, const bool isSaveSnapshotOrDebugging);
LPBYTE MemGetBankPtr(const UINT nBank, const bool isSaveSnapshotOrDebugging = true);
LPBYTE MemGetCxRomPeripheral();
DWORD GetMemMode(void);
void SetMemMode(DWORD memmode);
Expand Down
2 changes: 1 addition & 1 deletion source/VidHD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void VidHDCard::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
// Save [$400-$9FFF]
YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", MemGetSnapshotAuxMemStructName().c_str());

LPBYTE pMemBase = MemGetBankPtr(1, true);
LPBYTE pMemBase = MemGetBankPtr(1);
yamlSaveHelper.SaveMemory(pMemBase, (SHR_MEMORY_END + 1) - TEXT_PAGE1_BEGIN, TEXT_PAGE1_BEGIN);
}
}
Expand Down

0 comments on commit 265f75c

Please sign in to comment.