When FullSpeed: don't do cycle-accurate graphics update

. means that disk accesses (eg. loading) is much quicker
Correct naming of video modes (in UI and code)
Pixel adjust for NTSC B&W and Color video modes to align with other video modes
This commit is contained in:
tomcw 2016-05-17 22:03:45 +01:00
parent 8a1d39104b
commit 04c9d09e38
10 changed files with 100 additions and 36 deletions

View File

@ -192,6 +192,7 @@ void ContinueExecution(void)
? g_bScrollLock_FullSpeed ? g_bScrollLock_FullSpeed
: (GetKeyState(VK_SCROLL) < 0); : (GetKeyState(VK_SCROLL) < 0);
const bool bWasFullSpeed = g_bFullSpeed;
g_bFullSpeed = ( (g_dwSpeed == SPEED_MAX) || g_bFullSpeed = ( (g_dwSpeed == SPEED_MAX) ||
bScrollLock_FullSpeed || bScrollLock_FullSpeed ||
(DiskIsSpinning() && enhancedisk && !Spkr_IsActive() && !MB_IsActive()) ); (DiskIsSpinning() && enhancedisk && !Spkr_IsActive() && !MB_IsActive()) );
@ -213,6 +214,9 @@ void ContinueExecution(void)
} }
else else
{ {
if (bWasFullSpeed)
VideoRedrawScreenAfterFullSpeed(g_dwCyclesThisFrame);
// Don't call Spkr_Demute() // Don't call Spkr_Demute()
MB_Demute(); MB_Demute();
SysClk_StartTimerUsec(nExecutionPeriodUsec); SysClk_StartTimerUsec(nExecutionPeriodUsec);

View File

@ -44,7 +44,6 @@ static DWORD Cpu6502 (DWORD uTotalCycles)
BYTE iOpcode; BYTE iOpcode;
// NTSC_BEGIN // NTSC_BEGIN
ULONG uElapsedCycles;
ULONG uPreviousCycles = uExecutedCycles; ULONG uPreviousCycles = uExecutedCycles;
// NTSC_END // NTSC_END
@ -321,8 +320,11 @@ static DWORD Cpu6502 (DWORD uTotalCycles)
} }
// NTSC_BEGIN // NTSC_BEGIN
uElapsedCycles = uExecutedCycles - uPreviousCycles; if (!g_bFullSpeed)
NTSC_VideoUpdateCycles( uElapsedCycles ); {
ULONG uElapsedCycles = uExecutedCycles - uPreviousCycles;
NTSC_VideoUpdateCycles( uElapsedCycles );
}
// NTSC_END // NTSC_END
CheckInterruptSources(uExecutedCycles); CheckInterruptSources(uExecutedCycles);

View File

@ -47,7 +47,6 @@ static DWORD Cpu65C02 (DWORD uTotalCycles)
BYTE iOpcode; BYTE iOpcode;
// NTSC_BEGIN // NTSC_BEGIN
ULONG uElapsedCycles;
ULONG uPreviousCycles = uExecutedCycles; ULONG uPreviousCycles = uExecutedCycles;
// NTSC_END // NTSC_END
@ -324,8 +323,11 @@ static DWORD Cpu65C02 (DWORD uTotalCycles)
} }
// NTSC_BEGIN // NTSC_BEGIN
uElapsedCycles = uExecutedCycles - uPreviousCycles; if (!g_bFullSpeed)
NTSC_VideoUpdateCycles( uElapsedCycles ); {
ULONG uElapsedCycles = uExecutedCycles - uPreviousCycles;
NTSC_VideoUpdateCycles( uElapsedCycles );
}
// NTSC_END // NTSC_END
CheckInterruptSources(uExecutedCycles); CheckInterruptSources(uExecutedCycles);

View File

@ -121,7 +121,6 @@ static DWORD Cpu65D02 (DWORD uTotalCycles)
BYTE iOpcode; BYTE iOpcode;
// NTSC_BEGIN // NTSC_BEGIN
ULONG uElapsedCycles;
ULONG uPreviousCycles = uExecutedCycles; ULONG uPreviousCycles = uExecutedCycles;
// NTSC_END // NTSC_END
@ -409,8 +408,11 @@ static DWORD Cpu65D02 (DWORD uTotalCycles)
#undef $ #undef $
// NTSC_BEGIN // NTSC_BEGIN
uElapsedCycles = uExecutedCycles - uPreviousCycles; if (!g_bFullSpeed)
NTSC_VideoUpdateCycles( uElapsedCycles ); {
ULONG uElapsedCycles = uExecutedCycles - uPreviousCycles;
NTSC_VideoUpdateCycles( uElapsedCycles );
}
// NTSC_END // NTSC_END
CheckInterruptSources(uExecutedCycles); CheckInterruptSources(uExecutedCycles);

View File

@ -5095,7 +5095,7 @@ Update_t CmdNTSC (int nArgs)
} }
}; };
bool bColorTV = (g_eVideoType == VT_COLOR_TVEMU); bool bColorTV = (g_eVideoType == VT_COLOR_TV);
uint32_t* pChromaTable = NTSC_VideoGetChromaTable( false, bColorTV ); uint32_t* pChromaTable = NTSC_VideoGetChromaTable( false, bColorTV );
char aStatusText[64] = "Loaded"; char aStatusText[64] = "Loaded";
@ -7730,6 +7730,9 @@ bool InternalSingleStep ()
//=========================================================================== //===========================================================================
#define TRACELINE_WITH_VIDEO_SCANNER_POS 0
void OutputTraceLine () void OutputTraceLine ()
{ {
DisasmLine_t line; DisasmLine_t line;
@ -7747,8 +7750,13 @@ void OutputTraceLine ()
g_bTraceHeader = false; g_bTraceHeader = false;
fprintf( g_hTraceFile, 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" // "00 00 00 0000 -------- 0000:90 90 90 NOP"
"A: X: Y: SP: Flags Addr:Opcode Mnemonic\n" "A: X: Y: SP: Flags Addr:Opcode Mnemonic\n"
#endif
); );
} }
@ -7761,6 +7769,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, fprintf( g_hTraceFile,
// "a=%02x x=%02x y=%02x sp=%03x ps=%s %s\n", // "a=%02x x=%02x y=%02x sp=%03x ps=%s %s\n",
"%02X %02X %02X %04X %s %s\n", "%02X %02X %02X %04X %s %s\n",
@ -7772,6 +7795,7 @@ void OutputTraceLine ()
, sDisassembly , sDisassembly
//, sTarget // TODO: Show target? //, sTarget // TODO: Show target?
); );
#endif
} }
} }

View File

@ -470,6 +470,10 @@ int _6502_GetOpmodeOpbyte ( const int nBaseAddress, int & iOpmode_, int & nOpby
if (! g_aOpcodes) if (! g_aOpcodes)
{ {
MessageBox( g_hFrameWindow, "Debugger not properly initialized", "ERROR", MB_OK ); 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 #endif

View File

@ -1525,7 +1525,7 @@ void NTSC_SetVideoStyle() // (int v, int s)
switch ( g_eVideoType ) switch ( g_eVideoType )
{ {
case VT_COLOR_TVEMU: // VT_COLOR_TV: // 0: case VT_COLOR_TV:
r = 0xFF; r = 0xFF;
g = 0xFF; g = 0xFF;
b = 0xFF; b = 0xFF;
@ -1541,7 +1541,7 @@ void NTSC_SetVideoStyle() // (int v, int s)
} }
break; break;
case VT_COLOR_STANDARD: // VT_COLOR_MONITOR: //1: case VT_COLOR_MONITOR:
default: default:
r = 0xFF; r = 0xFF;
g = 0xFF; g = 0xFF;
@ -1558,7 +1558,7 @@ void NTSC_SetVideoStyle() // (int v, int s)
} }
break; break;
case VT_COLOR_TEXT_OPTIMIZED: // VT_MONO_TV: //2: case VT_MONO_TV:
r = 0xFF; r = 0xFF;
g = 0xFF; g = 0xFF;
b = 0xFF; b = 0xFF;
@ -1591,7 +1591,7 @@ void NTSC_SetVideoStyle() // (int v, int s)
b = 0xFF; b = 0xFF;
goto _mono; goto _mono;
case VT_MONO_HALFPIXEL_REAL: case VT_MONO_CUSTOM:
// From WinGDI.h // From WinGDI.h
// #define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16))) // #define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
//#define GetRValue(rgb) (LOBYTE(rgb)) //#define GetRValue(rgb) (LOBYTE(rgb))

View File

@ -258,7 +258,7 @@ static LPBYTE vidlastmem = NULL;
uint32_t g_uVideoMode = VF_TEXT; // Current Video Mode (this is the last set one as it may change mid-scan line!) uint32_t g_uVideoMode = VF_TEXT; // Current Video Mode (this is the last set one as it may change mid-scan line!)
DWORD g_eVideoType = VT_COLOR_TVEMU; DWORD g_eVideoType = VT_COLOR_TV;
DWORD g_uHalfScanLines = 1; // drop 50% scan lines for a more authentic look DWORD g_uHalfScanLines = 1; // drop 50% scan lines for a more authentic look
static bool bVideoScannerNTSC = true; // NTSC video scanning (or PAL) static bool bVideoScannerNTSC = true; // NTSC video scanning (or PAL)
@ -267,27 +267,26 @@ static bool bVideoScannerNTSC = true; // NTSC video scanning (or PAL)
// NOTE: KEEP IN SYNC: VideoType_e g_aVideoChoices g_apVideoModeDesc // NOTE: KEEP IN SYNC: VideoType_e g_aVideoChoices g_apVideoModeDesc
TCHAR g_aVideoChoices[] = TCHAR g_aVideoChoices[] =
TEXT("Monochrome (Custom Luminance)\0") TEXT("Monochrome (Custom)\0")
TEXT("Color (Standard)\0") TEXT("Color Monitor\0")
TEXT("Color (Text Optimized)\0") TEXT("B&W TV\0")
TEXT("Color (TV emulation)\0") TEXT("Color TV\0")
TEXT("Monochrome (Amber)\0") TEXT("Monochrome (Amber)\0")
TEXT("Monochrome (Green)\0") TEXT("Monochrome (Green)\0")
TEXT("Monochrome (White)\0") TEXT("Monochrome (White)\0")
; ;
// AppleWin 1.19.4 VT_COLOR_AUTHENTIC -> VT_COLOR_HALFPIXEL -> VT_COLOR_STANDARD "Color Half-Pixel Authentic
// NOTE: KEEP IN SYNC: VideoType_e g_aVideoChoices g_apVideoModeDesc // NOTE: KEEP IN SYNC: VideoType_e g_aVideoChoices g_apVideoModeDesc
// The window title will be set to this. // The window title will be set to this.
char *g_apVideoModeDesc[ NUM_VIDEO_MODES ] = char *g_apVideoModeDesc[ NUM_VIDEO_MODES ] =
{ {
"Monochrome (Custom)" "Monochrome Monitor (Custom)"
, "Standard" , "Color Monitor"
, "Text Optimized" , "B&W TV"
, "TV" , "Color TV"
, "Amber" , "Amber Monitor"
, "Green" , "Green Monitor"
, "White" , "White Monitor"
}; };
// Prototypes (Private) _____________________________________________ // Prototypes (Private) _____________________________________________
@ -1094,6 +1093,18 @@ void VideoDisplayLogo ()
//=========================================================================== //===========================================================================
void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame)
{
const int nScanLines = bVideoScannerNTSC ? kNTSCScanLines : kPALScanLines;
g_nVideoClockVert = (uint16_t) (dwCyclesThisFrame / kHClocks) % nScanLines;
g_nVideoClockHorz = (uint16_t) (dwCyclesThisFrame % kHClocks);
VideoRedrawScreen(); // Better (no flicker) than using: NTSC_VideoReinitialize() or VideoReinitialize()
}
//===========================================================================
void VideoRedrawScreen (UINT uDelayRefresh /* =0 */) void VideoRedrawScreen (UINT uDelayRefresh /* =0 */)
{ {
g_VideoForceFullRedraw = 1; g_VideoForceFullRedraw = 1;
@ -1185,12 +1196,22 @@ void VideoRefreshScreen ( int bVideoModeFlags, UINT uDelayRefresh /* =0 */ )
yDst = (g_nDDFullScreenH-H)/2; yDst = (g_nDDFullScreenH-H)/2;
} }
int xSrc = BORDER_W;
int ySrc = BORDER_H;
if (g_eVideoType == VT_MONO_TV || g_eVideoType == VT_COLOR_TV)
{
// Adjust the src locations for the NTSC video modes
xSrc += 2;
ySrc -= 1;
}
StretchBlt( StretchBlt(
hFrameDC, hFrameDC,
xDst, yDst, // xDst, yDst xDst, yDst, // xDst, yDst
W, H, // wDst, hDst W, H, // wDst, hDst
g_hDeviceDC, g_hDeviceDC,
BORDER_W, BORDER_H, // xSrc, ySrc xSrc, ySrc, // xSrc, ySrc
FRAMEBUFFER_BORDERLESS_W, FRAMEBUFFER_BORDERLESS_H, // wSrc, hSrc FRAMEBUFFER_BORDERLESS_W, FRAMEBUFFER_BORDERLESS_H, // wSrc, hSrc
SRCCOPY ); SRCCOPY );
} }
@ -1397,6 +1418,7 @@ WORD VideoGetScannerAddress(bool* pbVblBar_OUT, const DWORD uExecutedCycles)
int nScanLines = bVideoScannerNTSC ? kNTSCScanLines : kPALScanLines; int nScanLines = bVideoScannerNTSC ? kNTSCScanLines : kPALScanLines;
int nVSyncLine = bVideoScannerNTSC ? kNTSCVSyncLine : kPALVSyncLine; int nVSyncLine = bVideoScannerNTSC ? kNTSCVSyncLine : kPALVSyncLine;
int nScanCycles = nScanLines * kHClocks; int nScanCycles = nScanLines * kHClocks;
nCycles %= nScanCycles;
// calculate horizontal scanning state // calculate horizontal scanning state
// //
@ -1502,6 +1524,8 @@ bool VideoGetVbl(const DWORD uExecutedCycles)
// calculate video parameters according to display standard // calculate video parameters according to display standard
// //
int nScanLines = bVideoScannerNTSC ? kNTSCScanLines : kPALScanLines; int nScanLines = bVideoScannerNTSC ? kNTSCScanLines : kPALScanLines;
int nScanCycles = nScanLines * kHClocks;
nCycles %= nScanCycles;
// calculate vertical scanning state // calculate vertical scanning state
// //
@ -1783,7 +1807,7 @@ void Config_Load_Video()
REGLOAD(TEXT(REGVALUE_VIDEO_MONO_COLOR ),&g_nMonochromeRGB); REGLOAD(TEXT(REGVALUE_VIDEO_MONO_COLOR ),&g_nMonochromeRGB);
if (g_eVideoType >= NUM_VIDEO_MODES) if (g_eVideoType >= NUM_VIDEO_MODES)
g_eVideoType = VT_COLOR_STANDARD; // Old default: VT_COLOR_TVEMU g_eVideoType = VT_COLOR_MONITOR;
} }
void Config_Save_Video() void Config_Save_Video()

View File

@ -6,13 +6,13 @@
// NOTE: Used/Serialized by: g_eVideoType // NOTE: Used/Serialized by: g_eVideoType
enum VideoType_e enum VideoType_e
{ {
VT_MONO_HALFPIXEL_REAL // uses custom monochrome VT_MONO_CUSTOM
, VT_COLOR_STANDARD , VT_COLOR_MONITOR
, VT_COLOR_TEXT_OPTIMIZED , VT_MONO_TV
, VT_COLOR_TVEMU , VT_COLOR_TV
, VT_MONO_AMBER // now half pixel , VT_MONO_AMBER
, VT_MONO_GREEN // now half pixel , VT_MONO_GREEN
, VT_MONO_WHITE // now half pixel , VT_MONO_WHITE
, NUM_VIDEO_MODES , NUM_VIDEO_MODES
}; };
@ -170,6 +170,7 @@ void VideoDrawLogoBitmap(HDC hDstDC, int xoff, int yoff, int srcw, int srch,
void VideoDisplayLogo (); void VideoDisplayLogo ();
void VideoInitialize (); void VideoInitialize ();
void VideoRealizePalette (HDC); void VideoRealizePalette (HDC);
void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame);
void VideoRedrawScreen (UINT uDelayRefresh = 0); void VideoRedrawScreen (UINT uDelayRefresh = 0);
void VideoRefreshScreen (int bVideoFlags, UINT uDelayRefresh =0 ); void VideoRefreshScreen (int bVideoFlags, UINT uDelayRefresh =0 );
void VideoReinitialize (); void VideoReinitialize ();

View File

@ -4,6 +4,7 @@
#include "../../source/CPU.h" #include "../../source/CPU.h"
// From Applewin.cpp // From Applewin.cpp
bool g_bFullSpeed = false;
enum AppMode_e g_nAppMode = MODE_RUNNING; enum AppMode_e g_nAppMode = MODE_RUNNING;
// From Memory.cpp // From Memory.cpp