Merge from branch 'NTSC_PreMerge':

1.26.0.1
. NTSC video modes (TV Color, TV B&W, Monitor Color, Monitor B&W)
. Full Screen using native resolution (not 640x480)

NB. 6502 emulation is slower now, which means disk loading (ie. full-speed) is slower.
. EG. Aztec.dsk: from F2 boot to "Press any key". (Release build, 50% "TV Color", not run in VS, VAIO laptop)
  ~4 secs: AppleWin 1.25.0.3 (built with VS2005)
  ~7 secs: AppleWin 1.26.0.1 (built with VS2008 or VS015)
This commit is contained in:
tomcw 2016-09-04 21:14:26 +01:00
commit 5fdc879a05
44 changed files with 3610 additions and 2324 deletions

View File

@ -74,6 +74,8 @@
<ClInclude Include="source\Mockingboard.h" />
<ClInclude Include="source\MouseInterface.h" />
<ClInclude Include="source\NoSlotClock.h" />
<ClInclude Include="source\NTSC.h" />
<ClInclude Include="source\NTSC_CharSet.h" />
<ClInclude Include="source\ParallelPrinter.h" />
<ClInclude Include="source\Pravets.h" />
<ClInclude Include="source\Registry.h" />
@ -154,6 +156,8 @@
<ClCompile Include="source\Mockingboard.cpp" />
<ClCompile Include="source\MouseInterface.cpp" />
<ClCompile Include="source\NoSlotClock.cpp" />
<ClCompile Include="source\NTSC.cpp" />
<ClCompile Include="source\NTSC_CharSet.cpp" />
<ClCompile Include="source\ParallelPrinter.cpp" />
<ClCompile Include="source\Pravets.cpp" />
<ClCompile Include="source\Registry.cpp" />

View File

@ -169,6 +169,12 @@
<ClCompile Include="source\Debugger\Util_MemoryTextFile.cpp">
<Filter>Source Files\Debugger</Filter>
</ClCompile>
<ClCompile Include="source\NTSC.cpp">
<Filter>Source Files\Video</Filter>
</ClCompile>
<ClCompile Include="source\NTSC_CharSet.cpp">
<Filter>Source Files\Video</Filter>
</ClCompile>
<ClCompile Include="source\Pravets.cpp">
<Filter>Source Files\Model</Filter>
</ClCompile>
@ -423,6 +429,12 @@
<ClInclude Include="source\DiskDefs.h">
<Filter>Source Files\Disk</Filter>
</ClInclude>
<<<<<<< HEAD
=======
<ClInclude Include="source\NTSC.h">
<Filter>Source Files\Video</Filter>
</ClInclude>
>>>>>>> NTSC_PreMerge
<ClInclude Include="source\Pravets.h">
<Filter>Source Files\Model</Filter>
</ClInclude>
@ -438,6 +450,12 @@
<ClInclude Include="source\SaveState_Structs_v1.h">
<Filter>Source Files\_Headers</Filter>
</ClInclude>
<<<<<<< HEAD
=======
<ClInclude Include="source\NTSC_CharSet.h">
<Filter>Source Files\Video</Filter>
</ClInclude>
>>>>>>> NTSC_PreMerge
</ItemGroup>
<ItemGroup>
<Image Include="resource\Applewin.bmp">

View File

@ -74,6 +74,8 @@
<ClInclude Include="source\Mockingboard.h" />
<ClInclude Include="source\MouseInterface.h" />
<ClInclude Include="source\NoSlotClock.h" />
<ClInclude Include="source\NTSC.h" />
<ClInclude Include="source\NTSC_CharSet.h" />
<ClInclude Include="source\ParallelPrinter.h" />
<ClInclude Include="source\Pravets.h" />
<ClInclude Include="source\Registry.h" />
@ -154,6 +156,8 @@
<ClCompile Include="source\Mockingboard.cpp" />
<ClCompile Include="source\MouseInterface.cpp" />
<ClCompile Include="source\NoSlotClock.cpp" />
<ClCompile Include="source\NTSC.cpp" />
<ClCompile Include="source\NTSC_CharSet.cpp" />
<ClCompile Include="source\ParallelPrinter.cpp" />
<ClCompile Include="source\Pravets.cpp" />
<ClCompile Include="source\Registry.cpp" />

View File

@ -169,6 +169,12 @@
<ClCompile Include="source\Debugger\Util_MemoryTextFile.cpp">
<Filter>Source Files\Debugger</Filter>
</ClCompile>
<ClCompile Include="source\NTSC.cpp">
<Filter>Source Files\Video</Filter>
</ClCompile>
<ClCompile Include="source\NTSC_CharSet.cpp">
<Filter>Source Files\Video</Filter>
</ClCompile>
<ClCompile Include="source\Pravets.cpp">
<Filter>Source Files\Model</Filter>
</ClCompile>
@ -423,6 +429,12 @@
<ClInclude Include="source\DiskDefs.h">
<Filter>Source Files\Disk</Filter>
</ClInclude>
<<<<<<< HEAD
=======
<ClInclude Include="source\NTSC.h">
<Filter>Source Files\Video</Filter>
</ClInclude>
>>>>>>> NTSC_PreMerge
<ClInclude Include="source\Pravets.h">
<Filter>Source Files\Model</Filter>
</ClInclude>
@ -438,6 +450,12 @@
<ClInclude Include="source\SaveState_Structs_v1.h">
<Filter>Source Files\_Headers</Filter>
</ClInclude>
<<<<<<< HEAD
=======
<ClInclude Include="source\NTSC_CharSet.h">
<Filter>Source Files\Video</Filter>
</ClInclude>
>>>>>>> NTSC_PreMerge
</ItemGroup>
<ItemGroup>
<Image Include="resource\Applewin.bmp">

View File

@ -265,6 +265,7 @@
<ClCompile Include="source\Debugger\Debugger_Parser.cpp" />
<ClCompile Include="source\Debugger\Debugger_Range.cpp" />
<ClCompile Include="source\Debugger\Debugger_Symbols.cpp" />
<ClCompile Include="source\NTSC.cpp" />
<ClCompile Include="source\StdAfx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug NoDX|Win32'">Create</PrecompiledHeader>
@ -395,6 +396,7 @@
<ClInclude Include="source\Debugger\Debugger_Symbols.h" />
<ClInclude Include="source\Debugger\Debugger_Types.h" />
<ClInclude Include="source\Debugger\Util_MemoryTextFile.h" />
<ClInclude Include="source\NTSC.h" />
<ClInclude Include="source\Tfe\Bittypes.h" />
<ClInclude Include="source\Tfe\Bpf.h" />
<ClInclude Include="source\Tfe\Ip6_misc.h" />
@ -465,6 +467,14 @@
<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" />

View File

@ -212,6 +212,9 @@
<ClCompile Include="source\StdAfx.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="source\NTSC.cpp">
<Filter>Source\Video</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="source\Applewin.h">
@ -451,6 +454,9 @@
<ClInclude Include="source\StdAfx.h">
<Filter>Source</Filter>
</ClInclude>
<ClInclude Include="source\NTSC.h">
<Filter>Source\Video</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="source\CPU\cpu_general.inl">
@ -606,6 +612,16 @@
<None Include="resource\ThunderClockPlus.rom">
<Filter>Resources</Filter>
</None>
<None Include="resource\ApplewinLogo.bmp">
<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

@ -870,6 +870,22 @@
RelativePath=".\source\Frame.h"
>
</File>
<File
RelativePath=".\source\NTSC.cpp"
>
</File>
<File
RelativePath=".\source\NTSC.h"
>
</File>
<File
RelativePath=".\source\NTSC_CharSet.cpp"
>
</File>
<File
RelativePath=".\source\NTSC_CharSet.h"
>
</File>
<File
RelativePath=".\source\Video.cpp"
>
@ -1066,6 +1082,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\resource\ApplewinLogo.bmp"
>
</File>
<File
RelativePath="RESOURCE\CAPSOFF.BMP"
>
@ -1094,6 +1114,10 @@
RelativePath=".\resource\CHARSET8C.bmp"
>
</File>
<File
RelativePath=".\resource\CHARSET8M.BMP"
>
</File>
<File
RelativePath="RESOURCE\COLOR.BMP"
>

BIN
assets/ApplewinLogo.xcf Normal file

Binary file not shown.

View File

@ -1,4 +1,10 @@
/*
.1 Fixed: Implemented missing debugger "CD" command
2.9.0.0 Added: ntsc save [filename], ntsc load [filename], to save/load the NTSC palette.
Default filename is "AppleWinNTSC4096x4@32.data"
To load this file in GIMP: Open, Select File Type: "Raw image data", Raw image data (*.data), RGB Alpha, Width: 4096, Height: 4
to save this file in GIMP: Open, Export To, Select File Type (By Extension) Raw image data, RGB Type: Standard (R,G,B)
.12 Fixed: [PVS-Studio] Fixed false positive of buffer overflow with MIP_RANDOM
.11 Fixed: [PVS-Studio] Fixed missing call to sprintf() in ConfigSave_PrepareHeader()
.10 Fixed: [PVS-Studio] Fixed no-op in _6502_GetStackReturnAddress()
@ -337,7 +343,6 @@
2.6.0.8 Released with AppleWin 1.16.1
>>>>>>> .r619
2.6.0.6 Released with AppleWin 1.15
.6 Added new command '@' to display the search results
.5 Fixed display results of Searching to be colorized

View File

@ -69,11 +69,11 @@ LED_CAPSON_P8_BITMAP BITMAP "LED_CAPS_ON_P8.BMP"
LED_LATOFF_BITMAP BITMAP "LED_CAPS_OFF_LAT.BMP"
LED_LATON_BITMAP BITMAP "LED_CAPS_ON_LAT.BMP"
CHARSET82 BITMAP "CHARSET82.BMP"
CHARSET8M BITMAP "CHARSET8C.BMP"
CHARSET8M BITMAP "CHARSET8M.BMP"
CHARSET8C BITMAP "CHARSET8C.BMP"
HELP_BUTTON BITMAP "HELP.BMP"
DRIVESWAP_BUTTON BITMAP "DRIVESWAP.BMP"
IDB_APPLEWIN BITMAP "Applewin.bmp"
IDB_APPLEWIN BITMAP "ApplewinLogo.bmp"
IDB_DEBUG_FONT_7X8 BITMAP "Debug_Font.bmp"
/////////////////////////////////////////////////////////////////////////////
@ -250,8 +250,8 @@ DISK_ICON ICON "DISK.ICO"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,25,0,4
PRODUCTVERSION 1,25,0,4
FILEVERSION 1,26,0,1
PRODUCTVERSION 1,26,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -269,12 +269,12 @@ BEGIN
VALUE "Comments", "https://github.com/AppleWin"
VALUE "CompanyName", "AppleWin"
VALUE "FileDescription", "Apple //e Emulator for Windows"
VALUE "FileVersion", "1, 25, 0, 4"
VALUE "FileVersion", "1, 26, 0, 1"
VALUE "InternalName", "APPLEWIN"
VALUE "LegalCopyright", " 1994-2015 Michael O'Brien, Oliver Schmidt, Tom Charlesworth, Michael Pohoreski, Nick Westgate, Linards Ticmanis"
VALUE "OriginalFilename", "APPLEWIN.EXE"
VALUE "ProductName", "Apple //e Emulator"
VALUE "ProductVersion", "1, 25, 0, 4"
VALUE "ProductVersion", "1, 26, 0, 1"
END
END
BLOCK "VarFileInfo"

BIN
resource/ApplewinLogo.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -51,6 +51,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Speech.h"
#endif
#include "Video.h"
#include "NTSC.h"
#include "Configuration\About.h"
#include "Configuration\PropertySheet.h"
@ -78,6 +79,7 @@ TCHAR g_sDebugDir [MAX_PATH] = TEXT(""); // TODO: Not currently used
TCHAR g_sScreenShotDir[MAX_PATH] = TEXT(""); // TODO: Not currently used
TCHAR g_sCurrentDir[MAX_PATH] = TEXT(""); // Also Starting Dir. Debugger uses this when load/save
BOOL restart = 0;
bool g_bRestartFullScreen = false;
DWORD g_dwSpeed = SPEED_NORMAL; // Affected by Config dialog's speed slider bar
double g_fCurrentCLK6502 = CLK_6502; // Affected by Config dialog's speed slider bar
@ -191,6 +193,7 @@ void ContinueExecution(void)
? g_bScrollLock_FullSpeed
: (GetKeyState(VK_SCROLL) < 0);
const bool bWasFullSpeed = g_bFullSpeed;
g_bFullSpeed = ( (g_dwSpeed == SPEED_MAX) ||
bScrollLock_FullSpeed ||
(DiskIsSpinning() && enhancedisk && !Spkr_IsActive() && !MB_IsActive()) );
@ -212,6 +215,12 @@ void ContinueExecution(void)
}
else
{
if (bWasFullSpeed)
{
VideoRedrawScreenDuringFullSpeed(0, true); // Invalidate the copies of video memory
VideoRedrawScreenAfterFullSpeed(g_dwCyclesThisFrame);
}
// Don't call Spkr_Demute()
MB_Demute();
SysClk_StartTimerUsec(nExecutionPeriodUsec);
@ -241,7 +250,13 @@ void ContinueExecution(void)
if (g_dwCyclesThisFrame >= dwClksPerFrame)
{
g_dwCyclesThisFrame -= dwClksPerFrame;
VideoEndOfVideoFrame();
if (g_bFullSpeed)
{
VideoRedrawScreenDuringFullSpeed(g_dwCyclesThisFrame);
}
VideoRefreshScreen(0); // Just copy the output of our Apple framebuffer to the system Back Buffer
MB_EndOfVideoFrame();
}
@ -389,13 +404,13 @@ void SetCharsetType(void)
{
switch ( GetApple2Type() )
{
case A2TYPE_APPLE2: g_nCharsetType = 0; break;
case A2TYPE_APPLE2PLUS: g_nCharsetType = 0; break;
case A2TYPE_APPLE2E: g_nCharsetType = 0; break;
case A2TYPE_APPLE2EENHANCED:g_nCharsetType = 0; break;
case A2TYPE_PRAVETS82: g_nCharsetType = 1; break;
case A2TYPE_PRAVETS8A: g_nCharsetType = 2; break;
case A2TYPE_PRAVETS8M: g_nCharsetType = 3; break; //This charset has a very small difference with the PRAVETS82 one an probably has some misplaced characters. Still the Pravets82 charset is used, because setting charset to 3 results in some problems.
case A2TYPE_APPLE2: g_nCharsetType = 0; break;
case A2TYPE_APPLE2PLUS: g_nCharsetType = 0; break;
case A2TYPE_APPLE2E: g_nCharsetType = 0; break;
case A2TYPE_APPLE2EENHANCED: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;
default:
_ASSERT(0);
g_nCharsetType = 0;
@ -413,6 +428,10 @@ void LoadConfiguration(void)
if ((dwComputerType >= A2TYPE_MAX) || (dwComputerType >= A2TYPE_UNDEFINED && dwComputerType < A2TYPE_CLONE))
dwComputerType = A2TYPE_APPLE2EENHANCED;
// Remap the bad Pravets models (before AppleWin v1.26)
if (dwComputerType == A2TYPE_BAD_PRAVETS82) dwComputerType = A2TYPE_PRAVETS82;
if (dwComputerType == A2TYPE_BAD_PRAVETS8M) dwComputerType = A2TYPE_PRAVETS8M;
apple2Type = (eApple2Type) dwComputerType;
}
else // Support older AppleWin registry entries
@ -588,7 +607,7 @@ void LoadConfiguration(void)
//===========================================================================
void SetCurrentImageDir(const char* pszImageDir)
bool SetCurrentImageDir(const char* pszImageDir)
{
strcpy(g_sCurrentDir, pszImageDir);
@ -599,7 +618,10 @@ void SetCurrentImageDir(const char* pszImageDir)
g_sCurrentDir[ nLen + 1 ] = 0;
}
SetCurrentDirectory(g_sCurrentDir);
if( SetCurrentDirectory(g_sCurrentDir) )
return true;
return false;
}
//===========================================================================
@ -1003,9 +1025,6 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
DiskInitialize();
LogFileOutput("Init: DiskInitialize()\n");
CreateColorMixMap(); // For tv emulation mode
LogFileOutput("Init: CreateColorMixMap()\n");
int nError = 0; // TODO: Show error MsgBox if we get a DiskInsert error
if (szImageName_drive1)
{
@ -1136,6 +1155,12 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
EnterMessageLoop();
LogFileOutput("Main: LeaveMessageLoop()\n");
if (restart)
{
bSetFullScreen = g_bRestartFullScreen;
g_bRestartFullScreen = false;
}
MB_Reset();
LogFileOutput("Main: MB_Reset()\n");

View File

@ -4,7 +4,7 @@
#include "Common.h"
void SetCurrentCLK6502();
void SetCurrentImageDir(const char* pszImageDir);
bool SetCurrentImageDir(const char* pszImageDir);
void SetCharsetType(void);
extern const UINT16* GetAppleWinVersion(void);
@ -31,6 +31,7 @@ extern TCHAR g_sProgramDir[MAX_PATH];
extern TCHAR g_sCurrentDir[MAX_PATH];
extern BOOL restart;
extern bool g_bRestartFullScreen;
extern DWORD g_dwSpeed;
extern double g_fCurrentCLK6502;

View File

@ -96,6 +96,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Speech.h"
#endif
#include "Video.h"
#include "NTSC.h"
#include "z80emu.h"
#include "Z80VICE\z80.h"
@ -104,25 +105,27 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Debugger\Debug.h"
#include "YamlHelper.h"
#define AF_SIGN 0x80
#define AF_OVERFLOW 0x40
#define AF_RESERVED 0x20
#define AF_BREAK 0x10
#define AF_DECIMAL 0x08
#define AF_INTERRUPT 0x04
#define AF_ZERO 0x02
#define AF_CARRY 0x01
// 6502 Accumulator Bit Flags
#define AF_SIGN 0x80
#define AF_OVERFLOW 0x40
#define AF_RESERVED 0x20
#define AF_BREAK 0x10
#define AF_DECIMAL 0x08
#define AF_INTERRUPT 0x04
#define AF_ZERO 0x02
#define AF_CARRY 0x01
#define SHORTOPCODES 22
#define BENCHOPCODES 33
// What is this 6502 code?
static BYTE benchopcode[BENCHOPCODES] = {0x06,0x16,0x24,0x45,0x48,0x65,0x68,0x76,
0x84,0x85,0x86,0x91,0x94,0xA4,0xA5,0xA6,
0xB1,0xB4,0xC0,0xC4,0xC5,0xE6,
0x19,0x6D,0x8D,0x99,0x9D,0xAD,0xB9,0xBD,
0xDD,0xED,0xEE};
// What is this 6502 code? Compressed 6502 code -- see: CpuSetupBenchmark()
static BYTE benchopcode[BENCHOPCODES] = {
0x06,0x16,0x24,0x45,0x48,0x65,0x68,0x76,
0x84,0x85,0x86,0x91,0x94,0xA4,0xA5,0xA6,
0xB1,0xB4,0xC0,0xC4,0xC5,0xE6,
0x19,0x6D,0x8D,0x99,0x9D,0xAD,0xB9,0xBD,
0xDD,0xED,0xEE
};
regsrec regs;
unsigned __int64 g_nCumulativeCycles = 0;

View File

@ -43,6 +43,10 @@ static DWORD Cpu6502 (DWORD uTotalCycles)
UINT uExtraCycles = 0;
BYTE iOpcode;
// NTSC_BEGIN
ULONG uPreviousCycles = uExecutedCycles;
// NTSC_END
if (GetActiveCpu() == CPU_Z80)
{
const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles)
@ -315,6 +319,14 @@ static DWORD Cpu6502 (DWORD uTotalCycles)
#undef $
}
// NTSC_BEGIN
if (!g_bFullSpeed)
{
ULONG uElapsedCycles = uExecutedCycles - uPreviousCycles;
NTSC_VideoUpdateCycles( uElapsedCycles );
}
// NTSC_END
CheckInterruptSources(uExecutedCycles);
NMI(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz);
IRQ(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz);

View File

@ -46,6 +46,10 @@ static DWORD Cpu65C02 (DWORD uTotalCycles)
UINT uExtraCycles = 0;
BYTE iOpcode;
// NTSC_BEGIN
ULONG uPreviousCycles = uExecutedCycles;
// NTSC_END
if (GetActiveCpu() == CPU_Z80)
{
const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles)
@ -318,6 +322,14 @@ static DWORD Cpu65C02 (DWORD uTotalCycles)
#undef $
}
// NTSC_BEGIN
if (!g_bFullSpeed)
{
ULONG uElapsedCycles = uExecutedCycles - uPreviousCycles;
NTSC_VideoUpdateCycles( uElapsedCycles );
}
// NTSC_END
CheckInterruptSources(uExecutedCycles);
NMI(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz);
IRQ(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz);

View File

@ -120,6 +120,10 @@ static DWORD Cpu65D02 (DWORD uTotalCycles)
UINT uExtraCycles = 0;
BYTE iOpcode;
// NTSC_BEGIN
ULONG uPreviousCycles = uExecutedCycles;
// NTSC_END
if (GetActiveCpu() == CPU_Z80)
{
const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles)
@ -403,6 +407,14 @@ static DWORD Cpu65D02 (DWORD uTotalCycles)
}
#undef $
// NTSC_BEGIN
if (!g_bFullSpeed)
{
ULONG uElapsedCycles = uExecutedCycles - uPreviousCycles;
NTSC_VideoUpdateCycles( uElapsedCycles );
}
// NTSC_END
CheckInterruptSources(uExecutedCycles);
NMI(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz);
IRQ(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz);

View File

@ -8,6 +8,7 @@ const double CLK_6502 = ((_M14 * 65.0) / 912.0); // 65 cycles per 912 14M clocks
// See: http://www.apple2info.net/hardware/softcard/SC-SWHW_a2in.pdf
const double CLK_Z80 = (CLK_6502 * 2);
// TODO: Clean up from Common.h, Video.cpp, and NTSC.h !!!
const UINT uCyclesPerLine = 65; // 25 cycles of HBL & 40 cycles of HBL'
const UINT uVisibleLinesPerFrame = 64*3; // 192
const UINT uLinesPerFrame = 262; // 64 in each third of the screen & 70 in VBL
@ -177,10 +178,12 @@ enum eApple2Type {
//
// Clones start here:
A2TYPE_CLONE=APPLECLONE_MASK,
A2TYPE_PRAVETS=APPLECLONE_MASK|APPLE2E_MASK,
A2TYPE_PRAVETS82=A2TYPE_PRAVETS,
A2TYPE_PRAVETS8M,
A2TYPE_PRAVETS8A,
A2TYPE_PRAVETS=APPLECLONE_MASK,
A2TYPE_PRAVETS82=A2TYPE_PRAVETS, // Apple ][ clone
A2TYPE_PRAVETS8M, // Apple ][ clone
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_MAX
};

View File

@ -114,7 +114,7 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM
break;
case IDC_MONOCOLOR:
VideoChooseColor();
VideoChooseMonochromeColor();
break;
case IDC_CHECK_CONFIRM_REBOOT:

View File

@ -40,6 +40,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "..\Frame.h"
#include "..\Keyboard.h"
#include "..\Memory.h"
#include "..\NTSC.h"
#include "..\Video.h"
// #define DEBUG_COMMAND_HELP 1
@ -47,7 +48,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define ALLOW_INPUT_LOWERCASE 1
// See /docs/Debugger_Changelog.txt for full details
const int DEBUGGER_VERSION = MAKE_VERSION(2,8,0,12);
const int DEBUGGER_VERSION = MAKE_VERSION(2,9,0,1);
// Public _________________________________________________________________________________________
@ -310,7 +311,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
bool g_bTraceHeader = false; // semaphore, flag header to be printed
DWORD extbench = 0;
bool g_bDebuggerViewingAppleOutput = false;
int g_bDebuggerViewingAppleOutput = false; // NOTE: alias for bVideoModeFlags!
bool g_bIgnoreNextKey = false;
@ -379,6 +380,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
WORD DisasmCalcAddressFromLines( WORD iAddress, int nLines );
// File _______________________________________________________________________
int _GetFileSize( FILE *hFile )
{
fseek( hFile, 0, SEEK_END );
int nFileBytes = ftell( hFile );
fseek( hFile, 0, SEEK_SET );
return nFileBytes;
}
// Bookmarks __________________________________________________________________
@ -3999,6 +4013,7 @@ Update_t CmdMemoryFill (int nArgs)
static TCHAR g_sMemoryLoadSaveFileName[ MAX_PATH ] = TEXT("");
// "PWD"
//===========================================================================
Update_t CmdConfigGetDebugDir (int nArgs)
{
@ -4009,9 +4024,30 @@ Update_t CmdConfigGetDebugDir (int nArgs)
return ConsoleUpdate();
}
// "CD"
//===========================================================================
Update_t CmdConfigSetDebugDir (int nArgs)
{
//if( nArgs > 2 )
// return;
// PWD directory
#if _WIN32
// http://msdn.microsoft.com/en-us/library/aa365530(VS.85).aspx
TCHAR sPath[ MAX_PATH + 1 ];
_tcscpy( sPath, g_sCurrentDir ); // TODO: debugger dir has no ` CONSOLE_COLOR_ESCAPE_CHAR ?!?!
_tcscat( sPath, g_aArgs[ 1 ].sArg );
if( SetCurrentImageDir( sPath ) )
nArgs = 0; // intentional fall into
#else
#error "Need chdir() implemented"
#endif
// PWD
if( nArgs == 0 )
return CmdConfigGetDebugDir(0);
return ConsoleUpdate();
}
@ -4095,9 +4131,7 @@ Update_t CmdMemoryLoad (int nArgs)
FILE *hFile = fopen( sLoadSaveFilePath, "rb" );
if (hFile)
{
fseek( hFile, 0, SEEK_END );
int nFileBytes = ftell( hFile );
fseek( hFile, 0, SEEK_SET );
int nFileBytes = _GetFileSize( hFile );
if (nFileBytes > _6502_MEM_END)
nFileBytes = _6502_MEM_END + 1; // Bank-switched RAMR/ROM is only 16-bit
@ -4217,12 +4251,12 @@ Update_t CmdMemoryLoad (int nArgs)
,{ ".hgr2", 0x4000, 0x2000 }
// TODO: extension ".dhgr", ".dhgr2"
};
const int nFileTypes = sizeof( aFileTypes ) / sizeof( KnownFileType_t );
const int nFileTypes = sizeof( aFileTypes ) / sizeof( KnownFileType_t );
const KnownFileType_t *pFileType = NULL;
char *pFileName = g_aArgs[ 1 ].sArg;
int nLen = strlen( pFileName );
char *pEnd = pFileName + + nLen - 1;
char *pEnd = pFileName + nLen - 1;
while( pEnd > pFileName )
{
if( *pEnd == '.' )
@ -4297,9 +4331,7 @@ Update_t CmdMemoryLoad (int nArgs)
FILE *hFile = fopen( sLoadSaveFilePath, "rb" );
if (hFile)
{
fseek( hFile, 0, SEEK_END );
int nFileBytes = ftell( hFile );
fseek( hFile, 0, SEEK_SET );
int nFileBytes = _GetFileSize( hFile );
if (nFileBytes > _6502_MEM_END)
nFileBytes = _6502_MEM_END + 1; // Bank-switched RAM/ROM is only 16-bit
@ -4401,7 +4433,6 @@ Update_t CmdMemoryMove (int nArgs)
return UPDATE_CONSOLE_DISPLAY;
}
//===========================================================================
#if 0 // Original
Update_t CmdMemorySave (int nArgs)
@ -4652,6 +4683,7 @@ Update_t CmdMemorySave (int nArgs)
{
ConsoleBufferPush( TEXT( "Warning: File already exists. Overwriting." ) );
fclose( hFile );
// TODO: BUG: Is this a bug/feature that we can over-write files and the user has no control over that?
}
hFile = fopen( sLoadSaveFilePath, "wb" );
@ -4842,6 +4874,359 @@ void Util_CopyTextToClipboard ( const size_t nSize, const char *pText )
// GlobalFree() ??
}
//===========================================================================
Update_t CmdNTSC (int nArgs)
{
int iParam;
int nFound = FindParam( g_aArgs[ 1 ].sArg, MATCH_EXACT, iParam, _PARAM_GENERAL_BEGIN, _PARAM_GENERAL_END );
struct KnownFileType_t
{
char *pExtension;
};
enum KnownFileType_e
{
TYPE_UNKNOWN
,TYPE_BMP
,TYPE_RAW
,NUM_FILE_TYPES
};
const KnownFileType_t aFileTypes[ NUM_FILE_TYPES ] =
{
{ "" } // n/a
,{ ".bmp" }
,{ ".data" }
// ,{ ".raw" }
// ,{ ".ntsc" }
};
const int nFileType = sizeof( aFileTypes ) / sizeof( KnownFileType_t );
const KnownFileType_t *pFileType = NULL;
/* */ KnownFileType_e iFileType = TYPE_UNKNOWN;
#if _DEBUG
assert( (nFileType == NUM_FILE_TYPES) );
#endif
char *pFileName = (nArgs > 1) ? g_aArgs[ 2 ].sArg : "";
int nLen = strlen( pFileName );
char *pEnd = pFileName + nLen - 1;
while( pEnd > pFileName )
{
if( *pEnd == '.' )
{
for( int i = TYPE_BMP; i < NUM_FILE_TYPES; i++ )
{
if( strcmp( pEnd, aFileTypes[i].pExtension ) == 0 )
{
pFileType = &aFileTypes[i];
iFileType = (KnownFileType_e) i;
break;
}
}
}
if( pFileType )
break;
pEnd--;
}
if( nLen == 0 )
pFileName = "AppleWinNTSC4096x4@32.data";
static TCHAR sPaletteFilePath[ MAX_PATH ];
_tcscpy( sPaletteFilePath, g_sCurrentDir );
_tcscat( sPaletteFilePath, pFileName );
class ConsoleFilename
{
public:
static void update( const char *pPrefixText )
{
TCHAR text[ CONSOLE_WIDTH ] = TEXT("");
sprintf( text, "%s: %s", pPrefixText, sPaletteFilePath );
ConsoleBufferPush( text ); // "Saved."
}
};
class Swizzle32
{
public:
static void RGBAswapBGRA( size_t nSize, const uint8_t *pSrc, uint8_t *pDst ) // Note: pSrc and pDst _may_ alias; code handles this properly
{
const uint8_t* pEnd = pSrc + nSize;
while ( pSrc < pEnd )
{
const uint8_t r = pSrc[2];
const uint8_t g = pSrc[1];
const uint8_t b = pSrc[0];
const uint8_t a = 255; // Force A=1, 100% opacity; as pSrc[3] might not be 255
*pDst++ = r;
*pDst++ = g;
*pDst++ = b;
*pDst++ = a;
pSrc += 4;
}
}
static void ABGRswizzleBGRA( size_t nSize, const uint8_t *pSrc, uint8_t *pDst ) // Note: pSrc and pDst _may_ alias; code handles this properly
{
const uint8_t* pEnd = pSrc + nSize;
while ( pSrc < pEnd )
{
const uint8_t r = pSrc[3];
const uint8_t g = pSrc[2];
const uint8_t b = pSrc[1];
const uint8_t a = 255; // Force A=1, 100% opacity; as pSrc[3] might not be 255
*pDst++ = b;
*pDst++ = g;
*pDst++ = r;
*pDst++ = a;
pSrc += 4;
}
}
#if 0
static void ABGRswizzleRGBA( size_t nSize, const uint8_t *pSrc, uint8_t *pDst ) // Note: pSrc and pDst _may_ alias; code handles this properly
{
const uint8_t* pEnd = pSrc + nSize;
while ( pSrc < pEnd )
{
const uint8_t r = pSrc[3];
const uint8_t g = pSrc[2];
const uint8_t b = pSrc[1];
const uint8_t a = 255; // Force A=1, 100% opacity; as pSrc[3] might not be 255
*pDst++ = r;
*pDst++ = g;
*pDst++ = b;
*pDst++ = a;
pSrc += 4;
}
}
#endif
};
class Transpose4096x4
{
/*
. Source layout = 4096x4 @ 32-bit
. +----+----+----+----+----+
. |BGRA|BGRA|BGRA|... |BGRA| phase 0
. +----+----+----+----+----+
. |BGRA|BGRA|BGRA|... |BGRA| phase 1
. +----+----+----+----+----|
. |BGRA|BGRA|BGRA|... |BGRA| phase 2
. +----+----+----+----+----+
. |BGRA|BGRA|BGRA|... |BGRA| phase 3
. +----+----+----+----+----+
. 0 1 2 4095 column
.
. Destination layout = 64x256 @ 32-bit
. | phase 0 | phase 1 | phase 2 | phase 3 |
. +----+----+----+----+----+----+----+----+
. |BGRA|BGRA|BGRA|BGRA|BGRA|BGRA|BGRA|BGRA| row 0
. +----+----+----+----+----+----+----+----+
. |BGRA|BGRA|BGRA|BGRA|BGRA|BGRA|BGRA|BGRA| row 1
. +----+----+----+----+----+----+----+----+
. |... |... |... |... |... |... |... |... |
. +----+----+----+----+----+----+----+----+
. |BGRA|BGRA|BGRA|BGRA|BGRA|BGRA|BGRA|BGRA| row 255
. +----+----+----+----+----+----+----+----+
. \ 16 px / \ 16 px / \ 16 px / \ 16 px / = 64 pixels
. 64 byte 64 byte 64 byte 64 byte
*/
public:
static void transposeTo64x256( size_t nSize, const uint8_t *pSrc, uint8_t *pDst )
{
/* */ uint8_t *pTmp = pDst;
const uint32_t nBPP = 4; // bytes per pixel
for( int iPhase = 0; iPhase < 4; iPhase++ )
{
pDst = pTmp + (iPhase * 16 * nBPP); // dst is 16-px column
for( int x = 0; x < 4096/16; x++ ) // 4096px/16 px = 256 columns
{
for( int i = 0; i < 16*nBPP; i++ ) // 16 px, 32-bit
*pDst++ = *pSrc++;
pDst -= (16*nBPP);
pDst += (64*nBPP); // move to next scan line
}
}
}
static void transposeFrom64x256( size_t nSize, const uint8_t *pSrc, uint8_t *pDst )
{
const uint8_t *pTmp = pSrc;
const uint32_t nBPP = 4; // bytes per pixel
for( int iPhase = 0; iPhase < 4; iPhase++ )
{
pSrc = pTmp + (iPhase * 16 * nBPP); // src is 16-px column
for( int y = 0; y < 256; y++ )
{
for( int i = 0; i < 16*nBPP; i++ ) // 16 px, 32-bit
*pDst++ = *pSrc++;
pSrc -= (16*nBPP);
pSrc += (64*nBPP); // move to next scan line
}
}
}
};
bool bColorTV = (g_eVideoType == VT_COLOR_TV);
uint32_t* pChromaTable = NTSC_VideoGetChromaTable( false, bColorTV );
char aStatusText[64] = "Loaded";
//uint8_t* pTmp = (uint8_t*) pChromaTable;
//*pTmp++ = 0xFF; // b
//*pTmp++ = 0x00; // g
//*pTmp++ = 0x00; // r
//*pTmp++ = 0xFF; // a
if (nFound)
{
if (iParam == PARAM_RESET)
{
NTSC_VideoInitChroma();
ConsoleBufferPush( TEXT(" Resetting NTSC palette." ) );
}
else
if (iParam == PARAM_SAVE)
{
FILE *pFile = fopen( sPaletteFilePath, "w+b" );
if( pFile )
{
size_t nWrote = 0;
uint8_t *pSwizzled = new uint8_t[ g_nChromaSize ];
if( iFileType == TYPE_BMP )
{
// need to save 32-bit bpp as 24-bit bpp
// VideoSaveScreenShot()
Transpose4096x4::transposeTo64x256( g_nChromaSize, (uint8_t*) pChromaTable, pSwizzled );
// Write BMP header
WinBmpHeader_t bmp, *pBmp = &bmp;
Video_SetBitmapHeader( pBmp, 64, 256, 32 );
fwrite( pBmp, sizeof( WinBmpHeader_t ), 1, pFile );
}
else
{
// RAW has no header
Swizzle32::RGBAswapBGRA( g_nChromaSize, (uint8_t*) pChromaTable, pSwizzled );
}
nWrote = fwrite( pSwizzled, g_nChromaSize, 1, pFile );
fclose( pFile );
delete [] pSwizzled;
if (nWrote == 1)
{
ConsoleFilename::update( "Saved" );
}
else
ConsoleBufferPush( TEXT( "Error saving." ) );
}
else
{
ConsoleFilename::update( "File" );
ConsoleBufferPush( TEXT( "Error couldn't open file for writing." ) );
}
}
else
if (iParam == PARAM_LOAD)
{
FILE *pFile = fopen( sPaletteFilePath, "rb" );
if( pFile )
{
strcpy( aStatusText, "Loaded" );
// Get File Size
size_t nFileSize = _GetFileSize( pFile );
uint8_t *pSwizzled = new uint8_t[ g_nChromaSize ];
bool bSwizzle = true;
if( iFileType == TYPE_BMP )
{
WinBmpHeader4_t bmp, *pBmp = &bmp;
fread( pBmp, sizeof( WinBmpHeader4_t ), 1, pFile );
fseek( pFile, pBmp->nOffsetData, SEEK_SET );
if( 0
|| (pBmp->nWidthPixels != 64 )
|| (pBmp->nHeightPixels != 256)
|| (pBmp->nBitsPerPixel != 32 )
|| (pBmp->nOffsetData > nFileSize)
)
{
strcpy( aStatusText, "Bitmap not 64x256@32" );
goto _error;
}
if(pBmp->nStructSize == 0x28)
{
if( pBmp->nCompression == 0) // BI_RGB mode
bSwizzle = false;
}
else // 0x7C version4 bitmap
{
if( pBmp->nCompression == 3 ) // BI_BITFIELDS
{
if((pBmp->nRedMask == 0xFF000000 ) // Gimp writes in ABGR order
&& (pBmp->nGreenMask == 0x00FF0000 )
&& (pBmp->nBlueMask == 0x0000FF00 ))
bSwizzle = true;
}
}
}
else
if( nFileSize != g_nChromaSize )
{
sprintf( aStatusText, "Raw size != %d", 64*256*4 );
goto _error;
}
size_t nRead = fread( pSwizzled, g_nChromaSize, 1, pFile );
if( iFileType == TYPE_BMP )
{
Transpose4096x4::transposeFrom64x256( g_nChromaSize, pSwizzled, (uint8_t*) pChromaTable );
if( bSwizzle )
Swizzle32::ABGRswizzleBGRA( g_nChromaSize, (uint8_t*) pChromaTable, (uint8_t*) pChromaTable );
}
else
Swizzle32::RGBAswapBGRA( g_nChromaSize, pSwizzled, (uint8_t*) pChromaTable );
_error:
fclose( pFile );
delete [] pSwizzled;
}
else
{
strcpy( aStatusText, "File: " );
ConsoleBufferPush( TEXT( "Error couldn't open file for reading." ) );
}
ConsoleFilename::update( aStatusText );
}
else
return HelpLastCommand();
}
// else
return ConsoleUpdate();
}
//===========================================================================
int CmdTextSave (int nArgs)
@ -6072,100 +6457,104 @@ enum ViewVideoPage_t
Update_t _ViewOutput( ViewVideoPage_t iPage, VideoUpdateFuncPtr_t pfUpdate );
Update_t _ViewOutput( ViewVideoPage_t iPage, VideoUpdateFuncPtr_t pfUpdate )
Update_t _ViewOutput( ViewVideoPage_t iPage, int bVideoModeFlags )
{
VideoSetForceFullRedraw();
_Video_Dirty();
switch( iPage )
{
case VIEW_PAGE_X: _Video_SetupBanks( VideoGetSWPAGE2() ); break; // Page Current
case VIEW_PAGE_1: _Video_SetupBanks( false ); break; // Page 1
case VIEW_PAGE_2: _Video_SetupBanks( true ); break; // Page 2 !
case VIEW_PAGE_X: bVideoModeFlags |= _Video_SetupBanks( VideoGetSWPAGE2() ); break; // Page Current
case VIEW_PAGE_1: bVideoModeFlags |= _Video_SetupBanks( false ); break; // Page 1
case VIEW_PAGE_2: bVideoModeFlags |= _Video_SetupBanks( true ); break; // Page 2 !
default:
break;
}
_Video_RedrawScreen( pfUpdate );
g_bDebuggerViewingAppleOutput = true;
#if _DEBUG
if (bVideoModeFlags == 0)
MessageBoxA( NULL, "bVideoModeFlags = ZERO !?", "Information", MB_OK );
#endif
g_bDebuggerViewingAppleOutput = bVideoModeFlags;
VideoRefreshScreen( bVideoModeFlags );
return UPDATE_NOTHING; // intentional
}
// Text 40
Update_t CmdViewOutput_Text4X (int nArgs)
{
return _ViewOutput( VIEW_PAGE_X, Update40ColCell );
return _ViewOutput( VIEW_PAGE_X, VF_TEXT );
}
Update_t CmdViewOutput_Text41 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_1, Update40ColCell );
return _ViewOutput( VIEW_PAGE_1, VF_TEXT );
}
Update_t CmdViewOutput_Text42 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_2, Update40ColCell );
return _ViewOutput( VIEW_PAGE_2, VF_TEXT );
}
// Text 80
Update_t CmdViewOutput_Text8X (int nArgs)
{
return _ViewOutput( VIEW_PAGE_X, Update80ColCell );
return _ViewOutput( VIEW_PAGE_X, VF_TEXT | VF_80COL );
}
Update_t CmdViewOutput_Text81 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_1, Update80ColCell );
return _ViewOutput( VIEW_PAGE_1, VF_TEXT | VF_80COL );
}
Update_t CmdViewOutput_Text82 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_2, Update80ColCell );
return _ViewOutput( VIEW_PAGE_2, VF_TEXT | VF_80COL );
}
// Lo-Res
Update_t CmdViewOutput_GRX (int nArgs)
{
return _ViewOutput( VIEW_PAGE_X, UpdateLoResCell );
return _ViewOutput( VIEW_PAGE_X, VF_80STORE ); // NTSC VideoRefresh() Hack: flags != 0
}
Update_t CmdViewOutput_GR1 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_1, UpdateLoResCell );
return _ViewOutput( VIEW_PAGE_1, VF_80STORE ); // NTSC VideoRefresh() Hack: flags != 0
}
Update_t CmdViewOutput_GR2 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_2, UpdateLoResCell );
return _ViewOutput( VIEW_PAGE_2, VF_80STORE ); // NTSC VideoRefresh() Hack: flags != 0
}
// Double Lo-Res
Update_t CmdViewOutput_DGRX (int nArgs)
{
return _ViewOutput( VIEW_PAGE_X, UpdateDLoResCell );
return _ViewOutput( VIEW_PAGE_X, VF_DHIRES | VF_80COL );
}
Update_t CmdViewOutput_DGR1 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_1, UpdateDLoResCell );
return _ViewOutput( VIEW_PAGE_1, VF_DHIRES | VF_80COL );
}
Update_t CmdViewOutput_DGR2 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_2, UpdateDLoResCell );
return _ViewOutput( VIEW_PAGE_2, VF_DHIRES | VF_80COL );
}
// Hi-Res
Update_t CmdViewOutput_HGRX (int nArgs)
{
return _ViewOutput( VIEW_PAGE_X, UpdateHiResCell );
return _ViewOutput( VIEW_PAGE_X, VF_HIRES );
}
Update_t CmdViewOutput_HGR1 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_1, UpdateHiResCell );
return _ViewOutput( VIEW_PAGE_1, VF_HIRES );
}
Update_t CmdViewOutput_HGR2 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_2, UpdateHiResCell );
return _ViewOutput( VIEW_PAGE_2, VF_HIRES );
}
// Double Hi-Res
Update_t CmdViewOutput_DHGRX (int nArgs)
{
return _ViewOutput( VIEW_PAGE_X, UpdateDHiResCell );
return _ViewOutput( VIEW_PAGE_X, VF_HIRES | VF_DHIRES | VF_80COL );
}
Update_t CmdViewOutput_DHGR1 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_1, UpdateDHiResCell );
return _ViewOutput( VIEW_PAGE_1, VF_HIRES | VF_DHIRES | VF_80COL);
}
Update_t CmdViewOutput_DHGR2 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_2, UpdateDHiResCell );
return _ViewOutput( VIEW_PAGE_2, VF_HIRES | VF_DHIRES | VF_80COL );
}
// Watches ________________________________________________________________________________________
@ -7327,6 +7716,9 @@ bool InternalSingleStep ()
//===========================================================================
#define TRACELINE_WITH_VIDEO_SCANNER_POS 0
void OutputTraceLine ()
{
DisasmLine_t line;
@ -7344,8 +7736,13 @@ void OutputTraceLine ()
g_bTraceHeader = false;
fprintf( g_hTraceFile,
#if TRACELINE_WITH_VIDEO_SCANNER_POS
// "0000 0000 00 00 00 0000 -------- 0000:90 90 90 NOP"
"Vert Horz A: X: Y: SP: Flags Addr:Opcode Mnemonic\n"
#else
// "00 00 00 0000 -------- 0000:90 90 90 NOP"
"A: X: Y: SP: Flags Addr:Opcode Mnemonic\n"
#endif
);
}
@ -7358,6 +7755,21 @@ void OutputTraceLine ()
);
}
#if TRACELINE_WITH_VIDEO_SCANNER_POS
fprintf( g_hTraceFile,
// "a=%02x x=%02x y=%02x sp=%03x ps=%s %s\n",
"%04X %04X %02X %02X %02X %04X %s %s\n",
g_nVideoClockVert,
g_nVideoClockHorz,
(unsigned)regs.a,
(unsigned)regs.x,
(unsigned)regs.y,
(unsigned)regs.sp,
(char*) sFlags
, sDisassembly
//, sTarget // TODO: Show target?
);
#else
fprintf( g_hTraceFile,
// "a=%02x x=%02x y=%02x sp=%03x ps=%s %s\n",
"%02X %02X %02X %04X %s %s\n",
@ -7369,6 +7781,7 @@ void OutputTraceLine ()
, sDisassembly
//, sTarget // TODO: Show target?
);
#endif
}
}
@ -7821,8 +8234,8 @@ void DebugContinueStepping ()
{
if (nStepsTaken == 0x10000) // HACK_MAGIC_NUM
VideoRedrawScreen();
else
VideoRefreshScreen();
// else
// VideoRefreshScreen();
}
}
else

View File

@ -105,7 +105,7 @@
extern int g_aDisasmTargets[ MAX_DISPLAY_LINES ];
// Display
extern bool g_bDebuggerViewingAppleOutput;
extern int g_bDebuggerViewingAppleOutput;
// Font
extern int g_nFontHeight;

View File

@ -470,6 +470,10 @@ int _6502_GetOpmodeOpbyte ( const int nBaseAddress, int & iOpmode_, int & nOpby
if (! g_aOpcodes)
{
MessageBox( g_hFrameWindow, "Debugger not properly initialized", "ERROR", MB_OK );
g_aOpcodes = & g_aOpcodes65C02[ 0 ]; // Enhanced Apple //e
g_aOpmodes[ AM_2 ].m_nBytes = 2;
g_aOpmodes[ AM_3 ].m_nBytes = 3;
}
#endif

View File

@ -42,7 +42,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
RGB(255,255, 0), RGB(223,223, 0), RGB(191,191, 0), RGB(159,159, 0), RGB(127,127, 0), RGB( 95, 95, 0), RGB( 63, 63, 0), RGB( 31, 31, 0), // 011 // Yellow
RGB( 0, 0,255), RGB( 0, 0,223), RGB( 0, 0,191), RGB( 0, 0,159), RGB( 0, 0,127), RGB( 0, 0, 95), RGB( 0, 0, 63), RGB( 0, 0, 31), // 100 // Blue
RGB(255, 0,255), RGB(223, 0,223), RGB(191, 0,191), RGB(159, 0,159), RGB(127, 0,127), RGB( 95, 0, 95), RGB( 63, 0, 63), RGB( 31, 0, 31), // 101 // Magenta
RGB( 0,255,255), RGB( 0,223,223), RGB( 0,191,191), RGB( 0,159,159), RGB( 0,127,127), RGB( 0, 95, 95), RGB( 0, 63, 63), RGB( 0, 31, 31), // 110 // Cyan
RGB( 0,255,255), RGB( 0,223,223), RGB( 0,191,191), RGB( 0,159,159), RGB( 0,127,127), RGB( 0, 95, 95), RGB( 0, 63, 63), RGB( 0, 31, 31), // 110 // Cyan
RGB(255,255,255), RGB(223,223,223), RGB(191,191,191), RGB(159,159,159), RGB(127,127,127), RGB( 95, 95, 95), RGB( 63, 63, 63), RGB( 31, 31, 31), // 111 // White/Gray
// Custom Colors

View File

@ -40,11 +40,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Command_t g_aCommands[] =
{
// Assembler
// {TEXT("!") , CmdAssemberMini , CMD_ASSEMBLER_MINI , "Mini assembler" },
{TEXT("A") , CmdAssemble , CMD_ASSEMBLE , "Assemble instructions" },
// CPU (Main)
{TEXT(".") , CmdCursorJumpPC , CMD_CURSOR_JUMP_PC , "Locate the cursor in the disasm window" }, // centered
{TEXT("=") , CmdCursorSetPC , CMD_CURSOR_SET_PC , "Sets the PC to the current instruction" },
{TEXT("G") , CmdGo , CMD_GO , "Run [until PC = address]" },
// {TEXT("g") , CmdGoNormalSpeed , CMD_GO_NORMAL , "Run @ normal speed [until PC == address]" },
// {TEXT("G") , CmdGoFullSpeed , CMD_GO_FULL , "Run @ full speed [until PC == address]" },
{TEXT("G") , CmdGo , CMD_GO , "Run @ full speed [until PC == address]" },
{TEXT("IN") , CmdIn , CMD_IN , "Input byte from IO $C0xx" },
{TEXT("KEY") , CmdKey , CMD_INPUT_KEY , "Feed key into emulator" },
{TEXT("JSR") , CmdJSR , CMD_JSR , "Call sub-routine" },
@ -201,6 +204,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
{TEXT("SH") , CmdMemorySearchHex , CMD_MEMORY_SEARCH_HEX , "Search memory for hex values" },
{TEXT("F") , CmdMemoryFill , CMD_MEMORY_FILL , "Memory fill" },
{TEXT("NTSC") , CmdNTSC , CMD_NTSC , "Save/Load the NTSC palette" },
{TEXT("TSAVE") , CmdTextSave , CMD_TEXT_SAVE , "Save text screen" },
// Output / Scripts
{TEXT("CALC") , CmdOutputCalc , CMD_OUTPUT_CALC , "Display mini calc result" },

View File

@ -562,13 +562,18 @@ void StretchBltMemToFrameDC(void)
int nViewportCX, nViewportCY;
GetViewportCXCY(nViewportCX, nViewportCY);
int xdest = GetFullScreenOffsetX();
int ydest = GetFullScreenOffsetY();
int wdest = nViewportCX;
int hdest = nViewportCY;
BOOL bRes = StretchBlt(
FrameGetDC(), // HDC hdcDest,
0, 0, // int nXOriginDest, int nYOriginDest,
nViewportCX, nViewportCY, // int nWidthDest, int nHeightDest,
xdest, ydest, // int nXOriginDest, int nYOriginDest,
wdest, hdest, // int nWidthDest, int nHeightDest,
GetDebuggerMemDC(), // HDC hdcSrc,
0, 0, // int nXOriginSrc, int nYOriginSrc,
FRAMEBUFFER_W, FRAMEBUFFER_H, // int nWidthSrc, int nHeightSrc,
FRAMEBUFFER_BORDERLESS_W, FRAMEBUFFER_BORDERLESS_H, // int nWidthSrc, int nHeightSrc,
SRCCOPY // DWORD dwRop
);
}

View File

@ -442,6 +442,7 @@
// , CMD_MEMORY_SEARCH_APPLE // Flashing Chars, Hi-Bit Set
, CMD_MEMORY_SEARCH_HEX
, CMD_MEMORY_FILL
, CMD_NTSC
, CMD_TEXT_SAVE
// Output
, CMD_OUTPUT_CALC
@ -555,7 +556,7 @@
};
// Assembler
Update_t CmdAssemble (int nArgs);
Update_t CmdAssemble (int nArgs);
// Disassembler Data
Update_t CmdDisasmDataDefCode (int nArgs);
@ -577,89 +578,89 @@
Update_t CmdDisasmDataDefAddress16(int nArgs);
// CPU
Update_t CmdCursorJumpPC(int nArgs);
Update_t CmdCursorSetPC (int nArgs);
Update_t CmdBreakInvalid(int nArgs); // Breakpoint IFF Full-speed!
Update_t CmdBreakOpcode (int nArgs); // Breakpoint IFF Full-speed!
Update_t CmdGo (int nArgs);
Update_t CmdIn (int nArgs);
Update_t CmdKey (int nArgs);
Update_t CmdJSR (int nArgs);
Update_t CmdNOP (int nArgs);
Update_t CmdOut (int nArgs);
Update_t CmdStepOver (int nArgs);
Update_t CmdStepOut (int nArgs);
Update_t CmdTrace (int nArgs); // alias for CmdStepIn
Update_t CmdTraceFile (int nArgs);
Update_t CmdTraceLine (int nArgs);
Update_t CmdUnassemble (int nArgs); // code dump, aka, Unassemble
Update_t CmdCursorJumpPC (int nArgs);
Update_t CmdCursorSetPC (int nArgs);
Update_t CmdBreakInvalid (int nArgs); // Breakpoint IFF Full-speed!
Update_t CmdBreakOpcode (int nArgs); // Breakpoint IFF Full-speed!
Update_t CmdGo (int nArgs);
Update_t CmdIn (int nArgs);
Update_t CmdKey (int nArgs);
Update_t CmdJSR (int nArgs);
Update_t CmdNOP (int nArgs);
Update_t CmdOut (int nArgs);
Update_t CmdStepOver (int nArgs);
Update_t CmdStepOut (int nArgs);
Update_t CmdTrace (int nArgs); // alias for CmdStepIn
Update_t CmdTraceFile (int nArgs);
Update_t CmdTraceLine (int nArgs);
Update_t CmdUnassemble (int nArgs); // code dump, aka, Unassemble
// Bookmarks
Update_t CmdBookmark (int nArgs);
Update_t CmdBookmarkAdd (int nArgs);
Update_t CmdBookmarkClear (int nArgs);
Update_t CmdBookmarkList (int nArgs);
Update_t CmdBookmarkGoto (int nArgs);
// Update_t CmdBookmarkLoad (int nArgs);
Update_t CmdBookmarkSave (int nArgs);
Update_t CmdBookmark (int nArgs);
Update_t CmdBookmarkAdd (int nArgs);
Update_t CmdBookmarkClear (int nArgs);
Update_t CmdBookmarkList (int nArgs);
Update_t CmdBookmarkGoto (int nArgs);
// Update_t CmdBookmarkLoad (int nArgs);
Update_t CmdBookmarkSave (int nArgs);
// Breakpoints
Update_t CmdBreakpoint (int nArgs);
Update_t CmdBreakpointAddSmart(int nArgs);
Update_t CmdBreakpointAddReg (int nArgs);
Update_t CmdBreakpointAddPC (int nArgs);
Update_t CmdBreakpointAddIO (int nArgs);
Update_t CmdBreakpointAddMem (int nArgs);
Update_t CmdBreakpointClear (int nArgs);
Update_t CmdBreakpointDisable (int nArgs);
Update_t CmdBreakpointEdit (int nArgs);
Update_t CmdBreakpointEnable (int nArgs);
Update_t CmdBreakpointList (int nArgs);
// Update_t CmdBreakpointLoad (int nArgs);
Update_t CmdBreakpointSave (int nArgs);
Update_t CmdBreakpoint (int nArgs);
Update_t CmdBreakpointAddSmart (int nArgs);
Update_t CmdBreakpointAddReg (int nArgs);
Update_t CmdBreakpointAddPC (int nArgs);
Update_t CmdBreakpointAddIO (int nArgs);
Update_t CmdBreakpointAddMem (int nArgs);
Update_t CmdBreakpointClear (int nArgs);
Update_t CmdBreakpointDisable (int nArgs);
Update_t CmdBreakpointEdit (int nArgs);
Update_t CmdBreakpointEnable (int nArgs);
Update_t CmdBreakpointList (int nArgs);
// Update_t CmdBreakpointLoad (int nArgs);
Update_t CmdBreakpointSave (int nArgs);
// Benchmark
Update_t CmdBenchmark (int nArgs);
Update_t CmdBenchmarkStart (int nArgs); //Update_t CmdSetupBenchmark (int nArgs);
Update_t CmdBenchmarkStop (int nArgs); //Update_t CmdExtBenchmark (int nArgs);
Update_t CmdProfile (int nArgs);
Update_t CmdProfileStart (int nArgs);
Update_t CmdProfileStop (int nArgs);
Update_t CmdBenchmark (int nArgs);
Update_t CmdBenchmarkStart (int nArgs); //Update_t CmdSetupBenchmark (int nArgs);
Update_t CmdBenchmarkStop (int nArgs); //Update_t CmdExtBenchmark (int nArgs);
Update_t CmdProfile (int nArgs);
Update_t CmdProfileStart (int nArgs);
Update_t CmdProfileStop (int nArgs);
// Config
// Update_t CmdConfigMenu (int nArgs);
// Update_t CmdConfigBase (int nArgs);
// Update_t CmdConfigBaseHex (int nArgs);
// Update_t CmdConfigBaseDec (int nArgs);
Update_t CmdConfigColorMono (int nArgs);
Update_t CmdConfigDisasm (int nArgs);
Update_t CmdConfigFont (int nArgs);
Update_t CmdConfigHColor (int nArgs);
Update_t CmdConfigLoad (int nArgs);
Update_t CmdConfigSave (int nArgs);
Update_t CmdConfigSetFont (int nArgs);
Update_t CmdConfigGetFont (int nArgs);
Update_t CmdConfigGetDebugDir (int nArgs);
Update_t CmdConfigSetDebugDir (int nArgs);
// Update_t CmdConfigMenu (int nArgs);
// Update_t CmdConfigBase (int nArgs);
// Update_t CmdConfigBaseHex (int nArgs);
// Update_t CmdConfigBaseDec (int nArgs);
Update_t CmdConfigColorMono (int nArgs);
Update_t CmdConfigDisasm (int nArgs);
Update_t CmdConfigFont (int nArgs);
Update_t CmdConfigHColor (int nArgs);
Update_t CmdConfigLoad (int nArgs);
Update_t CmdConfigSave (int nArgs);
Update_t CmdConfigSetFont (int nArgs);
Update_t CmdConfigGetFont (int nArgs);
Update_t CmdConfigGetDebugDir (int nArgs);
Update_t CmdConfigSetDebugDir (int nArgs);
// Cursor
Update_t CmdCursorFollowTarget(int nArgs);
Update_t CmdCursorLineDown (int nArgs);
Update_t CmdCursorLineUp (int nArgs);
Update_t CmdCursorJumpRetAddr (int nArgs);
Update_t CmdCursorRunUntil (int nArgs);
Update_t CmdCursorPageDown (int nArgs);
Update_t CmdCursorPageDown256 (int nArgs);
Update_t CmdCursorPageDown4K (int nArgs);
Update_t CmdCursorPageUp (int nArgs);
Update_t CmdCursorPageUp256 (int nArgs);
Update_t CmdCursorPageUp4K (int nArgs);
Update_t CmdCursorFollowTarget (int nArgs);
Update_t CmdCursorLineDown (int nArgs);
Update_t CmdCursorLineUp (int nArgs);
Update_t CmdCursorJumpRetAddr (int nArgs);
Update_t CmdCursorRunUntil (int nArgs);
Update_t CmdCursorPageDown (int nArgs);
Update_t CmdCursorPageDown256 (int nArgs);
Update_t CmdCursorPageDown4K (int nArgs);
Update_t CmdCursorPageUp (int nArgs);
Update_t CmdCursorPageUp256 (int nArgs);
Update_t CmdCursorPageUp4K (int nArgs);
// Disk
Update_t CmdDisk (int nArgs);
Update_t CmdDisk (int nArgs);
// Help
Update_t CmdHelpList (int nArgs);
Update_t CmdHelpSpecific (int Argss);
Update_t CmdVersion (int nArgs);
Update_t CmdMOTD (int nArgs);
Update_t CmdHelpList (int nArgs);
Update_t CmdHelpSpecific (int Argss);
Update_t CmdVersion (int nArgs);
Update_t CmdMOTD (int nArgs);
// Flags
Update_t CmdFlag (int nArgs);
Update_t CmdFlagClear (int nArgs);
Update_t CmdFlagSet (int nArgs);
Update_t CmdFlag (int nArgs);
Update_t CmdFlagClear (int nArgs);
Update_t CmdFlagSet (int nArgs);
// Memory (Data)
Update_t CmdMemoryCompare (int nArgs);
Update_t CmdMemoryMiniDumpHex (int nArgs);
@ -672,13 +673,14 @@
Update_t CmdMemoryEnterByte (int nArgs);
Update_t CmdMemoryEnterWord (int nArgs);
Update_t CmdMemoryFill (int nArgs);
Update_t CmdNTSC (int nArgs);
Update_t CmdTextSave (int nArgs);
Update_t CmdMemoryLoad (int nArgs);
Update_t CmdMemoryMove (int nArgs);
Update_t CmdMemorySave (int nArgs);
Update_t CmdMemorySearch (int nArgs);
Update_t _SearchMemoryDisplay (int nArgs=0);
Update_t _SearchMemoryDisplay (int nArgs=0); // TODO: CLEANUP
// Update_t CmdMemorySearchLowBit (int nArgs);
// Update_t CmdMemorySearchHiBit (int nArgs);
Update_t CmdMemorySearchAscii (int nArgs);
@ -691,101 +693,100 @@
Update_t CmdOutputPrintf (int nArgs);
Update_t CmdOutputRun (int nArgs);
// Registers
Update_t CmdRegisterSet (int nArgs);
Update_t CmdRegisterSet (int nArgs);
// Source Level Debugging
Update_t CmdSource (int nArgs);
Update_t CmdSync (int nArgs);
Update_t CmdSource (int nArgs);
Update_t CmdSync (int nArgs);
// Stack
Update_t CmdStackPush (int nArgs);
Update_t CmdStackPop (int nArgs);
Update_t CmdStackPopPseudo (int nArgs);
Update_t CmdStackReturn (int nArgs);
Update_t CmdStackPush (int nArgs);
Update_t CmdStackPop (int nArgs);
Update_t CmdStackPopPseudo (int nArgs);
Update_t CmdStackReturn (int nArgs);
// Symbols
Update_t CmdSymbols (int nArgs);
Update_t CmdSymbolsClear (int nArgs);
Update_t CmdSymbolsList (int nArgs);
Update_t CmdSymbolsLoad (int nArgs);
Update_t CmdSymbolsInfo (int nArgs);
Update_t CmdSymbolsSave (int nArgs);
Update_t CmdSymbols (int nArgs);
Update_t CmdSymbolsClear (int nArgs);
Update_t CmdSymbolsList (int nArgs);
Update_t CmdSymbolsLoad (int nArgs);
Update_t CmdSymbolsInfo (int nArgs);
Update_t CmdSymbolsSave (int nArgs);
Update_t CmdSymbolsCommand (int nArgs);
// Update_t CmdSymbolsMain (int nArgs);
// Update_t CmdSymbolsBasic (int nArgs);
// Update_t CmdSymbolsUser (int nArgs);
// Update_t CmdSymbolsAssembly (int nArgs);
// Update_t CmdSymbolsSource (int nArgs);
Update_t CmdSymbolsCommand (int nArgs);
// Update_t CmdSymbolsMain (int nArgs);
// Update_t CmdSymbolsBasic (int nArgs);
// Update_t CmdSymbolsUser (int nArgs);
// Update_t CmdSymbolsAssembly (int nArgs);
// Update_t CmdSymbolsSource (int nArgs);
// View
Update_t CmdViewOutput_Text4X (int nArgs);
Update_t CmdViewOutput_Text41 (int nArgs);
Update_t CmdViewOutput_Text42 (int nArgs);
Update_t CmdViewOutput_Text8X (int nArgs);
Update_t CmdViewOutput_Text81 (int nArgs);
Update_t CmdViewOutput_Text82 (int nArgs);
// View
Update_t CmdViewOutput_Text4X (int nArgs);
Update_t CmdViewOutput_Text41 (int nArgs);
Update_t CmdViewOutput_Text42 (int nArgs);
Update_t CmdViewOutput_Text8X (int nArgs);
Update_t CmdViewOutput_Text81 (int nArgs);
Update_t CmdViewOutput_Text82 (int nArgs);
Update_t CmdViewOutput_GRX (int nArgs);
Update_t CmdViewOutput_GR1 (int nArgs);
Update_t CmdViewOutput_GR2 (int nArgs);
Update_t CmdViewOutput_DGRX (int nArgs);
Update_t CmdViewOutput_DGR1 (int nArgs);
Update_t CmdViewOutput_DGR2 (int nArgs);
Update_t CmdViewOutput_GRX (int nArgs);
Update_t CmdViewOutput_GR1 (int nArgs);
Update_t CmdViewOutput_GR2 (int nArgs);
Update_t CmdViewOutput_DGRX (int nArgs);
Update_t CmdViewOutput_DGR1 (int nArgs);
Update_t CmdViewOutput_DGR2 (int nArgs);
Update_t CmdViewOutput_HGRX (int nArgs);
Update_t CmdViewOutput_HGR1 (int nArgs);
Update_t CmdViewOutput_HGR2 (int nArgs);
Update_t CmdViewOutput_DHGRX (int nArgs);
Update_t CmdViewOutput_DHGR1 (int nArgs);
Update_t CmdViewOutput_DHGR2 (int nArgs);
Update_t CmdViewOutput_HGRX (int nArgs);
Update_t CmdViewOutput_HGR1 (int nArgs);
Update_t CmdViewOutput_HGR2 (int nArgs);
Update_t CmdViewOutput_DHGRX (int nArgs);
Update_t CmdViewOutput_DHGR1 (int nArgs);
Update_t CmdViewOutput_DHGR2 (int nArgs);
// Watch
Update_t CmdWatch (int nArgs);
Update_t CmdWatchAdd (int nArgs);
Update_t CmdWatchClear (int nArgs);
Update_t CmdWatchDisable (int nArgs);
Update_t CmdWatchEnable (int nArgs);
Update_t CmdWatchList (int nArgs);
// Update_t CmdWatchLoad (int nArgs);
Update_t CmdWatchSave (int nArgs);
Update_t CmdWatch (int nArgs);
Update_t CmdWatchAdd (int nArgs);
Update_t CmdWatchClear (int nArgs);
Update_t CmdWatchDisable (int nArgs);
Update_t CmdWatchEnable (int nArgs);
Update_t CmdWatchList (int nArgs);
// Update_t CmdWatchLoad (int nArgs);
Update_t CmdWatchSave (int nArgs);
// Window
Update_t CmdWindow (int nArgs);
Update_t CmdWindowCycleNext (int nArgs);
Update_t CmdWindowCyclePrev (int nArgs);
Update_t CmdWindowLast (int nArgs);
Update_t CmdWindow (int nArgs);
Update_t CmdWindowCycleNext (int nArgs);
Update_t CmdWindowCyclePrev (int nArgs);
Update_t CmdWindowLast (int nArgs);
Update_t CmdWindowShowCode (int nArgs);
Update_t CmdWindowShowCode1 (int nArgs);
Update_t CmdWindowShowCode2 (int nArgs);
Update_t CmdWindowShowData (int nArgs);
Update_t CmdWindowShowData1 (int nArgs);
Update_t CmdWindowShowData2 (int nArgs);
Update_t CmdWindowShowSymbols1(int nArgs);
Update_t CmdWindowShowSymbols2(int nArgs);
Update_t CmdWindowShowSource (int nArgs);
Update_t CmdWindowShowSource1 (int nArgs);
Update_t CmdWindowShowSource2 (int nArgs);
Update_t CmdWindowShowCode (int nArgs);
Update_t CmdWindowShowCode1 (int nArgs);
Update_t CmdWindowShowCode2 (int nArgs);
Update_t CmdWindowShowData (int nArgs);
Update_t CmdWindowShowData1 (int nArgs);
Update_t CmdWindowShowData2 (int nArgs);
Update_t CmdWindowShowSymbols1 (int nArgs);
Update_t CmdWindowShowSymbols2 (int nArgs);
Update_t CmdWindowShowSource (int nArgs);
Update_t CmdWindowShowSource1 (int nArgs);
Update_t CmdWindowShowSource2 (int nArgs);
Update_t CmdWindowViewCode (int nArgs);
Update_t CmdWindowViewConsole (int nArgs);
Update_t CmdWindowViewData (int nArgs);
Update_t CmdWindowViewOutput (int nArgs);
Update_t CmdWindowViewSource (int nArgs);
Update_t CmdWindowViewSymbols (int nArgs);
Update_t CmdWindowViewCode (int nArgs);
Update_t CmdWindowViewConsole (int nArgs);
Update_t CmdWindowViewData (int nArgs);
Update_t CmdWindowViewOutput (int nArgs);
Update_t CmdWindowViewSource (int nArgs);
Update_t CmdWindowViewSymbols (int nArgs);
Update_t CmdWindowWidthToggle (int nArgs);
// Update_t CmdZeroPageShow (int nArgs);
// Update_t CmdZeroPageHide (int nArgs);
// Update_t CmdZeroPageToggle (int nArgs);
Update_t CmdWindowWidthToggle (int nArgs);
// ZeroPage
Update_t CmdZeroPage (int nArgs);
Update_t CmdZeroPageAdd (int nArgs);
Update_t CmdZeroPageClear (int nArgs);
Update_t CmdZeroPageDisable (int nArgs);
Update_t CmdZeroPageEnable (int nArgs);
Update_t CmdZeroPageList (int nArgs);
// Update_t CmdZeroPageLoad (int nArgs);
Update_t CmdZeroPageSave (int nArgs);
Update_t CmdZeroPagePointer (int nArgs);
// Update_t CmdZeroPageShow (int nArgs);
// Update_t CmdZeroPageHide (int nArgs);
// Update_t CmdZeroPageToggle (int nArgs);
Update_t CmdZeroPage (int nArgs);
Update_t CmdZeroPageAdd (int nArgs);
Update_t CmdZeroPageClear (int nArgs);
Update_t CmdZeroPageDisable (int nArgs);
Update_t CmdZeroPageEnable (int nArgs);
Update_t CmdZeroPageList (int nArgs);
// Update_t CmdZeroPageLoad (int nArgs);
Update_t CmdZeroPageSave (int nArgs);
Update_t CmdZeroPagePointer (int nArgs);
// Cursor _________________________________________________________________________________________

View File

@ -1041,7 +1041,9 @@ eDetectResult C2IMGHelper::DetectHdr(LPBYTE& pImage, DWORD& dwImageSize, DWORD&
if (dwImageSize < sizeof(Header2IMG) || pHdr->FormatID != FormatID_2IMG || pHdr->HeaderSize != sizeof(Header2IMG))
return eMismatch;
if (pHdr->Version != 1)
// https://github.com/AppleWin/AppleWin/issues/317
// Work around some lazy implementations of the spec that set this value to 0 instead of the correct 1.
if (pHdr->Version > 1)
return eMismatch;
if (dwImageSize < sizeof(Header2IMG)+pHdr->DiskDataLength)

View File

@ -56,6 +56,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Configuration\PropertySheet.h"
#include "Debugger\Debug.h"
#define DIRECTX_PAGE_FLIP 1
//#define ENABLE_MENU 0
// Magic numbers (used by FrameCreateWindow to calc width/height):
@ -63,10 +65,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define MAGICY 5 // 3D border between Apple window & Title bar
static const int kDEFAULT_VIEWPORT_SCALE = 2;
static int g_nViewportCX = FRAMEBUFFER_W * kDEFAULT_VIEWPORT_SCALE;
static int g_nViewportCY = FRAMEBUFFER_H * kDEFAULT_VIEWPORT_SCALE;
int g_nViewportCX = FRAMEBUFFER_BORDERLESS_W * kDEFAULT_VIEWPORT_SCALE;
int g_nViewportCY = FRAMEBUFFER_BORDERLESS_H * kDEFAULT_VIEWPORT_SCALE;
static int g_nViewportScale = kDEFAULT_VIEWPORT_SCALE; // saved REGSAVE
static int g_nMaxViewportScale = kDEFAULT_VIEWPORT_SCALE;
static int g_nMaxViewportScale = kDEFAULT_VIEWPORT_SCALE; // Max scale in Windowed mode with borders, buttons etc (full-screen may be +1)
#define BUTTONX (g_nViewportCX + VIEWPORTX*2)
#define BUTTONY 0
@ -142,10 +144,14 @@ static int viewporty = VIEWPORTY; // Default to Normal (non-FullScreen
int g_nCharsetType = 0;
// Direct Draw -- For Full Screen
LPDIRECTDRAW g_pDD = (LPDIRECTDRAW)0;
LPDIRECTDRAWSURFACE g_pDDPrimarySurface = (LPDIRECTDRAWSURFACE)0;
IDirectDrawPalette* g_pDDPal = (IDirectDrawPalette*)0;
LPDIRECTDRAW g_pDD = (LPDIRECTDRAW)0;
LPDIRECTDRAWSURFACE g_pDDPrimarySurface = (LPDIRECTDRAWSURFACE)0;
#if DIRECTX_PAGE_FLIP
LPDIRECTDRAWSURFACE g_pDDBackSurface = (LPDIRECTDRAWSURFACE)0;
#endif
HDC g_hDDdc = 0;
int g_nDDFullScreenW = 640;
int g_nDDFullScreenH = 480;
static bool g_bShowingCursor = true;
static bool g_bLastCursorInAppleViewport = false;
@ -164,6 +170,19 @@ bool g_bScrollLock_FullSpeed = false;
bool g_bFreshReset = false;
static bool g_bFullScreen32Bit = true;
#if 0 // enable non-integral full-screen scaling
#define FULLSCREEN_SCALE_TYPE float
#else
#define FULLSCREEN_SCALE_TYPE int
#endif
static RECT g_main_window_saved_rect;
static int g_main_window_saved_style;
static int g_main_window_saved_exstyle;
static FULLSCREEN_SCALE_TYPE g_win_fullscreen_scale = 1;
static int g_win_fullscreen_offsetx = 0;
static int g_win_fullscreen_offsety = 0;
// __ Prototypes __________________________________________________________________________________
static void DrawCrosshairs (int x, int y);
static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeavingAppleScreen);
@ -439,6 +458,8 @@ static void DrawButton (HDC passdc, int number) {
}
//===========================================================================
// NB. x=y=0 means erase only
static void DrawCrosshairs (int x, int y) {
static int lastx = 0;
static int lasty = 0;
@ -448,6 +469,7 @@ static void DrawCrosshairs (int x, int y) {
// ERASE THE OLD CROSSHAIRS
if (lastx && lasty)
#if 0
if (g_bIsFullScreen) {
int loop = 4;
while (loop--) {
@ -461,7 +483,25 @@ static void DrawCrosshairs (int x, int y) {
FillRect(dc,&rect,(HBRUSH)GetStockObject(BLACK_BRUSH));
}
}
else {
else
#else
if (g_bIsFullScreen)
{
int loop = 4;
while (loop--) {
RECT rect = {0,0,5,5};
switch (loop) {
case 0: OffsetRect(&rect, GetFullScreenOffsetX()+lastx-2, GetFullScreenOffsetY()+viewporty-5); break;
case 1: OffsetRect(&rect, GetFullScreenOffsetX()+lastx-2, GetFullScreenOffsetY()+viewporty+g_nViewportCY); break;
case 2: OffsetRect(&rect, GetFullScreenOffsetX()+viewportx-5, GetFullScreenOffsetY()+lasty-2); break;
case 3: OffsetRect(&rect, GetFullScreenOffsetX()+viewportx+g_nViewportCX, GetFullScreenOffsetY()+lasty-2); break;
}
FillRect(dc, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH));
}
}
else
#endif
{
int loop = 5;
while (loop--) {
switch (loop) {
@ -486,21 +526,42 @@ static void DrawCrosshairs (int x, int y) {
// DRAW THE NEW CROSSHAIRS
if (x && y) {
int loop = 4;
while (loop--) {
if ((loop == 1) || (loop == 2))
SelectObject(dc,GetStockObject(WHITE_PEN));
else
SelectObject(dc,GetStockObject(BLACK_PEN));
LINE(x+loop-2,viewporty-5,
x+loop-2,viewporty);
LINE(x+loop-2,viewporty+g_nViewportCY+4,
x+loop-2,viewporty+g_nViewportCY-1);
LINE(viewportx-5, y+loop-2,
viewportx, y+loop-2);
LINE(viewportx+g_nViewportCX+4,y+loop-2,
viewportx+g_nViewportCX-1,y+loop-2);
}
if (g_bIsFullScreen)
{
int loop = 4;
while (loop--) {
if ((loop == 1) || (loop == 2))
SelectObject(dc,GetStockObject(WHITE_PEN));
else
SelectObject(dc,GetStockObject(BLACK_PEN));
LINE(GetFullScreenOffsetX()+x+loop-2, GetFullScreenOffsetY()+viewporty-5,
GetFullScreenOffsetX()+x+loop-2, GetFullScreenOffsetY()+viewporty);
LINE(GetFullScreenOffsetX()+x+loop-2, GetFullScreenOffsetY()+viewporty+g_nViewportCY+4,
GetFullScreenOffsetX()+x+loop-2, GetFullScreenOffsetY()+viewporty+g_nViewportCY-1);
LINE(GetFullScreenOffsetX()+viewportx-5, GetFullScreenOffsetY()+y+loop-2,
GetFullScreenOffsetX()+viewportx, GetFullScreenOffsetY()+y+loop-2);
LINE(GetFullScreenOffsetX()+viewportx+g_nViewportCX+4, GetFullScreenOffsetY()+y+loop-2,
GetFullScreenOffsetX()+viewportx+g_nViewportCX-1, GetFullScreenOffsetY()+y+loop-2);
}
}
else
{
int loop = 4;
while (loop--) {
if ((loop == 1) || (loop == 2))
SelectObject(dc,GetStockObject(WHITE_PEN));
else
SelectObject(dc,GetStockObject(BLACK_PEN));
LINE(x+loop-2,viewporty-5,
x+loop-2,viewporty);
LINE(x+loop-2,viewporty+g_nViewportCY+4,
x+loop-2,viewporty+g_nViewportCY-1);
LINE(viewportx-5, y+loop-2,
viewportx, y+loop-2);
LINE(viewportx+g_nViewportCX+4,y+loop-2,
viewportx+g_nViewportCX-1,y+loop-2);
}
}
}
#undef LINE
lastx = x;
@ -517,8 +578,6 @@ static void DrawFrameWindow ()
? BeginPaint(g_hFrameWindow,&ps)
: GetDC(g_hFrameWindow));
VideoRealizePalette(dc);
if (!g_bIsFullScreen)
{
// DRAW THE 3D BORDER AROUND THE EMULATED SCREEN
@ -564,11 +623,9 @@ static void DrawFrameWindow ()
else if (g_nAppMode == MODE_DEBUG)
DebugDisplay(1);
else
// Win7: In fullscreen mode with 1 redraw, the screen doesn't get redraw.
// TC: 07/01/2015: Tryed with MP's double-buffered DX full-screen code, but still the same.
VideoRedrawScreen(g_bIsFullScreen ? 2 : 1); // TC: 22/06/2014: Why 2 redraws in full-screen mode (32-bit only)? (8-bit doesn't need this nor does Win8, just Win7 or older OS's)
VideoRedrawScreen(0); // TODO: Presume this is correct with new fullscreen window mode
//VideoRedrawScreen(g_bIsFullScreen ? 1 : 0); // On WM_PAINT: delay 1 refresh before rendering full-screen
// DD Full-Screen Palette: BUGFIX: needs to come _after_ all drawing...
if (g_bPaintingWindow)
EndPaint(g_hFrameWindow,&ps);
else
@ -907,9 +964,6 @@ static void EraseButton (int number) {
rect.top = buttony+number*BUTTONCY;
rect.bottom = rect.top+BUTTONCY;
// TODO: DD Full-Screen Palette
// if( !g_bIsFullScreen )
InvalidateRect(g_hFrameWindow,&rect,1);
}
@ -937,6 +991,8 @@ LRESULT CALLBACK FrameWndProc (
case WM_CLOSE:
LogFileOutput("WM_CLOSE\n");
if (g_bIsFullScreen && restart)
g_bRestartFullScreen = true;
if (g_bIsFullScreen)
SetNormalMode();
if (!IsIconic(window))
@ -1183,10 +1239,9 @@ LRESULT CALLBACK FrameWndProc (
DrawStatusArea( (HDC)0, DRAW_TITLE );
VideoReinitialize();
if ((g_nAppMode != MODE_LOGO) || ((g_nAppMode == MODE_DEBUG) && (g_bDebuggerViewingAppleOutput)))
if (g_nAppMode != MODE_LOGO)
{
VideoRedrawScreen();
g_bDebuggerViewingAppleOutput = true;
VideoRefreshScreen( g_nAppMode == MODE_DEBUG ? g_bDebuggerViewingAppleOutput : 0);
}
Config_Save_Video();
@ -1490,26 +1545,10 @@ LRESULT CALLBACK FrameWndProc (
// message must not realize its palette, unless it determines that
// wParam does not contain its own window handle.
if ((HWND)wparam == window)
{
#if DEBUG_DD_PALETTE
if( g_bIsFullScreen )
OutputDebugString( "WM_PALETTECHANGED: Full Screen\n" );
else
OutputDebugString( "WM_PALETTECHANGED: Windowed\n" );
#endif
break;
}
break;
// else fall through
case WM_QUERYNEWPALETTE:
#if DEBUG_DD_PALETTE
if( g_bIsFullScreen )
OutputDebugString( "WM_QUERYNEWPALETTE: Full Screen\n" );
else
OutputDebugString( "WM_QUERYNEWPALETTE: Windowed\n" );
#endif
// TODO: DD Full-Screen Palette
DrawFrameWindow();
break;
@ -1578,7 +1617,6 @@ LRESULT CALLBACK FrameWndProc (
OutputDebugString( "WM_SYSCOLORCHANGE: Windowed\n" );
#endif
// TODO: DD Full-Screen Palette
DeleteGdiObjects();
CreateGdiObjects();
break;
@ -1738,7 +1776,6 @@ static void ScreenWindowResize(const bool bCtrlKey)
nOldViewportScale = g_nViewportScale;
FrameResizeWindow(1); // reset to 1x
SetFullScreenMode();
//VideoRedrawScreen(1); // [TC-10/06/2014] Remove this once checked it's not needed by Win8
}
}
@ -2064,6 +2101,16 @@ void SetFullScreen32Bit(bool b32Bit)
g_bFullScreen32Bit = b32Bit;
}
int GetFullScreenOffsetX(void)
{
return g_win_fullscreen_offsetx;
}
int GetFullScreenOffsetY(void)
{
return g_win_fullscreen_offsety;
}
void SetFullScreenMode ()
{
#ifdef NO_DIRECT_X
@ -2072,31 +2119,78 @@ void SetFullScreenMode ()
#else // NO_DIRECT_X
g_bIsFullScreen = true;
MONITORINFO monitor_info;
FULLSCREEN_SCALE_TYPE width, height, scalex, scaley;
int top, left;
const int A2_WINDOW_WIDTH = FRAMEBUFFER_BORDERLESS_W;
const int A2_WINDOW_HEIGHT = FRAMEBUFFER_BORDERLESS_H;
buttonover = -1;
#if 0
// FS: 640x480
buttonx = FSBUTTONX;
buttony = FSBUTTONY;
viewportx = FSVIEWPORTX;
viewporty = FSVIEWPORTY;
GetWindowRect(g_hFrameWindow,&framerect);
SetWindowLong(g_hFrameWindow,GWL_STYLE,WS_POPUP | WS_SYSMENU | WS_VISIBLE);
#endif
DDSURFACEDESC ddsd;
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
if (DirectDrawCreate(NULL,&g_pDD,NULL) != DD_OK ||
g_pDD->SetCooperativeLevel(g_hFrameWindow,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN) != DD_OK ||
g_pDD->SetDisplayMode(640,480,g_bFullScreen32Bit ? 32 : 8) != DD_OK ||
g_pDD->CreateSurface(&ddsd,&g_pDDPrimarySurface,NULL) != DD_OK)
{
g_pDDPrimarySurface = NULL;
SetNormalMode();
return;
}
g_main_window_saved_style = GetWindowLong(g_hFrameWindow, GWL_STYLE);
g_main_window_saved_exstyle = GetWindowLong(g_hFrameWindow, GWL_EXSTYLE);
GetWindowRect(g_hFrameWindow, &g_main_window_saved_rect);
SetWindowLong(g_hFrameWindow, GWL_STYLE, g_main_window_saved_style & ~(WS_CAPTION | WS_THICKFRAME));
SetWindowLong(g_hFrameWindow, GWL_EXSTYLE, g_main_window_saved_exstyle & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));
monitor_info.cbSize = sizeof(monitor_info);
GetMonitorInfo(MonitorFromWindow(g_hFrameWindow, MONITOR_DEFAULTTONEAREST), &monitor_info);
left = monitor_info.rcMonitor.left;
top = monitor_info.rcMonitor.top;
width = (FULLSCREEN_SCALE_TYPE)(monitor_info.rcMonitor.right - monitor_info.rcMonitor.left);
height = (FULLSCREEN_SCALE_TYPE)(monitor_info.rcMonitor.bottom - monitor_info.rcMonitor.top);
scalex = width / A2_WINDOW_WIDTH;
scaley = height / A2_WINDOW_HEIGHT;
g_win_fullscreen_scale = (scalex <= scaley) ? scalex : scaley;
g_win_fullscreen_offsetx = ((int)width - (int)(g_win_fullscreen_scale * A2_WINDOW_WIDTH)) / 2;
g_win_fullscreen_offsety = ((int)height - (int)(g_win_fullscreen_scale * A2_WINDOW_HEIGHT)) / 2;
SetWindowPos(g_hFrameWindow, NULL, left, top, (int)width, (int)height, SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
g_bIsFullScreen = true;
// TODO: DD Full-Screen Palette
// if( !g_bIsFullScreen )
#if 1
// FS: desktop
SetViewportScale(g_win_fullscreen_scale, true);
buttonx = GetFullScreenOffsetX() + g_nViewportCX + VIEWPORTX*2;
buttony = GetFullScreenOffsetY();
viewportx = VIEWPORTX;
viewporty = VIEWPORTY;
#endif
// GetWindowRect(g_hFrameWindow,&framerect);
// SetWindowLong(g_hFrameWindow,GWL_STYLE,WS_POPUP | WS_SYSMENU | WS_VISIBLE);
//
// DDSURFACEDESC ddsd;
// ddsd.dwSize = sizeof(ddsd);
// ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
// ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
// ddsd.dwBackBufferCount = 1;
//
// DDSCAPS ddscaps;
// ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
//
// if ( 0
// || DD_OK != DirectDrawCreate(NULL,&g_pDD,NULL)
// || DD_OK != g_pDD->SetCooperativeLevel(g_hFrameWindow,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)
// || DD_OK != g_pDD->SetDisplayMode(g_nDDFullScreenW,g_nDDFullScreenH,32)
// || DD_OK != g_pDD->CreateSurface(&ddsd,&g_pDDPrimarySurface,NULL)
//#if DIRECTX_PAGE_FLIP
// || DD_OK != g_pDDPrimarySurface->GetAttachedSurface( &ddscaps, &g_pDDBackSurface)
//#endif
// )
// {
// g_pDDPrimarySurface = NULL;
// SetNormalMode();
// return;
// }
InvalidateRect(g_hFrameWindow,NULL,1);
@ -2106,39 +2200,44 @@ void SetFullScreenMode ()
//===========================================================================
void SetNormalMode ()
{
g_bIsFullScreen = false;
// g_bIsFullScreen = false;
buttonover = -1;
buttonx = BUTTONX;
buttony = BUTTONY;
viewportx = VIEWPORTX;
viewporty = VIEWPORTY;
g_pDD->RestoreDisplayMode();
g_pDD->SetCooperativeLevel(NULL,DDSCL_NORMAL);
SetWindowLong(g_hFrameWindow,GWL_STYLE,
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
WS_VISIBLE);
SetWindowPos(g_hFrameWindow,0,framerect.left,
framerect.top,
framerect.right - framerect.left,
framerect.bottom - framerect.top,
SWP_NOZORDER | SWP_FRAMECHANGED);
// DD Full-Screen Palette: BUGFIX: Re-attach new palette on next new surface
// Delete Palette
if (g_pDDPal)
{
g_pDDPal->Release();
g_pDDPal = (LPDIRECTDRAWPALETTE)0;
}
g_win_fullscreen_offsetx = 0;
g_win_fullscreen_offsety = 0;
g_win_fullscreen_scale = 1;
SetWindowLong(g_hFrameWindow, GWL_STYLE, g_main_window_saved_style);
SetWindowLong(g_hFrameWindow, GWL_EXSTYLE, g_main_window_saved_exstyle);
SetWindowPos(g_hFrameWindow, NULL,
g_main_window_saved_rect.left,
g_main_window_saved_rect.top,
g_main_window_saved_rect.right - g_main_window_saved_rect.left,
g_main_window_saved_rect.bottom - g_main_window_saved_rect.top,
SWP_SHOWWINDOW);
g_bIsFullScreen = false;
if (g_pDDPrimarySurface)
{
g_pDDPrimarySurface->Release();
g_pDDPrimarySurface = (LPDIRECTDRAWSURFACE)0;
}
//g_pDD->RestoreDisplayMode();
//g_pDD->SetCooperativeLevel(NULL,DDSCL_NORMAL);
//SetWindowLong(g_hFrameWindow,GWL_STYLE,
// WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
// WS_VISIBLE);
//SetWindowPos(g_hFrameWindow,0,framerect.left,
// framerect.top,
// framerect.right - framerect.left,
// framerect.bottom - framerect.top,
// SWP_NOZORDER | SWP_FRAMECHANGED);
//if (g_pDDPrimarySurface)
//{
// g_pDDPrimarySurface->Release();
// g_pDDPrimarySurface = (LPDIRECTDRAWSURFACE)0;
//}
g_pDD->Release();
g_pDD = (LPDIRECTDRAW)0;
//g_pDD->Release();
//g_pDD = (LPDIRECTDRAW)0;
}
//===========================================================================
@ -2178,14 +2277,14 @@ int GetViewportScale(void)
return g_nViewportScale;
}
int SetViewportScale(int nNewScale)
int SetViewportScale(int nNewScale, bool bForce /*=false*/)
{
if (nNewScale > g_nMaxViewportScale)
if (!bForce && nNewScale > g_nMaxViewportScale)
nNewScale = g_nMaxViewportScale;
g_nViewportScale = nNewScale;
g_nViewportCX = g_nViewportScale * FRAMEBUFFER_W;
g_nViewportCY = g_nViewportScale * FRAMEBUFFER_H;
g_nViewportCX = g_nViewportScale * FRAMEBUFFER_BORDERLESS_W;
g_nViewportCY = g_nViewportScale * FRAMEBUFFER_BORDERLESS_H;
return nNewScale;
}
@ -2284,8 +2383,8 @@ void FrameCreateWindow(void)
int nOldViewportCX = g_nViewportCX;
int nOldViewportCY = g_nViewportCY;
g_nViewportCX = FRAMEBUFFER_W * 2;
g_nViewportCY = FRAMEBUFFER_H * 2;
g_nViewportCX = FRAMEBUFFER_BORDERLESS_W * 2;
g_nViewportCY = FRAMEBUFFER_BORDERLESS_H * 2;
GetWidthHeight(nWidth, nHeight); // Probe with 2x dimensions
g_nViewportCX = nOldViewportCX;
@ -2376,14 +2475,22 @@ HDC FrameGetDC () {
//===========================================================================
HDC FrameGetVideoDC (LPBYTE *pAddr_, LONG *pPitch_)
{
HDC hDC = 0;
// ASSERT( pAddr_ );
// ASSERT( pPitch_ );
if (g_bIsFullScreen && g_bAppActive && !g_bPaintingWindow)
if (false) // TODO: ...
//if (g_bIsFullScreen && g_bAppActive && !g_bPaintingWindow)
{
RECT rect = { FSVIEWPORTX,
FSVIEWPORTY,
FSVIEWPORTX+g_nViewportCX,
FSVIEWPORTY+g_nViewportCY};
// Reference: http://archive.gamedev.net/archive/reference/articles/article608.html
// NTSC TODO: Are these coordinates correct?? Coordinates don't seem to matter on Win7 fullscreen!?
// g_nViewportCX = FRAMEBUFFER_W * kDEFAULT_VIEWPORT_SCALE;
RECT rect = {
FSVIEWPORTX,
FSVIEWPORTY,
FSVIEWPORTX+g_nViewportCX,
FSVIEWPORTY+g_nViewportCY
};
DDSURFACEDESC surfacedesc;
surfacedesc.dwSize = sizeof(surfacedesc);
// TC: Use DDLOCK_WAIT - see Bug #13425
@ -2391,23 +2498,23 @@ HDC FrameGetVideoDC (LPBYTE *pAddr_, LONG *pPitch_)
{
g_pDDPrimarySurface->Restore();
g_pDDPrimarySurface->Lock(&rect,&surfacedesc,DDLOCK_WAIT,NULL);
// DD Full Screen Palette
// if (g_pDDPal)
// {
// g_pDDPrimarySurface->SetPalette(g_pDDPal); // this sets the palette for the primary surface
// }
}
*pAddr_ = (LPBYTE)surfacedesc.lpSurface + (g_nViewportCY-1) * surfacedesc.lPitch;
*pPitch_ = -surfacedesc.lPitch;
return (HDC)0;
if( g_pDDPrimarySurface->GetDC( &hDC ) == DD_OK )
g_hDDdc = hDC; // intentional "null" copy
else
hDC = 0;
}
else
{
*pAddr_ = g_pFramebufferbits;
*pPitch_ = FRAMEBUFFER_W;
return FrameGetDC();
hDC = FrameGetDC();
}
return hDC;
}
//===========================================================================
@ -2449,7 +2556,8 @@ void FrameReleaseDC () {
//===========================================================================
void FrameReleaseVideoDC ()
{
if (g_bIsFullScreen && g_bAppActive && !g_bPaintingWindow)
if (false) // TODO: ...
//if (g_bIsFullScreen && g_bAppActive && !g_bPaintingWindow)
{
// THIS IS CORRECT ACCORDING TO THE DIRECTDRAW DOCS
RECT rect = {
@ -2458,10 +2566,19 @@ void FrameReleaseVideoDC ()
FSVIEWPORTX+g_nViewportCX,
FSVIEWPORTY+g_nViewportCY
};
//g_pDDBackSurface->BltFast( 0, 0, g_pDDPrimarySurface, &rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT);
#if DIRECTX_PAGE_FLIP
g_pDDBackSurface->Flip( g_pDDPrimarySurface, 0 );
#endif
g_pDDPrimarySurface->Unlock(&rect);
// BUT THIS SEEMS TO BE WORKING
g_pDDPrimarySurface->Unlock(NULL);
g_pDDPrimarySurface->ReleaseDC( g_hDDdc ); // NTSC Full Screen
g_hDDdc = 0;
}
}

View File

@ -11,27 +11,47 @@
#define VIEWPORTY 5
// 560 = Double Hi-Res
// 384 = Doule Scan Line
#define FRAMEBUFFER_W 560
#define FRAMEBUFFER_H 384
// 384 = Double Scan Line
#define FRAMEBUFFER_BORDERLESS_W 560
#define FRAMEBUFFER_BORDERLESS_H 384
// NTSC_BEGIN
#if 0
// TC: No good as NTSC render code writes to border area:
// . NTSC.cpp: updateVideoScannerHorzEOL(): "NOTE: This writes out-of-bounds for a 560x384 framebuffer"
#define BORDER_W 0
#define BORDER_H 0
#define FRAMEBUFFER_W FRAMEBUFFER_BORDERLESS_W
#define FRAMEBUFFER_H FRAMEBUFFER_BORDERLESS_H
#else
#define BORDER_W 20
#define BORDER_H 18
#define FRAMEBUFFER_W (FRAMEBUFFER_BORDERLESS_W + BORDER_W*2)
#define FRAMEBUFFER_H (FRAMEBUFFER_BORDERLESS_H + BORDER_H*2)
#endif
// NTSC_END
// Direct Draw -- For Full Screen
extern LPDIRECTDRAW g_pDD;
extern LPDIRECTDRAWSURFACE g_pDDPrimarySurface;
extern IDirectDrawPalette* g_pDDPal;
extern int g_nDDFullScreenW;
extern int g_nDDFullScreenH;
// Win32
extern HWND g_hFrameWindow;
extern BOOL g_bIsFullScreen;
extern int g_nViewportCX;
extern int g_nViewportCY;
extern BOOL g_bConfirmReboot; // saved PageConfig REGSAVE
extern BOOL g_bMultiMon;
// Emulator
extern bool g_bFreshReset;
extern std::string PathFilename[2];
extern bool g_bScrollLock_FullSpeed;
extern int g_nCharsetType;
// Prototypes
void CtrlReset();
@ -44,7 +64,7 @@
void FrameReleaseVideoDC ();
void FrameSetCursorPosByMousePos();
int GetViewportScale(void);
int SetViewportScale(int nNewScale);
int SetViewportScale(int nNewScale, bool bForce = false);
void GetViewportCXCY(int& nViewportCX, int& nViewportCY);
bool GetFullScreen32Bit(void);
void SetFullScreen32Bit(bool b32Bit);
@ -59,3 +79,5 @@
WPARAM wparam,
LPARAM lparam );
int GetFullScreenOffsetX(void);
int GetFullScreenOffsetY(void);

View File

@ -40,6 +40,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Memory.h"
#include "Mockingboard.h"
#include "MouseInterface.h"
#include "NTSC.h"
#include "NoSlotClock.h"
#include "ParallelPrinter.h"
#include "Registry.h"
@ -234,7 +235,7 @@ static BYTE __stdcall IORead_C01x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
case 0x6: return MemCheckPaging(pc, addr, bWrite, d, nCyclesLeft);
case 0x7: return MemCheckPaging(pc, addr, bWrite, d, nCyclesLeft);
case 0x8: return MemCheckPaging(pc, addr, bWrite, d, nCyclesLeft);
case 0x9: return VideoCheckVbl(pc, addr, bWrite, d, nCyclesLeft);
case 0x9: return VideoCheckVbl(nCyclesLeft);
case 0xA: return VideoCheckMode(pc, addr, bWrite, d, nCyclesLeft);
case 0xB: return VideoCheckMode(pc, addr, bWrite, d, nCyclesLeft);
case 0xC: return MemCheckPaging(pc, addr, bWrite, d, nCyclesLeft);
@ -1495,13 +1496,35 @@ void MemReset()
BYTE MemReadFloatingBus(const ULONG uExecutedCycles)
{
return*(LPBYTE)(mem + VideoGetScannerAddress(NULL, uExecutedCycles));
#if 0
// NTSC: It is tempting to replace with
// return NTSC_VideoGetScannerAddress( uExecutedCycles );
// But that breaks "Rainbow" Bug #254 if NTSC_VideoGetScannerAddress() is not correct.
// This is out of sync with VideoGetScannerAddress() due to two reasons:
// a) returning a cached copy of g_aHorzClockMemAddress
// Fixed by calling: updateVideoScannerAddressTXT or updateVideoScannerAddressHGR()
// b) A bug? in APPLE_IIE_HORZ_CLOCK_OFFSET[0][8] containing the incorrect value of 0x006F
uint16_t addr1 = NTSC_VideoGetScannerAddress( uExecutedCycles );
uint16_t addr2 = VideoGetScannerAddress(NULL, uExecutedCycles);
uint8_t byte1 = mem[ addr1 ];
uint8_t byte2 = mem[ addr2 ];
if( byte1 != byte2 )
mem[ 0x2000 ] ^= 0xFF;
#endif
// return mem[ VideoGetScannerAddress(NULL, uExecutedCycles) ];
uint16_t addr = NTSC_VideoGetScannerAddress( uExecutedCycles );
return mem[ addr ] ; // cycles is ignored
}
//===========================================================================
BYTE MemReadFloatingBus(const BYTE highbit, const ULONG uExecutedCycles)
{
// NTSC: It is tempting to replace with
// return NTSC_VideoGetScannerAddress( uExecutedCycles );
// But that breaks "Rainbow" Bug #254
// BYTE r= NTSC_VideoGetByte( uExecutedCycles );
BYTE r = *(LPBYTE)(mem + VideoGetScannerAddress(NULL, uExecutedCycles));
return (r & ~0x80) | ((highbit) ? 0x80 : 0);
}

View File

@ -741,7 +741,7 @@ static void Votrax_Write(BYTE nDevice, BYTE nValue)
static void MB_Update()
{
char szDbg[200];
//char szDbg[200];
if (!MockingboardVoice.bActive)
return;
@ -828,9 +828,9 @@ static void MB_Update()
if((dwByteOffset > dwCurrentPlayCursor) && (dwByteOffset < dwCurrentWriteCursor))
{
double fTicksSecs = (double)GetTickCount() / 1000.0;
sprintf(szDbg, "%010.3f: [MBUpdt] PC=%08X, WC=%08X, Diff=%08X, Off=%08X, NS=%08X xxx\n", fTicksSecs, dwCurrentPlayCursor, dwCurrentWriteCursor, dwCurrentWriteCursor-dwCurrentPlayCursor, dwByteOffset, nNumSamples);
OutputDebugString(szDbg);
if (g_fh) fprintf(g_fh, "%s", szDbg);
//sprintf(szDbg, "%010.3f: [MBUpdt] PC=%08X, WC=%08X, Diff=%08X, Off=%08X, NS=%08X xxx\n", fTicksSecs, dwCurrentPlayCursor, dwCurrentWriteCursor, dwCurrentWriteCursor-dwCurrentPlayCursor, dwByteOffset, nNumSamples);
//OutputDebugString(szDbg);
//if (g_fh) fprintf(g_fh, "%s", szDbg);
dwByteOffset = dwCurrentWriteCursor;
}
@ -841,9 +841,9 @@ static void MB_Update()
if((dwByteOffset > dwCurrentPlayCursor) || (dwByteOffset < dwCurrentWriteCursor))
{
double fTicksSecs = (double)GetTickCount() / 1000.0;
sprintf(szDbg, "%010.3f: [MBUpdt] PC=%08X, WC=%08X, Diff=%08X, Off=%08X, NS=%08X XXX\n", fTicksSecs, dwCurrentPlayCursor, dwCurrentWriteCursor, dwCurrentWriteCursor-dwCurrentPlayCursor, dwByteOffset, nNumSamples);
OutputDebugString(szDbg);
if (g_fh) fprintf(g_fh, "%s", szDbg);
//sprintf(szDbg, "%010.3f: [MBUpdt] PC=%08X, WC=%08X, Diff=%08X, Off=%08X, NS=%08X XXX\n", fTicksSecs, dwCurrentPlayCursor, dwCurrentWriteCursor, dwCurrentWriteCursor-dwCurrentPlayCursor, dwByteOffset, nNumSamples);
//OutputDebugString(szDbg);
//if (g_fh) fprintf(g_fh, "%s", szDbg);
dwByteOffset = dwCurrentWriteCursor;
}

1776
source/NTSC.cpp Normal file

File diff suppressed because it is too large Load Diff

20
source/NTSC.h Normal file
View File

@ -0,0 +1,20 @@
// Constants
const int VIDEO_SCANNER_6502_CYCLES = 17030;
// Globals (Public)
extern uint16_t g_nVideoClockVert;
extern uint16_t g_nVideoClockHorz;
extern uint32_t g_nChromaSize;
// Prototypes (Public) ________________________________________________
extern void NTSC_SetVideoMode( int bVideoModeFlags );
extern void NTSC_SetVideoStyle();
extern void NTSC_SetVideoTextMode( int cols );
extern uint32_t*NTSC_VideoGetChromaTable( bool bHueTypeMonochrome, bool bMonitorTypeColorTV );
extern uint16_t NTSC_VideoGetScannerAddress( unsigned long cycles6502 );
extern void NTSC_VideoInit( uint8_t *pFramebuffer );
extern void NTSC_VideoReinitialize( DWORD cyclesThisFrame );
extern void NTSC_VideoInitAppleType();
extern void NTSC_VideoInitChroma();
extern bool NTSC_VideoIsVbl();
extern void NTSC_VideoUpdateCycles( long cycles6502 );

102
source/NTSC_CharSet.cpp Normal file
View File

@ -0,0 +1,102 @@
/*
AppleWin : An Apple //e emulator for Windows
Copyright (C) 2010-2011, William S Simms
Copyright (C) 2016, Tom Charlesworth
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
*/
#include "StdAfx.h"
#include "AppleWin.h"
#include "NTSC_CharSet.h"
unsigned char csbits_enhanced2e[2][256][8]; // Enhanced //e
unsigned char csbits_2e[2][256][8]; // Original //e (no mousetext)
unsigned char csbits_a2[1][256][8]; // ][ and ][+
unsigned char csbits_pravets82[1][256][8]; // Pravets 82
unsigned char csbits_pravets8M[1][256][8]; // Pravets 8M
unsigned char csbits_pravets8C[2][256][8]; // Pravets 8A & 8C
//
static const UINT bitmapWidth = 256;
static const UINT bitmapWidthBytes = bitmapWidth/8;
static const UINT bitmapHeight = 768;
static const UINT charWidth = 16;
static const UINT charWidthBytes = 16/8;
static const UINT charHeight = 16;
static void get_csbits_xy(csbits_t csbits, UINT ch, UINT cx, UINT cy, const BYTE* pBitmap)
{
_ASSERT(ch < 256);
_ASSERT((cx < bitmapWidth/charWidth) && (cy < bitmapHeight/charHeight));
pBitmap += cy*charHeight*bitmapWidthBytes + cx*charWidthBytes;
for (UINT y=0; y<8; y++)
{
BYTE n = 0;
for (int x=0; x<14; x+=2)
{
UINT xp = x/8;
BYTE d = pBitmap[xp];
UINT b = 7 - x%8;
if (d & (1<<b)) n |= 0x80;
n >>= 1;
}
csbits[0][ch][y] = n;
pBitmap += bitmapWidthBytes*2;
}
}
static void get_csbits(csbits_t csbits, const char* resourceName, const UINT cy0)
{
const UINT bufferSize = bitmapWidthBytes*bitmapHeight;
BYTE* pBuffer = new BYTE [bufferSize];
HBITMAP hCharBitmap = LoadBitmap(g_hInstance, resourceName);
GetBitmapBits(hCharBitmap, bufferSize, pBuffer);
for (UINT cy=cy0, ch=0; cy<cy0+16; cy++)
{
for (UINT cx=0; cx<16; cx++)
{
get_csbits_xy(csbits, ch++, cx, cy, pBuffer);
}
}
DeleteObject(hCharBitmap);
delete [] pBuffer;
}
void make_csbits(void)
{
get_csbits(&csbits_enhanced2e[0], TEXT("CHARSET40"), 0); // Enhanced //e: Alt char set off
get_csbits(&csbits_enhanced2e[1], TEXT("CHARSET40"), 16); // Enhanced //e: Alt char set on (mousetext)
get_csbits(&csbits_a2[0], TEXT("CHARSET40"), 32); // Apple ][, ][+
get_csbits(&csbits_pravets82[0], TEXT("CHARSET82"), 0); // Pravets 82
get_csbits(&csbits_pravets8M[0], TEXT("CHARSET8M"), 0); // Pravets 8M
get_csbits(&csbits_pravets8C[0], TEXT("CHARSET8C"), 0); // Pravets 8A / 8C: Alt char set off
get_csbits(&csbits_pravets8C[1], TEXT("CHARSET8C"), 16); // Pravets 8A / 8C: Alt char set on
// Original //e is just Enhanced //e with the 32 mousetext chars [0x40..0x5F] replaced by the non-alt charset chars [0x40..0x5F]
memcpy(csbits_2e, csbits_enhanced2e, sizeof(csbits_enhanced2e));
memcpy(&csbits_2e[1][64], &csbits_2e[0][64], 32*8);
}

12
source/NTSC_CharSet.h Normal file
View File

@ -0,0 +1,12 @@
#pragma once
typedef unsigned char (*csbits_t)[256][8];
extern unsigned char csbits_enhanced2e[2][256][8]; // Enhanced //e
extern unsigned char csbits_2e[2][256][8]; // Original //e (no mousetext)
extern unsigned char csbits_a2[1][256][8]; // ][ and ][+
extern unsigned char csbits_pravets82[1][256][8]; // Pravets 82
extern unsigned char csbits_pravets8M[1][256][8]; // Pravets 8M
extern unsigned char csbits_pravets8C[2][256][8]; // Pravets 8A & 8C
void make_csbits(void);

View File

@ -208,6 +208,8 @@ static void Snapshot_LoadState_v1() // .aws v1.0.0.1, up to (and including) Appl
SetLoadedSaveStateFlag(true);
MemUpdatePaging(TRUE);
VideoReinitialize(); // g_CharsetType changed
}
catch(std::string szMessage)
{

View File

@ -822,7 +822,7 @@ static ULONG Spkr_SubmitWaveBuffer_FullSpeed(short* pSpeakerBuffer, ULONG nNumSa
static ULONG Spkr_SubmitWaveBuffer(short* pSpeakerBuffer, ULONG nNumSamples)
{
char szDbg[200];
//char szDbg[200];
nDbgSpkrCnt++;
if(!SpeakerVoice.bActive)
@ -870,9 +870,9 @@ static ULONG Spkr_SubmitWaveBuffer(short* pSpeakerBuffer, ULONG nNumSamples)
if((dwByteOffset > dwCurrentPlayCursor) && (dwByteOffset < dwCurrentWriteCursor))
{
double fTicksSecs = (double)GetTickCount() / 1000.0;
sprintf(szDbg, "%010.3f: [Submit] PC=%08X, WC=%08X, Diff=%08X, Off=%08X, NS=%08X xxx\n", fTicksSecs, dwCurrentPlayCursor, dwCurrentWriteCursor, dwCurrentWriteCursor-dwCurrentPlayCursor, dwByteOffset, nNumSamples);
OutputDebugString(szDbg);
if (g_fh) fprintf(g_fh, szDbg);
//sprintf(szDbg, "%010.3f: [Submit] PC=%08X, WC=%08X, Diff=%08X, Off=%08X, NS=%08X xxx\n", fTicksSecs, dwCurrentPlayCursor, dwCurrentWriteCursor, dwCurrentWriteCursor-dwCurrentPlayCursor, dwByteOffset, nNumSamples);
//OutputDebugString(szDbg);
//if (g_fh) fprintf(g_fh, szDbg);
dwByteOffset = dwCurrentWriteCursor;
nNumSamplesError = 0;
@ -885,9 +885,9 @@ static ULONG Spkr_SubmitWaveBuffer(short* pSpeakerBuffer, ULONG nNumSamples)
if((dwByteOffset > dwCurrentPlayCursor) || (dwByteOffset < dwCurrentWriteCursor))
{
double fTicksSecs = (double)GetTickCount() / 1000.0;
sprintf(szDbg, "%010.3f: [Submit] PC=%08X, WC=%08X, Diff=%08X, Off=%08X, NS=%08X XXX\n", fTicksSecs, dwCurrentPlayCursor, dwCurrentWriteCursor, dwCurrentWriteCursor-dwCurrentPlayCursor, dwByteOffset, nNumSamples);
OutputDebugString(szDbg);
if (g_fh) fprintf(g_fh, "%s", szDbg);
//sprintf(szDbg, "%010.3f: [Submit] PC=%08X, WC=%08X, Diff=%08X, Off=%08X, NS=%08X XXX\n", fTicksSecs, dwCurrentPlayCursor, dwCurrentWriteCursor, dwCurrentWriteCursor-dwCurrentPlayCursor, dwByteOffset, nNumSamples);
//OutputDebugString(szDbg);
//if (g_fh) fprintf(g_fh, "%s", szDbg);
dwByteOffset = dwCurrentWriteCursor;
nNumSamplesError = 0;

View File

@ -4,6 +4,7 @@
// . See: http://support.embarcadero.com/article/35754
// . "GetOpenFileName() fails under Windows 95/98/NT/ME due to incorrect OPENFILENAME structure size"
#define _WIN32_WINNT 0x0400
#define WINVER 0x500
// Mouse Wheel is not supported on Win95.
// If we didn't care about supporting Win95 (compile/run-time errors)
@ -14,7 +15,7 @@
#endif
// Not needed in VC7.1, but needed in VC Express
#include <tchar.h>
#include <tchar.h>
#include <crtdbg.h>
#include <dsound.h>
@ -27,6 +28,9 @@
#if _MSC_VER >= 1600 // <stdint.h> supported from VS2010 (cl.exe v16.00)
#include <stdint.h> // cleanup WORD DWORD -> uint16_t uint32_t
#else
typedef UINT8 uint8_t;
typedef UINT16 uint16_t;
typedef UINT32 uint32_t;
#endif
#include <windows.h>

File diff suppressed because it is too large Load Diff

View File

@ -6,73 +6,177 @@
// NOTE: Used/Serialized by: g_eVideoType
enum VideoType_e
{
VT_MONO_HALFPIXEL_REAL // uses custom monochrome
, VT_COLOR_STANDARD
, VT_COLOR_TEXT_OPTIMIZED
, VT_COLOR_TVEMU
, VT_MONO_AMBER // now half pixel
, VT_MONO_GREEN // now half pixel
, VT_MONO_WHITE // now half pixel
VT_MONO_CUSTOM
, VT_COLOR_MONITOR
, VT_MONO_TV
, VT_COLOR_TV
, VT_MONO_AMBER
, VT_MONO_GREEN
, VT_MONO_WHITE
, NUM_VIDEO_MODES
};
extern TCHAR g_aVideoChoices[];
extern char *g_apVideoModeDesc[ NUM_VIDEO_MODES ];
enum AppleFont_e
enum VideoFlag_e
{
VF_80COL = 0x00000001,
VF_DHIRES = 0x00000002,
VF_HIRES = 0x00000004,
VF_80STORE= 0x00000008, // was called VF_MASK2
VF_MIXED = 0x00000010,
VF_PAGE2 = 0x00000020,
VF_TEXT = 0x00000040
};
enum AppleFont_e
{
// 40-Column mode is 1x Zoom (default)
// 80-Column mode is ~0.75x Zoom (7 x 16)
// Tiny mode is 0.5 zoom (7x8) for debugger
APPLE_FONT_WIDTH = 14, // in pixels
APPLE_FONT_HEIGHT = 16, // in pixels
// Each cell has a reserved aligned pixel area (grid spacing)
APPLE_FONT_CELL_WIDTH = 16,
APPLE_FONT_CELL_HEIGHT = 16,
// The bitmap contains 3 regions
// Each region is 256x256 pixels = 16x16 chars
APPLE_FONT_X_REGIONSIZE = 256, // in pixelx
APPLE_FONT_Y_REGIONSIZE = 256, // in pixels
// Starting Y offsets (pixels) for the regions
APPLE_FONT_Y_APPLE_2PLUS = 0, // ][+
APPLE_FONT_Y_APPLE_80COL = 256, // //e (inc. Mouse Text)
APPLE_FONT_Y_APPLE_40COL = 512, // ][
};
#ifdef _MSC_VER
/// turn of MSVC struct member padding
#pragma pack(push,1)
#define PACKED
#else
#define PACKED // TODO: FIXME: gcc/clang __attribute__
#endif
struct bgra_t
{
// 40-Column mode is 1x Zoom (default)
// 80-Column mode is ~0.75x Zoom (7 x 16)
// Tiny mode is 0.5 zoom (7x8) for debugger
APPLE_FONT_WIDTH = 14, // in pixels
APPLE_FONT_HEIGHT = 16, // in pixels
// Each cell has a reserved aligned pixel area (grid spacing)
APPLE_FONT_CELL_WIDTH = 16,
APPLE_FONT_CELL_HEIGHT = 16,
// The bitmap contains 3 regions
// Each region is 256x256 pixels = 16x16 chars
APPLE_FONT_X_REGIONSIZE = 256, // in pixelx
APPLE_FONT_Y_REGIONSIZE = 256, // in pixels
// Starting Y offsets (pixels) for the regions
APPLE_FONT_Y_APPLE_2PLUS = 0, // ][+
APPLE_FONT_Y_APPLE_80COL = 256, // //e (inc. Mouse Text)
APPLE_FONT_Y_APPLE_40COL = 512, // ][
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t a; // reserved on Win32
};
struct WinBmpHeader_t
{
// BITMAPFILEHEADER // Addr Size
uint8_t nCookie[2] ; // 0x00 0x02 BM
uint32_t nSizeFile ; // 0x02 0x04 0 = ignore
uint16_t nReserved1 ; // 0x06 0x02
uint16_t nReserved2 ; // 0x08 0x02
uint32_t nOffsetData ; // 0x0A 0x04
// == 0x0D (14)
// BITMAPINFOHEADER
uint32_t nStructSize ; // 0x0E 0x04 biSize
uint32_t nWidthPixels ; // 0x12 0x04 biWidth
uint32_t nHeightPixels ; // 0x16 0x04 biHeight
uint16_t nPlanes ; // 0x1A 0x02 biPlanes
uint16_t nBitsPerPixel ; // 0x1C 0x02 biBitCount
uint32_t nCompression ; // 0x1E 0x04 biCompression 0 = BI_RGB
uint32_t nSizeImage ; // 0x22 0x04 0 = ignore
uint32_t nXPelsPerMeter ; // 0x26 0x04
uint32_t nYPelsPerMeter ; // 0x2A 0x04
uint32_t nPaletteColors ; // 0x2E 0x04
uint32_t nImportantColors; // 0x32 0x04
// == 0x28 (40)
// RGBQUAD
// pixelmap
};
struct WinCIEXYZ
{
uint32_t r; // fixed point 2.30
uint32_t g; // fixed point 2.30
uint32_t b; // fixed point 2.30
};
struct WinBmpHeader4_t
{
// BITMAPFILEHEADER // Addr Size
uint8_t nCookie[2] ; // 0x00 0x02 BM
uint32_t nSizeFile ; // 0x02 0x04 0 = ignore
uint16_t nReserved1 ; // 0x06 0x02
uint16_t nReserved2 ; // 0x08 0x02
uint32_t nOffsetData ; // 0x0A 0x04
// ==== 0x0D (14)
// BITMAPINFOHEADER
uint32_t nStructSize ; // 0x0E 0x04 biSize
uint32_t nWidthPixels ; // 0x12 0x04 biWidth
uint32_t nHeightPixels ; // 0x16 0x04 biHeight
uint16_t nPlanes ; // 0x1A 0x02 biPlanes
uint16_t nBitsPerPixel ; // 0x1C 0x02 biBitCount
uint32_t nCompression ; // 0x1E 0x04 biCompression 0 = BI_RGB
uint32_t nSizeImage ; // 0x22 0x04 0 = ignore
uint32_t nXPelsPerMeter ; // 0x26 0x04
uint32_t nYPelsPerMeter ; // 0x2A 0x04
uint32_t nPaletteColors ; // 0x2E 0x04
uint32_t nImportantColors; // 0x32 0x04
// ==== 0x28 (40)
//BITMAPV4HEADER new fields
uint32_t nRedMask ; // 0x36 0x04
uint32_t nGreenMask ; // 0x3A 0x04
uint32_t nBlueMask ; // 0x3E 0x04
uint32_t nAlphaMask ; // 0x42 0x04
uint32_t nType ; // 0x46 0x04
uint32_t Rx, Ry, Rz ; // 0x4A 0x0C
uint32_t Gx, Gy, Gz ; // 0x56 0x0C
uint32_t Bx, By, Bz ; // 0x62 0x0C
uint32_t nRedGamma ; // 0x6E 0x04
uint32_t nGreenGamma ; // 0x72 0x04
uint32_t nBlueGamma ; // 0x76 0x04
};
#ifdef _MSC_VER
#pragma pack(pop)
#endif
// Globals __________________________________________________________
extern HBITMAP g_hLogoBitmap;
extern COLORREF monochrome; // saved
extern DWORD g_eVideoType; // saved
extern DWORD g_uHalfScanLines; // saved
extern LPBYTE g_pFramebufferbits;
extern COLORREF g_nMonochromeRGB; // saved to Registry
extern uint32_t g_uVideoMode;
extern DWORD g_eVideoType; // saved to Registry
extern DWORD g_uHalfScanLines; // saved to Registry
extern uint8_t *g_pFramebufferbits;
typedef bool (*VideoUpdateFuncPtr_t)(int,int,int,int,int);
// Prototypes _______________________________________________________
void CreateColorMixMap();
BOOL VideoApparentlyDirty ();
void VideoBenchmark ();
void VideoChooseColor ();
void VideoChooseMonochromeColor (); // FIXME: Should be moved to PageConfig and call VideoSetMonochromeColor()
void VideoDestroy ();
void VideoDrawLogoBitmap(HDC hDstDC, int xoff, int yoff, int srcw, int srch, int scale);
void VideoDisplayLogo ();
void VideoInitialize ();
void VideoRealizePalette (HDC);
VideoUpdateFuncPtr_t VideoRedrawScreen (UINT);
VideoUpdateFuncPtr_t VideoRedrawScreen ();
VideoUpdateFuncPtr_t VideoRefreshScreen ();
void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInvalidate = false);
void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame);
void VideoRedrawScreen (UINT uDelayRefresh = 0);
void VideoRefreshScreen (int bVideoFlags, UINT uDelayRefresh =0 );
void VideoReinitialize ();
void VideoResetState ();
WORD VideoGetScannerAddress(bool* pbVblBar_OUT, const DWORD uExecutedCycles);
bool VideoGetVbl(DWORD uExecutedCycles);
void VideoEndOfVideoFrame(void);
bool VideoGetSW80COL(void);
bool VideoGetSWDHIRES(void);
@ -89,9 +193,7 @@ void VideoSetSnapshot_v1(const UINT AltCharSet, const UINT VideoMode);
void VideoSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
void VideoLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
void _Video_Dirty();
void _Video_RedrawScreen( VideoUpdateFuncPtr_t update, bool bMixed = false );
void _Video_SetupBanks( bool bBank2 );
int _Video_SetupBanks( bool bBank2 );
bool Update40ColCell (int x, int y, int xpixel, int ypixel, int offset);
bool Update80ColCell (int x, int y, int xpixel, int ypixel, int offset);
bool UpdateLoResCell (int x, int y, int xpixel, int ypixel, int offset);
@ -109,10 +211,12 @@ enum VideoScreenShot_e
SCREENSHOT_280x192
};
void Video_TakeScreenShot( int iScreenShotType );
void Video_SetBitmapHeader( WinBmpHeader_t *pBmp, int nWidth, int nHeight, int nBitsPerPixel );
// Win32/MSVC: __stdcall
BYTE VideoCheckMode (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles);
BYTE VideoCheckVbl (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles);
BYTE VideoCheckVbl ( ULONG uExecutedCycles );
BYTE VideoSetMode (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles);
void Config_Load_Video(void);

View File

@ -4,6 +4,7 @@
#include "../../source/CPU.h"
// From Applewin.cpp
bool g_bFullSpeed = false;
enum AppMode_e g_nAppMode = MODE_RUNNING;
// From Memory.cpp
@ -98,6 +99,11 @@ DWORD z80_mainloop(ULONG uTotalCycles, ULONG uExecutedCycles)
return 0;
}
// From NTSC.cpp
void NTSC_VideoUpdateCycles( long cycles6502 )
{
}
//-------------------------------------
#include "../../source/cpu/cpu_general.inl"