Merge pull request #362 from AppleWin/Release-1.26.0.1

Merge all the changes & fixes from the Release-1.26.0.1 branch back into master.
This commit is contained in:
TomCh 2016-10-16 21:15:03 +01:00 committed by GitHub
commit bcd4c7c7fa
20 changed files with 196 additions and 100 deletions

View File

@ -9,22 +9,26 @@ https://github.com/AppleWin/AppleWin/issues/new
Tom Charlesworth
1.26.0.1 (beta) - 5 Sept 2016
---------------------------
1.26.0.6 - 16 Oct 2016
----------------------
Changes:
. [Bug #126,#157,#194] Beta NTSC support
TV Color, TV B&W, Monitor Color, Monitor B&W
. [Bug #126,#157,#194] Beta NTSC and cycle-accurate video support
The new supported video modes are now only: TV Color, TV B&W, Monitor Color, Monitor B&W
NB. The old 1.25 modes have been removed eg. "Color (TV Emulation)".
. Full-screen native resolution (no longer 640x480 resolution)
NB. If your screen resolution is smaller than 1120x768, then you will get no scaling in full-screen.
. [Bug #260] Save-state file v2: human readable (Yaml-based format)
All hardware configurations save/restored:
. Apple model, sub-systems, memory, cards (except Uthernet and SAM cards)
Old v1 .aws file format still loaded
NB. Old v1 .aws file format are still loaded
. [Bug #270] Added SAM/DAC sound card support
. AppleWin built with VS2008 Express (supports Windows 2000 or later)
. Unit tests added for 6502 and 65C02 opcodes
. Added -load-state <savestate.yaml> command line option
. New repo created with test save-state images: https://github.com/AppleWin/AppleWin-Test
. Remove unsupported PC speaker sound types
. [PR #235] New start-up title screen by Paulo Garcia
. [PR #233] Configuration Dialog->Disk tab: Buttons replaced with drop-down menu for select/eject by Paulo Garcia
Fixes:
. [Bug #129] Tight loop page-flipping causing heavy CPU load (fixed by NTSC / cycle-accurate video emulation)
@ -45,6 +49,16 @@ Fixes:
. [Bug #246] (Debugger) Memory (Changing Memory) command in CHM help files
. [Bug #309] Silent Service hangs during Mockingboard use
Fixes since 1.26.0.5 (6 Oct 2016):
. [Bug #356] PrintScreen from Color TV or B&W TV video modes is missing top line
Fixes since 1.26.0.3 (19 Sept 2016):
. [Bug #341] Color Monitor mode (showing graphics) is shifted one HGR pixel to the right (losing the rightmost pixel)
. [Bug #353] Pravets 8M has a superfluous dot lit on the ']' character
. [Bug #352] Full-speed in mixed mode results in flickery video
. [Bug #351] In full-speed mode, listing a long BASIC program is barely faster than 1MHz mode
. [Bug #350] Config -> '50% Scan lines' checkbox not working
1.26.0.0 (alpha) - Jan 2016
---------------------------

View File

@ -10,7 +10,7 @@
<hr size="4">
<p>The team&nbsp;would like to thank the following people for their contributions:</p>
<p style="MARGIN-LEFT: 40px">Brian Broker: This HTML / CHM help file</p>
<p style="MARGIN-LEFT: 40px">Thomas Stahl: TV emulation mode</p>
<p style="MARGIN-LEFT: 40px">Thomas Stahl: TV emulation mode (up to v1.25.0.4)</p>
<p style="MARGIN-LEFT: 40px">Chris Foxwell: SSI263 phoneme samples</p>
<p style="MARGIN-LEFT: 40px">Robert Hoem: Harddisk card (source module &amp; f/w)</p>
<p style="MARGIN-LEFT: 40px">VICE team: TFE, Z80, MC6821 PIA emulation modules (<a href="http://www.viceteam.org">http://www.viceteam.org</a>)<br>

View File

@ -28,28 +28,21 @@
<strong>Video:</strong><br>
AppleWin can display Apple video in a variety of modes. The display can also be
run in a standard window or full-screen. This option describes the type of
video emulation to be used for the emulator. Some differences might be
video emulation to be used for the emulator. The differences are
discussed below.<br>
<ul>
<li>
<strong>Monochrome (custom) :</strong>&nbsp;This mode emulates a monochrome
monitor. You can choose your monochrome color from the <em>Monochrome Color</em>
button described below.
<LI>
<STRONG>Monochrome (amber/green/white) :</STRONG>&nbsp;Monochrome with
specified color.
<li>
<strong>Color (standard) :</strong>&nbsp;This mode emulates a standard
color monitor.
<strong>Color Monitor :</strong>&nbsp;This mode emulates a standard color monitor.
<li>
<strong>Color (text optimized) :</strong>&nbsp;This mode does a bit of
image processing to make text more readable on the hires screen.
<strong>B&W TV :</strong>&nbsp;This mode emulates an NTSC black and white TV.
<li>
<strong>Color (TV emulation) :</strong>&nbsp;This mode emulates how colors
would bleed into one another on a TV. On the hires screen, alternating
horizontal lines of color are bled together to form new colors like grey,
purple, pink, yellow and aquamarine. This effect was used in commercial games
like Karateka and many hires adventures (eg. Mindshadow).
<strong>Color TV :</strong>&nbsp;This mode emulates an NTSC color TV.
<li>
<strong>Monochrome (Amber/Green/White) :</strong>&nbsp;Monochrome with specified color.
</li>
<li><strong>50% Scan line :</strong> Only draw alternate scanline (for better monitor
authenticity).</li>

View File

@ -29,12 +29,11 @@ properly. This is the speed at which the real hardware
would&nbsp;access data from your drives.</p>
<p><strong>Select Disk 1/2:</strong><br>
<p><strong>Disk 1/2 drop-down menus:</strong><br>
These buttons allow you to select floppy disk images (.dsk files) to
These menus allow you to select floppy disk images (.dsk files) to
'insert' into the
emulated floppy drives 1 and 2. &nbsp;This can also be done during emulation by <a href="toolbar.html">using the toolbar</a> or using the F3/F4 keys. Diskettes can be swapped by pressing F5 during emulation.</p>
emulated floppy drives 1 and 2. This can also be done during emulation by <a href="toolbar.html">using the toolbar</a> or using the F3/F4 keys. Diskettes can be swapped by pressing F5 during emulation. You can also eject images from this menu.</p>
<h3>Harddisk Controller Settings:</h3>
@ -50,11 +49,12 @@ floppy disk with the harddisk card enabled, you can issue PR#6 from an AppleSoft
prompt.</p>
<p>You can download sample .hdv images from Asimov (eg. <a href="ftp://public.asimov.net/pub/apple_II/" target="_blank">ftp://public.asimov.net/pub/apple_II/images/utility/misc/hardpc.zip</a>).</p>
<p><strong>Select HDD1/HDD2:</strong><br>
<p><strong>HDD 1/2 drop-down menus:</strong><br>
These menus allow you to select harddisk images (.hdv files) to
connect to the emulated hard drive controller. You can also unplug images from this menu.</p>
These buttons allow you to select harddisk images (.hdv files) to
connect to the emulated hard drive controller.</p>
<strong>Harddisk warnings:</strong>
<ul>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -10,16 +10,12 @@
Sound</h2>
<hr size="4">
<h3>Sound:</h3>
<p>AppleWin emulates both the internal speaker (using the PC speaker or sound card)
and also the Mockingboard sound card (using a PC sound card).</p>
<p>AppleWin emulates both the internal speaker
and also the Mockingboard (or Phasor) sound card, using a PC sound card.</p>
<p>Use the AppleWin Configuration tab labelled <em>Sound</em>.</p>
<p>If you are using a sound card, then use at least DirectX-9.</p>
<p>If you want to use a sound card then use at least DirectX&nbsp;9.</p>
<h4>Speaker:</h4>
<p>You can select PC speaker or sound card:</p>
<ul>
<li>PC speaker: This is not recommended as the quality is poor. It is not usable on Windows 2000 or XP.</li>
<li>Sound card: Recommended</li>
</ul>
<p>You can now only emulate this with a sound card.</p>
<h4>Mockingboard:</h4>
<p>When the Mockingboards are enabled, the cards are physically plugged into slots
4 and 5 of the Apple II.</p>

View File

@ -250,8 +250,8 @@ DISK_ICON ICON "DISK.ICO"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,26,0,1
PRODUCTVERSION 1,26,0,1
FILEVERSION 1,26,0,6
PRODUCTVERSION 1,26,0,6
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, 26, 0, 1"
VALUE "FileVersion", "1, 26, 0, 6"
VALUE "InternalName", "APPLEWIN"
VALUE "LegalCopyright", " 1994-2015 Michael O'Brien, Oliver Schmidt, Tom Charlesworth, Michael Pohoreski, Nick Westgate, Linards Ticmanis"
VALUE "LegalCopyright", " 1994-2016 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, 26, 0, 1"
VALUE "ProductVersion", "1, 26, 0, 6"
END
END
BLOCK "VarFileInfo"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -232,6 +232,9 @@ void ContinueExecution(void)
if (g_bFullSpeed)
{
if (!bWasFullSpeed)
VideoRedrawScreenDuringFullSpeed(0, true); // Init for full-speed mode
// Don't call Spkr_Mute() - will get speaker clicks
MB_Mute();
SysClk_StopTimer();
@ -249,7 +252,6 @@ void ContinueExecution(void)
{
if (bWasFullSpeed)
{
VideoRedrawScreenDuringFullSpeed(0, true); // Invalidate the copies of video memory
VideoRedrawScreenAfterFullSpeed(g_dwCyclesThisFrame);
}
@ -284,11 +286,10 @@ void ContinueExecution(void)
g_dwCyclesThisFrame -= dwClksPerFrame;
if (g_bFullSpeed)
{
VideoRedrawScreenDuringFullSpeed(g_dwCyclesThisFrame);
}
else
VideoRefreshScreen(0); // Just copy the output of our Apple framebuffer to the system Back Buffer
MB_EndOfVideoFrame();
}
@ -1197,7 +1198,6 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
// ENTER THE MAIN MESSAGE LOOP
LogFileOutput("Main: EnterMessageLoop()\n");
LogFileTimeUntilFirstKeyReadReset();
EnterMessageLoop();
LogFileOutput("Main: LeaveMessageLoop()\n");

View File

@ -119,9 +119,11 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM
case IDC_CHECK_CONFIRM_REBOOT:
g_bConfirmReboot = IsDlgButtonChecked(hWnd, IDC_CHECK_CONFIRM_REBOOT) ? 1 : 0;
break;
case IDC_CHECK_HALF_SCAN_LINES:
g_uHalfScanLines = IsDlgButtonChecked(hWnd, IDC_CHECK_HALF_SCAN_LINES) ? 1 : 0;
// Checked in DlgOK()
break;
case IDC_COMPUTER:
if(HIWORD(wparam) == CBN_SELCHANGE)
@ -231,10 +233,26 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM
void CPageConfig::DlgOK(HWND hWnd)
{
bool bVideoReinit = false;
const DWORD newvidtype = (DWORD) SendDlgItemMessage(hWnd, IDC_VIDEOTYPE, CB_GETCURSEL, 0, 0);
if (g_eVideoType != newvidtype)
{
g_eVideoType = newvidtype;
bVideoReinit = true;
}
const DWORD newHalfScanLines = IsDlgButtonChecked(hWnd, IDC_CHECK_HALF_SCAN_LINES) ? 1 : 0;
if (g_uHalfScanLines != newHalfScanLines)
{
g_uHalfScanLines = newHalfScanLines;
bVideoReinit = true;
}
if (bVideoReinit)
{
FrameRefreshStatus(DRAW_TITLE, false);
VideoReinitialize();
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
{

View File

@ -6720,8 +6720,6 @@ Update_t _ViewOutput( ViewVideoPage_t iPage, VideoUpdateFuncPtr_t pfUpdate );
Update_t _ViewOutput( ViewVideoPage_t iPage, int bVideoModeFlags )
{
VideoSetForceFullRedraw();
switch( iPage )
{
case VIEW_PAGE_X: bVideoModeFlags |= _Video_SetupBanks( VideoGetSWPAGE2() ); break; // Page Current
@ -6735,7 +6733,7 @@ Update_t _ViewOutput( ViewVideoPage_t iPage, int bVideoModeFlags )
MessageBoxA( NULL, "bVideoModeFlags = ZERO !?", "Information", MB_OK );
#endif
g_bDebuggerViewingAppleOutput = bVideoModeFlags;
VideoRefreshScreen( bVideoModeFlags );
VideoRefreshScreen( bVideoModeFlags, true );
return UPDATE_NOTHING; // intentional
}
@ -6776,7 +6774,7 @@ Update_t _ViewOutput( ViewVideoPage_t iPage, int bVideoModeFlags )
}
Update_t CmdViewOutput_GR2 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_2, VF_80STORE ); // NTSC VideoRefresh() Hack: flags != 0
return _ViewOutput( VIEW_PAGE_2, 0 );
}
// Double Lo-Res
Update_t CmdViewOutput_DGRX (int nArgs)
@ -8495,8 +8493,6 @@ void DebugContinueStepping ()
{
if (nStepsTaken == 0x10000) // HACK_MAGIC_NUM
VideoRedrawScreen();
// else
// VideoRefreshScreen();
}
}
else

View File

@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
static CDiskImageHelper sg_DiskImageHelper;
static CHardDiskImageHelper sg_HardDiskImageHelper;
//===========================================================================
@ -43,7 +44,8 @@ ImageError_e ImageOpen( LPCTSTR pszImageFilename,
bool* pWriteProtected,
const bool bCreateIfNecessary,
std::string& strFilenameInZip,
const bool bExpectFloppy /*=true*/)
const bool bExpectFloppy /*=true*/,
const bool bIsHarddisk /*=false*/)
{
if (! (pszImageFilename && hDiskImage && pWriteProtected && sg_DiskImageHelper.GetWorkBuffer()))
return eIMAGE_ERROR_BAD_POINTER;
@ -57,7 +59,9 @@ ImageError_e ImageOpen( LPCTSTR pszImageFilename,
ImageInfo* pImageInfo = (ImageInfo*) *hDiskImage;
pImageInfo->bWriteProtected = *pWriteProtected;
ImageError_e Err = sg_DiskImageHelper.Open(pszImageFilename, pImageInfo, bCreateIfNecessary, strFilenameInZip);
ImageError_e Err = (!bIsHarddisk)
? sg_DiskImageHelper.Open(pszImageFilename, pImageInfo, bCreateIfNecessary, strFilenameInZip)
: sg_HardDiskImageHelper.Open(pszImageFilename, pImageInfo, bCreateIfNecessary, strFilenameInZip);
if (Err != eIMAGE_ERROR_NONE)
{

View File

@ -62,7 +62,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
const int MAX_DISK_FULL_NAME = 127;
ImageError_e ImageOpen(LPCTSTR pszImageFilename, HIMAGE* hDiskImage, bool* pWriteProtected, const bool bCreateIfNecessary, std::string& strFilenameInZip, const bool bExpectFloppy=true);
ImageError_e ImageOpen(LPCTSTR pszImageFilename, HIMAGE* hDiskImage, bool* pWriteProtected, const bool bCreateIfNecessary, std::string& strFilenameInZip, const bool bExpectFloppy=true, const bool bIsHarddisk=false);
void ImageClose(const HIMAGE hDiskImage, const bool bOpenError=false);
BOOL ImageBoot(const HIMAGE hDiskImage);
void ImageDestroy(void);

View File

@ -623,8 +623,7 @@ static void DrawFrameWindow ()
else if (g_nAppMode == MODE_DEBUG)
DebugDisplay(1);
else
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
VideoRedrawScreen();
if (g_bPaintingWindow)
EndPaint(g_hFrameWindow,&ps);
@ -1831,6 +1830,7 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
if (g_nAppMode == MODE_LOGO)
{
DiskBoot();
LogFileTimeUntilFirstKeyReadReset();
g_nAppMode = MODE_RUNNING;
}
else if (g_nAppMode == MODE_RUNNING)

View File

@ -148,8 +148,6 @@ static HDD g_HardDisk[NUM_HARDDISKS] = {0};
static bool g_bSaveDiskImage = true; // Save the DiskImage name to Registry
static UINT g_uSlot = 7;
static CHardDiskImageHelper sg_HardDiskImageHelper;
//===========================================================================
static void HD_SaveLastDiskImage(const int iDrive);
@ -359,12 +357,14 @@ static BOOL HD_Insert(const int iDrive, LPCTSTR pszImageFilename)
const bool bCreateIfNecessary = false; // NB. Don't allow creation of HDV files
const bool bExpectFloppy = false;
const bool bIsHarddisk = true;
ImageError_e Error = ImageOpen(pszImageFilename,
&g_HardDisk[iDrive].imagehandle,
&g_HardDisk[iDrive].bWriteProtected,
bCreateIfNecessary,
g_HardDisk[iDrive].strFilenameInZip, // TODO: Use this
bExpectFloppy);
bExpectFloppy,
bIsHarddisk);
g_HardDisk[iDrive].hd_imageloaded = (Error == eIMAGE_ERROR_NONE);

View File

@ -1511,7 +1511,7 @@ void NTSC_SetVideoMode( int bVideoModeFlags )
g_nTextPage = 1;
g_nHiresPage = 1;
if (bVideoModeFlags & VF_PAGE2) {
// Apple IIe, Techical Nodtes, #3: Double High-Resolution Graphics
// Apple IIe, Technical Notes, #3: Double High-Resolution Graphics
// 80STORE must be OFF to display page 2
if (0 == (bVideoModeFlags & VF_80STORE)) {
g_nTextPage = 2;
@ -1653,7 +1653,7 @@ void NTSC_VideoInit( uint8_t* pFramebuffer ) // wsVideoInit
updateMonochromeTables( 0xFF, 0xFF, 0xFF );
for (int y = 0; y < (VIDEO_SCANNER_Y_DISPLAY*2); y++)
g_pScanLines[y] = (bgra_t*)(g_pFramebufferbits + 4 * FRAMEBUFFER_W * ((FRAMEBUFFER_H - 1) - y - 18) + 80);
g_pScanLines[y] = (bgra_t*)(g_pFramebufferbits + sizeof(bgra_t) * FRAMEBUFFER_W * ((FRAMEBUFFER_H - 1) - y - BORDER_H) + (sizeof(bgra_t) * BORDER_W));
g_pVideoAddress = g_pScanLines[0];
@ -1759,6 +1759,8 @@ bool NTSC_VideoIsVbl ()
//===========================================================================
void NTSC_VideoUpdateCycles( long cycles6502 )
{
_ASSERT(cycles6502 < VIDEO_SCANNER_6502_CYCLES); // Use NTSC_VideoRedrawWholeScreen() instead
bool bRedraw = cycles6502 >= VIDEO_SCANNER_6502_CYCLES;
// if( !g_bFullSpeed )
@ -1804,3 +1806,54 @@ if(true)
}
}
}
//===========================================================================
void NTSC_VideoRedrawWholeScreen( void )
{
#ifdef _DEBUG
const uint16_t currVideoClockVert = g_nVideoClockVert;
const uint16_t currVideoClockHorz = g_nVideoClockHorz;
#endif
int cyclesLeftToUpdate = VIDEO_SCANNER_6502_CYCLES;
const int cyclesToEndOfLine = VIDEO_SCANNER_MAX_HORZ - g_nVideoClockHorz;
if (g_nVideoClockVert < VIDEO_SCANNER_Y_MIXED)
{
const int cyclesToLine160 = VIDEO_SCANNER_MAX_HORZ * (VIDEO_SCANNER_Y_MIXED - g_nVideoClockVert - 1) + cyclesToEndOfLine;
g_pFuncUpdateGraphicsScreen(cyclesToLine160); // lines [currV...159]
cyclesLeftToUpdate -= cyclesToLine160;
const int cyclesFromLine160ToLine261 = VIDEO_SCANNER_6502_CYCLES - (VIDEO_SCANNER_MAX_HORZ * VIDEO_SCANNER_Y_MIXED);
g_pFuncUpdateGraphicsScreen(cyclesFromLine160ToLine261); // lines [160..191..261]
cyclesLeftToUpdate -= cyclesFromLine160ToLine261;
// Any remaining cyclesLeftToUpdate: lines [0...currV)
}
else
{
const int cyclesToLine262 = VIDEO_SCANNER_MAX_HORZ * (VIDEO_SCANNER_MAX_VERT - g_nVideoClockVert - 1) + cyclesToEndOfLine;
g_pFuncUpdateGraphicsScreen(cyclesToLine262); // lines [currV...261]
cyclesLeftToUpdate -= cyclesToLine262;
const int cyclesFromLine0ToLine159 = VIDEO_SCANNER_MAX_HORZ * VIDEO_SCANNER_Y_MIXED;
g_pFuncUpdateGraphicsScreen(cyclesFromLine0ToLine159); // lines [0..159]
cyclesLeftToUpdate -= cyclesFromLine0ToLine159;
// Any remaining cyclesLeftToUpdate: lines [160...currV)
}
if (cyclesLeftToUpdate)
g_pFuncUpdateGraphicsScreen(cyclesLeftToUpdate);
#ifdef _DEBUG
_ASSERT(currVideoClockVert == g_nVideoClockVert);
_ASSERT(currVideoClockHorz == g_nVideoClockHorz);
#endif
}
//===========================================================================
bool NTSC_GetColorBurst( void )
{
return (g_nColorBurstPixels < 2) ? false : true;
}

View File

@ -18,3 +18,5 @@
extern void NTSC_VideoInitChroma();
extern bool NTSC_VideoIsVbl();
extern void NTSC_VideoUpdateCycles( long cycles6502 );
extern void NTSC_VideoRedrawWholeScreen( void );
extern bool NTSC_GetColorBurst( void );

View File

@ -247,6 +247,7 @@ static LPBYTE g_aSourceStartofLine[ MAX_SOURCE_Y ];
static LPBYTE g_pTextBank1; // Aux
static LPBYTE g_pTextBank0; // Main
// TC (25/8/2016): TODO: Need to investigate the use of this global flag for 1.27
static /*bool*/ UINT g_VideoForceFullRedraw = 1;
static LPBYTE framebufferaddr = (LPBYTE)0;
@ -1052,16 +1053,25 @@ void VideoDisplayLogo ()
// . 10s only update if HIRES changes (17s for Debug build)
// . ~9s no update during full-speed (but IBIZA.DSK doesn't show anything!)
void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInvalidate /*=false*/)
void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit /*=false*/)
{
static DWORD dwFullSpeedStartTime = 0;
static bool bValid = false;
if (bInvalidate)
if (bInit)
{
// Just entered full-speed mode
bValid = false;
dwFullSpeedStartTime = GetTickCount();
return;
}
DWORD dwFullSpeedDuration = GetTickCount() - dwFullSpeedStartTime;
if (dwFullSpeedDuration <= 16) // Only update after every realtime ~17ms of *continuous* full-speed
return;
dwFullSpeedStartTime += dwFullSpeedDuration;
//
static BYTE text_main[1024*2] = {0}; // page1 & 2
@ -1117,11 +1127,10 @@ void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame)
//===========================================================================
void VideoRedrawScreen (UINT uDelayRefresh /* =0 */)
void VideoRedrawScreen (void)
{
g_VideoForceFullRedraw = 1;
VideoRefreshScreen( g_uVideoMode, uDelayRefresh );
// NB. Can't rely on g_uVideoMode being non-zero (ie. so it can double up as a flag) since 'non-mixed GR' mode == 0x00.
VideoRefreshScreen( g_uVideoMode, true );
}
//===========================================================================
@ -1159,19 +1168,45 @@ static void DebugRefresh(char uDebugFlag)
}
#endif
void VideoRefreshScreen ( int bVideoModeFlags, UINT uDelayRefresh /* =0 */ )
// TC: Hacky-fix for GH#341 - better to draw to the correct position in the framebuffer to start with! (in NTSC.cpp)
static void VideoFrameBufferAdjust(int& xSrc, int& ySrc, bool bInvertY=false)
{
static UINT uDelayRefreshCount = 0;
if (uDelayRefresh) uDelayRefreshCount = uDelayRefresh;
int dx=0, dy=0;
if (g_eVideoType == VT_MONO_TV || g_eVideoType == VT_COLOR_TV)
{
// Adjust the src locations for the NTSC video modes
dx = 2;
dy = -1;
}
else if (g_eVideoType == VT_COLOR_MONITOR)
{
//if ((g_uVideoMode & VF_TEXT) == 0) // NB. Not sufficient, eg. ANSI STORY...
if ( NTSC_GetColorBurst() == true ) // ANSI STORY (end credits): split DGR/TEXT80/DGR on scanline
dx = 2;
}
if (bInvertY)
dy -= dy;
xSrc += dx;
ySrc += dy;
}
void VideoRefreshScreen ( int bVideoModeFlags, bool bRedrawWholeScreen /* =false*/ )
{
#if defined(_DEBUG) && defined(DEBUG_REFRESH_TIMINGS)
DebugRefresh(0);
#endif
if( bVideoModeFlags )
if (bRedrawWholeScreen || g_nAppMode == MODE_PAUSED)
{
// bVideoModeFlags set if:
// . MODE_DEBUG : always
// . MODE_RUNNING : called from VideoRedrawScreen(), eg. during full-speed
if (bRedrawWholeScreen)
NTSC_SetVideoMode( bVideoModeFlags );
NTSC_VideoUpdateCycles( VIDEO_SCANNER_6502_CYCLES );
NTSC_VideoRedrawWholeScreen();
}
// NTSC_BEGIN
@ -1191,12 +1226,6 @@ void VideoRefreshScreen ( int bVideoModeFlags, UINT uDelayRefresh /* =0 */ )
if (hFrameDC)
{
if (uDelayRefreshCount)
{
// Delay the refresh in full-screen mode (to allow screen-capabilities to take effect) - required for Win7 (and others?)
--uDelayRefreshCount;
}
else
{
int xDst = 0;
int yDst = 0;
@ -1210,13 +1239,7 @@ void VideoRefreshScreen ( int bVideoModeFlags, UINT uDelayRefresh /* =0 */ )
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;
}
VideoFrameBufferAdjust(xSrc, ySrc); // TC: Hacky-fix for GH#341
int xdest = GetFullScreenOffsetX();
int ydest = GetFullScreenOffsetY();
@ -1368,13 +1391,6 @@ bool VideoGetSWAltCharSet(void)
//===========================================================================
void VideoSetForceFullRedraw(void)
{
g_VideoForceFullRedraw = 1;
}
//===========================================================================
void VideoSetSnapshot_v1(const UINT AltCharSet, const UINT VideoMode)
{
g_nAltCharSetOffset = !AltCharSet ? 0 : 256;
@ -1752,8 +1768,14 @@ void Video_MakeScreenShot(FILE *pFile)
// No need to use GetDibBits() since we already have http://msdn.microsoft.com/en-us/library/ms532334.aspx
// @reference: "Storing an Image" http://msdn.microsoft.com/en-us/library/ms532340(VS.85).aspx
pSrc = (uint32_t*) g_pFramebufferbits;
pSrc += BORDER_H * FRAMEBUFFER_W; // Skip top border
pSrc += BORDER_W; // Skip left border
int xSrc = BORDER_W;
int ySrc = BORDER_H;
VideoFrameBufferAdjust(xSrc, ySrc, true); // TC: Hacky-fix for GH#341 & GH#356
// Lines stored in reverse, so invert the y-adjust value
pSrc += xSrc; // Skip left border
pSrc += ySrc * FRAMEBUFFER_W; // Skip top border
if( g_iScreenshotType == SCREENSHOT_280x192 )
{

View File

@ -169,10 +169,10 @@ void VideoDestroy ();
void VideoDisplayLogo ();
void VideoInitialize ();
void VideoRealizePalette (HDC);
void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInvalidate = false);
void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit = false);
void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame);
void VideoRedrawScreen (UINT uDelayRefresh = 0);
void VideoRefreshScreen (int bVideoFlags, UINT uDelayRefresh =0 );
void VideoRedrawScreen (void);
void VideoRefreshScreen (int bVideoFlags, bool bRedrawWholeScreen = false);
void VideoReinitialize ();
void VideoResetState ();
WORD VideoGetScannerAddress(bool* pbVblBar_OUT, const DWORD uExecutedCycles);
@ -187,8 +187,6 @@ bool VideoGetSWPAGE2(void);
bool VideoGetSWTEXT(void);
bool VideoGetSWAltCharSet(void);
void VideoSetForceFullRedraw(void);
void VideoSetSnapshot_v1(const UINT AltCharSet, const UINT VideoMode);
void VideoSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
void VideoLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);