Apply fixes and enhancements to PR #285 (Support for TK3000 //e)

This commit is contained in:
tomcw 2016-10-22 23:20:23 +01:00
parent 58671545bb
commit 86ba0b0407
18 changed files with 282 additions and 163 deletions

View File

@ -267,6 +267,7 @@
<ClCompile Include="source\Debugger\Debugger_Symbols.cpp" />
<ClCompile Include="source\NTSC.cpp" />
<ClCompile Include="source\NTSC_CharSet.cpp" />
<ClCompile Include="source\SAM.cpp" />
<ClCompile Include="source\StdAfx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug NoDX|Win32'">Create</PrecompiledHeader>
@ -469,14 +470,6 @@
<ClInclude Include="resource\winres.h" />
</ItemGroup>
<ItemGroup>
<None Include="resource\ApplewinLogo.bmp" />
<None Include="RESOURCE\LED_CAPS_OFF.BMP" />
<None Include="RESOURCE\LED_CAPS_OFF_LAT.BMP" />
<None Include="RESOURCE\LED_CAPS_OFF_P8.BMP" />
<None Include="RESOURCE\LED_CAPS_ON.BMP" />
<None Include="RESOURCE\LED_CAPS_ON_LAT.BMP" />
<None Include="RESOURCE\LED_CAPS_ON_P8.BMP" />
<None Include="RESOURCE\Pravets8M.rom" />
<None Include="source\CPU\cpu_general.inl" />
<None Include="source\CPU\cpu_instructions.inl" />
<None Include="docs\CodingConventions.txt" />
@ -491,6 +484,7 @@
<None Include="resource\Apple2e.rom" />
<None Include="resource\Apple2e_Enhanced.rom" />
<None Include="resource\Applewin.bmp" />
<None Include="resource\ApplewinLogo.bmp" />
<None Include="RESOURCE\APPLEWIN.ICO" />
<None Include="RESOURCE\CAPSOFF.BMP" />
<None Include="resource\CAPSOFF_P8.BMP" />
@ -518,16 +512,26 @@
<None Include="RESOURCE\HELP.BMP" />
<None Include="resource\LATOFF.BMP" />
<None Include="resource\LATON.BMP" />
<None Include="RESOURCE\LED_CAPS_OFF.BMP" />
<None Include="RESOURCE\LED_CAPS_OFF_LAT.BMP" />
<None Include="RESOURCE\LED_CAPS_OFF_P8.BMP" />
<None Include="RESOURCE\LED_CAPS_ON.BMP" />
<None Include="RESOURCE\LED_CAPS_ON_LAT.BMP" />
<None Include="RESOURCE\LED_CAPS_ON_P8.BMP" />
<None Include="resource\Mockingboard-D.rom" />
<None Include="resource\MouseInterface.rom" />
<None Include="resource\Parallel.rom" />
<None Include="resource\PRAVETS82.ROM" />
<None Include="resource\Pravets8C.rom" />
<None Include="RESOURCE\Pravets8M.rom" />
<None Include="RESOURCE\RUN.BMP" />
<None Include="resource\RUN3000E.bmp" />
<None Include="resource\RUNP.BMP" />
<None Include="RESOURCE\SETUP.BMP" />
<None Include="resource\SSC.rom" />
<None Include="resource\ThunderClockPlus.rom" />
<None Include="resource\TK3000e.rom" />
<None Include="resource\TKClock.rom" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="RESOURCE\APPLEWIN.RC">

View File

@ -215,6 +215,9 @@
<ClCompile Include="source\NTSC.cpp">
<Filter>Source\Video</Filter>
</ClCompile>
<ClCompile Include="source\SAM.cpp">
<Filter>Source\Emulator</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="source\Applewin.h">
@ -501,6 +504,9 @@
<None Include="resource\Applewin.bmp">
<Filter>Resources</Filter>
</None>
<None Include="resource\ApplewinLogo.bmp">
<Filter>Resources</Filter>
</None>
<None Include="RESOURCE\APPLEWIN.ICO">
<Filter>Resources</Filter>
</None>
@ -582,6 +588,24 @@
<None Include="resource\LATON.BMP">
<Filter>Resources</Filter>
</None>
<None Include="RESOURCE\LED_CAPS_OFF.BMP">
<Filter>Resources</Filter>
</None>
<None Include="RESOURCE\LED_CAPS_ON.BMP">
<Filter>Resources</Filter>
</None>
<None Include="RESOURCE\LED_CAPS_OFF_P8.BMP">
<Filter>Resources</Filter>
</None>
<None Include="RESOURCE\LED_CAPS_ON_P8.BMP">
<Filter>Resources</Filter>
</None>
<None Include="RESOURCE\LED_CAPS_OFF_LAT.BMP">
<Filter>Resources</Filter>
</None>
<None Include="RESOURCE\LED_CAPS_ON_LAT.BMP">
<Filter>Resources</Filter>
</None>
<None Include="resource\Mockingboard-D.rom">
<Filter>Resources</Filter>
</None>
@ -597,9 +621,15 @@
<None Include="resource\Pravets8C.rom">
<Filter>Resources</Filter>
</None>
<None Include="RESOURCE\Pravets8M.rom">
<Filter>Resources</Filter>
</None>
<None Include="RESOURCE\RUN.BMP">
<Filter>Resources</Filter>
</None>
<None Include="resource\RUN3000E.bmp">
<Filter>Resources</Filter>
</None>
<None Include="resource\RUNP.BMP">
<Filter>Resources</Filter>
</None>
@ -612,16 +642,12 @@
<None Include="resource\ThunderClockPlus.rom">
<Filter>Resources</Filter>
</None>
<None Include="resource\ApplewinLogo.bmp">
<None Include="resource\TK3000e.rom">
<Filter>Resources</Filter>
</None>
<None Include="resource\TKClock.rom">
<Filter>Resources</Filter>
</None>
<None Include="RESOURCE\LED_CAPS_OFF.BMP" />
<None Include="RESOURCE\LED_CAPS_ON.BMP" />
<None Include="RESOURCE\LED_CAPS_OFF_P8.BMP" />
<None Include="RESOURCE\LED_CAPS_ON_P8.BMP" />
<None Include="RESOURCE\LED_CAPS_OFF_LAT.BMP" />
<None Include="RESOURCE\LED_CAPS_ON_LAT.BMP" />
<None Include="RESOURCE\Pravets8M.rom" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="RESOURCE\APPLEWIN.RC">

View File

@ -1242,6 +1242,10 @@
RelativePath="RESOURCE\RUN.BMP"
>
</File>
<File
RelativePath=".\resource\RUN3000E.BMP"
>
</File>
<File
RelativePath=".\resource\RUNP.BMP"
>
@ -1258,6 +1262,14 @@
RelativePath=".\resource\ThunderClockPlus.rom"
>
</File>
<File
RelativePath=".\resource\TK3000e.rom"
>
</File>
<File
RelativePath=".\resource\TKClock.rom"
>
</File>
<File
RelativePath=".\resource\winres.h"
>

View File

@ -53,6 +53,7 @@ END
FULLSCR_BUTTON BITMAP "FULLSCR.BMP"
RUN_BUTTON BITMAP "RUN.BMP"
RUNP_BUTTON BITMAP "RUNP.BMP"
RUN3000E_BUTTON BITMAP "RUN3000E.BMP"
DEBUG_BUTTON BITMAP "DEBUG.BMP"
DRIVE1_BUTTON BITMAP "DRIVE1.BMP"
DRIVE2_BUTTON BITMAP "DRIVE2.BMP"
@ -308,6 +309,7 @@ IDR_PRINTDRVR_FW FIRMWARE "Parallel.rom"
IDR_MOCKINGBOARD_D_FW FIRMWARE "Mockingboard-D.rom"
IDR_MOUSEINTERFACE_FW FIRMWARE "MouseInterface.rom"
IDR_THUNDERCLOCKPLUS_FW FIRMWARE "ThunderClockPlus.rom"
IDR_TKCLOCK_FW FIRMWARE "TKClock.rom"
/////////////////////////////////////////////////////////////////////////////
//
@ -321,6 +323,7 @@ IDR_APPLE2E_ENHANCED_ROM ROM "Apple2e_Enhanced.rom"
IDR_PRAVETS_82_ROM ROM "Pravets82.rom"
IDR_PRAVETS_8M_ROM ROM "Pravets8M.rom"
IDR_PRAVETS_8C_ROM ROM "Pravets8C.rom"
IDR_TK3000_2E_ROM ROM "TK3000e.rom"
IDR_FREEZES_F8_ROM ROM "FREEZES_NON-AUTOSTART_F8_ROM.rom"
/////////////////////////////////////////////////////////////////////////////

BIN
resource/RUN3000E.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
resource/TK3000e.rom Normal file

Binary file not shown.

BIN
resource/TKClock.rom Normal file

Binary file not shown.

View File

@ -46,6 +46,8 @@
#define IDR_MENU_DISK_POPUP 143
#define IDD_ABOUT 145
#define IDC_CHECK_CONFIRM_REBOOT 146
#define IDR_TK3000_2E_ROM 147
#define IDR_TKCLOCK_FW 148
#define IDC_KEYB_BUFFER_ENABLE 1005
#define IDC_SAVESTATE 1006
#define IDC_SAVESTATE_ON_EXIT 1007
@ -124,7 +126,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 147
#define _APS_NEXT_RESOURCE_VALUE 149
#define _APS_NEXT_COMMAND_VALUE 40012
#define _APS_NEXT_CONTROL_VALUE 1082
#define _APS_NEXT_SYMED_VALUE 101

View File

@ -441,6 +441,7 @@ void SetCharsetType(void)
case A2TYPE_APPLE2PLUS: g_nCharsetType = 0; break;
case A2TYPE_APPLE2E: g_nCharsetType = 0; break;
case A2TYPE_APPLE2EENHANCED:g_nCharsetType = 0; break;
case A2TYPE_TK30002E: g_nCharsetType = 0; break;
case A2TYPE_PRAVETS82: g_nCharsetType = 1; break;
case A2TYPE_PRAVETS8M: g_nCharsetType = 2; break; //This charset has a very small difference with the PRAVETS82 one, and probably has some misplaced characters.
case A2TYPE_PRAVETS8A: g_nCharsetType = 3; break;

View File

@ -171,7 +171,7 @@ void SetMainCpu(eCpuType cpu)
static bool IsCpu65C02(eApple2Type apple2Type)
{
// NB. All Pravets clones are 6502 (GH#307)
return (apple2Type == A2TYPE_APPLE2EENHANCED) || (apple2Type & A2TYPE_APPLE2C);
return (apple2Type == A2TYPE_APPLE2EENHANCED) || (apple2Type == A2TYPE_TK30002E) || (apple2Type & A2TYPE_APPLE2C);
}
eCpuType ProbeMainCpuDefault(eApple2Type apple2Type)

View File

@ -36,7 +36,7 @@ void CpuWrite(USHORT addr, BYTE a, ULONG uExecutedCycles);
DWORD CpuGetEmulationTime_ms(void);
enum eCpuType {CPU_6502=1, CPU_65C02, CPU_Z80}; // Don't change! Persisted to Registry
enum eCpuType {CPU_UNKNOWN=0, CPU_6502=1, CPU_65C02, CPU_Z80}; // Don't change! Persisted to Registry
eCpuType GetMainCpu(void);
void SetMainCpu(eCpuType cpu);

View File

@ -63,6 +63,7 @@ enum AppMode_e
#define TITLE_PRAVETS_82 TEXT("Pravets 82 Emulator")
#define TITLE_PRAVETS_8M TEXT("Pravets 8M Emulator")
#define TITLE_PRAVETS_8A TEXT("Pravets 8A Emulator")
#define TITLE_TK3000_2E TEXT("TK3000 //e Emulator")
#define TITLE_PAUSED TEXT("* PAUSED *")
#define TITLE_STEPPING TEXT("Stepping")
@ -184,6 +185,7 @@ enum eApple2Type {
A2TYPE_BAD_PRAVETS82=A2TYPE_PRAVETS|APPLE2E_MASK, // Wrongly tagged as Apple //e clone (< AppleWin 1.26)
A2TYPE_BAD_PRAVETS8M, // Wrongly tagged as Apple //e clone (< AppleWin 1.26)
A2TYPE_PRAVETS8A, // Apple //e clone
A2TYPE_TK30002E, // Apple //e enhanced clone
A2TYPE_MAX
};

View File

@ -33,12 +33,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
CPageAdvanced* CPageAdvanced::ms_this = 0; // reinit'd in ctor
enum CLONECHOICE {MENUITEM_CLONEMIN, MENUITEM_PRAVETS82=MENUITEM_CLONEMIN, MENUITEM_PRAVETS8M, MENUITEM_PRAVETS8A, MENUITEM_CLONEMAX};
enum CLONECHOICE {MENUITEM_CLONEMIN, MENUITEM_PRAVETS82=MENUITEM_CLONEMIN, MENUITEM_PRAVETS8M, MENUITEM_PRAVETS8A, MENUITEM_TK30002E, MENUITEM_CLONEMAX};
const TCHAR CPageAdvanced::m_CloneChoices[] =
TEXT("Pravets 82\0") // Bulgarian
TEXT("Pravets 8M\0") // Bulgarian
TEXT("Pravets 8A\0"); // Bulgarian
TEXT("Pravets 8A\0") // Bulgarian
TEXT("TK3000 //e"); // Brazilian
BOOL CALLBACK CPageAdvanced::DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
{
@ -117,6 +117,7 @@ BOOL CPageAdvanced::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPAR
const DWORD NewCloneMenuItem = (DWORD) SendDlgItemMessage(hWnd, IDC_CLONETYPE, CB_GETCURSEL, 0, 0);
const eApple2Type NewCloneType = GetCloneType(NewCloneMenuItem);
m_PropertySheetHelper.GetConfigNew().m_Apple2Type = NewCloneType;
m_PropertySheetHelper.GetConfigNew().m_CpuType = ProbeMainCpuDefault(NewCloneType);
}
break;
}
@ -221,6 +222,7 @@ eApple2Type CPageAdvanced::GetCloneType(DWORD NewMenuItem)
case MENUITEM_PRAVETS82: return A2TYPE_PRAVETS82;
case MENUITEM_PRAVETS8M: return A2TYPE_PRAVETS8M;
case MENUITEM_PRAVETS8A: return A2TYPE_PRAVETS8A;
case MENUITEM_TK30002E: return A2TYPE_TK30002E;
default: return A2TYPE_PRAVETS82;
}
}

View File

@ -131,8 +131,17 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM
const DWORD NewComputerMenuItem = (DWORD) SendDlgItemMessage(hWnd, IDC_COMPUTER, CB_GETCURSEL, 0, 0);
const eApple2Type NewApple2Type = GetApple2Type(NewComputerMenuItem);
m_PropertySheetHelper.GetConfigNew().m_Apple2Type = NewApple2Type;
if (NewApple2Type != A2TYPE_CLONE)
{
m_PropertySheetHelper.GetConfigNew().m_CpuType = ProbeMainCpuDefault(NewApple2Type);
}
else // A2TYPE_CLONE
{
// NB. A2TYPE_CLONE could be either 6502(Pravets) or 65C02(TK3000 //e)
// - Set correctly in PageAdvanced.cpp for IDC_CLONETYPE
m_PropertySheetHelper.GetConfigNew().m_CpuType = CPU_UNKNOWN;
}
}
break;
#if 0
@ -170,6 +179,7 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM
case A2TYPE_PRAVETS82: nCurrentChoice = MENUITEM_CLONE; break;
case A2TYPE_PRAVETS8M: nCurrentChoice = MENUITEM_CLONE; break;
case A2TYPE_PRAVETS8A: nCurrentChoice = MENUITEM_CLONE; break;
case A2TYPE_TK30002E: nCurrentChoice = MENUITEM_CLONE; break;
}
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMPUTER, m_ComputerChoices, nCurrentChoice);

View File

@ -324,6 +324,18 @@ void CPropertySheetHelper::PostMsgAfterClose(HWND hWnd, PAGETYPE page)
UINT uAfterClose = 0;
if (m_ConfigNew.m_Apple2Type == A2TYPE_CLONE)
{
MessageBox(hWnd, "Error - Unable to change configuration\n\nReason: A specific clone wasn't selected from the Advanced tab", g_pAppTitle, MB_ICONSTOP | MB_SETFOREGROUND);
return;
}
_ASSERT(m_ConfigNew.m_CpuType != CPU_UNKNOWN); // NB. Could only ever be CPU_UNKNOWN for a clone (and only if a mistake was made when adding a new clone)
if (m_ConfigNew.m_CpuType == CPU_UNKNOWN)
{
m_ConfigNew.m_CpuType = ProbeMainCpuDefault(m_ConfigNew.m_Apple2Type);
}
if (IsConfigChanged())
{
if (!CheckChangesForRestart(hWnd))

View File

@ -211,6 +211,7 @@ static void GetAppleWindowTitle()
case A2TYPE_PRAVETS82: _tcscpy(g_pAppleWindowTitle, TITLE_PRAVETS_82 ); break;
case A2TYPE_PRAVETS8M: _tcscpy(g_pAppleWindowTitle, TITLE_PRAVETS_8M ); break;
case A2TYPE_PRAVETS8A: _tcscpy(g_pAppleWindowTitle, TITLE_PRAVETS_8A ); break;
case A2TYPE_TK30002E: _tcscpy(g_pAppleWindowTitle, TITLE_TK3000_2E ); break;
}
#if _DEBUG
@ -312,6 +313,9 @@ static void CreateGdiObjects(void)
case A2TYPE_PRAVETS8A:
buttonbitmap[BTN_RUN] = (HBITMAP)LOADBUTTONBITMAP(TEXT("RUNP_BUTTON"));
break;
case A2TYPE_TK30002E:
buttonbitmap[BTN_RUN] = (HBITMAP)LOADBUTTONBITMAP(TEXT("RUN3000E_BUTTON"));
break;
default:
buttonbitmap[BTN_RUN] = (HBITMAP)LOADBUTTONBITMAP(TEXT("RUN_BUTTON"));
break;

View File

@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Pravets.h"
#include "Tape.h"
#include "YamlHelper.h"
#include "Video.h" // Needed by TK3000 //e, to refresh the frame at each |Mode| change
static bool g_bKeybBufferEnable = false;
@ -48,6 +49,8 @@ bool g_bShiftKey = false;
bool g_bCtrlKey = false;
bool g_bAltKey = false;
static bool g_bTK3KModeKey = false; //TK3000 //e |Mode| key
static bool g_bCapsLock = true; //Caps lock key for Apple2 and Lat/Cyr lock for Pravets8
static bool g_bP8CapsLock = true; //Caps lock key of Pravets 8A/C
static int lastvirtkey = 0; // Current PC keycode
@ -173,7 +176,7 @@ void KeybQueueKeypress (int key, BOOL bASCII)
}
g_bFreshReset = false;
if (key > 0x7F)
if ((key > 0x7F) && !g_bTK3KModeKey) // When in TK3000 mode, we have special keys which need remapping
return;
if (!IS_APPLE2)
@ -279,6 +282,32 @@ void KeybQueueKeypress (int key, BOOL bASCII)
}
}
}
// Remap for the TK3000 //e, which had a special |Mode| key for displaying accented chars on screen
// Borrowed from Fábio Belavenuto's TK3000e emulator (Copyright (C) 2004) - http://code.google.com/p/tk3000e/
if (g_bTK3KModeKey) // We already switch this on only if the the TK3000 is currently being emulated
{
if ((key >= 0xC0) && (key <= 0xDA)) key += 0x20; // Convert uppercase to lowercase
switch (key)
{
case 0xE0: key = '_'; break; // à
case 0xE1: key = '@'; break; // á
case 0xE2: key = '\\'; break; // â
case 0xE3: key = '['; break; // ã
case 0xE7: key = ']'; break; // ç
case 0xE9: key = '`'; break; // é
case 0xEA: key = '&'; break; // ê
case 0xED: key = '{'; break; // í
case 0xF3: key = '~'; break; // ó
case 0xF4: key = '}'; break; // ô
case 0xF5: key = '#'; break; // õ
case 0xFA: key = '|'; break; // ú
}
if (key > 0x7F) return; // Get out
if ((key >= 'a') && (key <= 'z') && (g_bCapsLock))
keycode = key - ('a'-'A');
else
keycode = key;
}
}
else
{
@ -315,6 +344,16 @@ void KeybQueueKeypress (int key, BOOL bASCII)
return;
}
if (key == VK_SCROLL)
{ // For the TK3000 //e we use Scroll Lock to switch between Apple ][ and accented chars modes
if (g_Apple2Type == A2TYPE_TK30002E)
{
g_bTK3KModeKey = (GetKeyState(VK_SCROLL) & 1) ? true : false; // Sync with the Scroll Lock status
FrameRefreshStatus(DRAW_LEDS); // TODO: Implement |Mode| LED in the UI; make it appear only when in TK3000 mode
VideoRedrawScreen(); // TODO: Still need to implement page mode switching and 'whatnot'
}
}
if (!((key >= VK_LEFT) && (key <= VK_DELETE) && asciicode[IS_APPLE2 ? 0 : 1][key - VK_LEFT]))
return;

View File

@ -1176,6 +1176,7 @@ void MemInitializeROM(void)
case A2TYPE_PRAVETS82: hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_PRAVETS_82_ROM ), "ROM"); ROM_SIZE = Apple2RomSize ; break;
case A2TYPE_PRAVETS8M: hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_PRAVETS_8M_ROM ), "ROM"); ROM_SIZE = Apple2RomSize ; break;
case A2TYPE_PRAVETS8A: hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_PRAVETS_8C_ROM ), "ROM"); ROM_SIZE = Apple2eRomSize; break;
case A2TYPE_TK30002E: hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_TK3000_2E_ROM ), "ROM"); ROM_SIZE = Apple2eRomSize; break;
}
if(hResInfo == NULL)
@ -1190,6 +1191,7 @@ void MemInitializeROM(void)
case A2TYPE_PRAVETS82: _tcscpy(sRomFileName, TEXT("PRAVETS82.ROM" )); break;
case A2TYPE_PRAVETS8M: _tcscpy(sRomFileName, TEXT("PRAVETS8M.ROM" )); break;
case A2TYPE_PRAVETS8A: _tcscpy(sRomFileName, TEXT("PRAVETS8C.ROM" )); break;
case A2TYPE_TK30002E: _tcscpy(sRomFileName, TEXT("TK3000e.ROM" )); break;
default:
{
_tcscpy(sRomFileName, TEXT("Unknown type!"));