Added: HELP VIEW and commands

This commit is contained in:
mpohoreski 2008-08-25 05:25:27 +00:00
parent 512b03f1e0
commit 3ff1874dbf
5 changed files with 319 additions and 68 deletions

View File

@ -4,7 +4,7 @@ AppleWin : An Apple //e emulator for Windows
Copyright (C) 1994-1996, Michael O'Brien
Copyright (C) 1999-2001, Oliver Schmidt
Copyright (C) 2002-2005, Tom Charlesworth
Copyright (C) 2006-2007, Tom Charlesworth, Michael Pohoreski
Copyright (C) 2006-2008, Tom Charlesworth, Michael Pohoreski
AppleWin is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/* Description: Debugger
*
* Author: Copyright (C) 2006, Michael Pohoreski
* Author: Copyright (C) 2006-2008 Michael Pohoreski
*/
// disable warning C4786: symbol greater than 255 character:
@ -43,7 +43,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// TODO: COLOR LOAD ["filename"]
// See Debugger_Changelong.txt for full details
const int DEBUGGER_VERSION = MAKE_VERSION(2,5,7,11);
const int DEBUGGER_VERSION = MAKE_VERSION(2,6,0,0);
// Public _________________________________________________________________________________________
@ -292,6 +292,25 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// {TEXT("VARSLOAD") , CmdVarsLoad , CMD_VARIABLES_LOAD },
// {TEXT("VARSSAVE") , CmdVarsSave , CMD_VARIABLES_SAVE },
// {TEXT("SET") , CmdVarsSet , CMD_VARIABLES_SET },
// View
{TEXT("TEXT") , CmdViewOutput_Text4X , CMD_VIEW_TEXT4X, "View Text screen (current page)" },
{TEXT("TEXT1") , CmdViewOutput_Text41 , CMD_VIEW_TEXT41, "View Text screen Page 1" },
{TEXT("TEXT2") , CmdViewOutput_Text42 , CMD_VIEW_TEXT42, "View Text screen Page 2" },
{TEXT("TEXT80") , CmdViewOutput_Text8X , CMD_VIEW_TEXT8X, "View 80-col Text screen (current page)" },
{TEXT("TEXT81") , CmdViewOutput_Text81 , CMD_VIEW_TEXT8X, "View 80-col Text screen Page 1" },
{TEXT("TEXT82") , CmdViewOutput_Text82 , CMD_VIEW_TEXT8X, "View 80-col Text screen Page 2" },
{TEXT("GR") , CmdViewOutput_GRX , CMD_VIEW_GRX , "View Lo-Res screen (current page)" },
{TEXT("GR1") , CmdViewOutput_GR1 , CMD_VIEW_GR1 , "View Lo-Res screen Page 1" },
{TEXT("GR2") , CmdViewOutput_GR2 , CMD_VIEW_GR2 , "View Lo-Res screen Page 2" },
{TEXT("DGR") , CmdViewOutput_DGRX , CMD_VIEW_DGRX , "View Double lo-res (current page)" },
{TEXT("DGR1") , CmdViewOutput_DGR1 , CMD_VIEW_DGR1 , "View Double lo-res Page 1" },
{TEXT("DGR2") , CmdViewOutput_DGR2 , CMD_VIEW_DGR2 , "View Double lo-res Page 2" },
{TEXT("HGR") , CmdViewOutput_HGRX , CMD_VIEW_HGRX , "View Hi-res (current page)" },
{TEXT("HGR1") , CmdViewOutput_HGR1 , CMD_VIEW_HGR1 , "View Hi-res Page 1" },
{TEXT("HGR2") , CmdViewOutput_HGR2 , CMD_VIEW_HGR2 , "View Hi-res Page 2" },
{TEXT("DHGR") , CmdViewOutput_DHGRX , CMD_VIEW_DHGRX , "View Double Hi-res (current page)" },
{TEXT("DHGR1") , CmdViewOutput_DHGR1 , CMD_VIEW_DHGR1 , "View Double Hi-res Page 1" },
{TEXT("DHGR2") , CmdViewOutput_DHGR2 , CMD_VIEW_DHGR2 , "View Double Hi-res Page 2" },
// Watch
{TEXT("W") , CmdWatch , CMD_WATCH_ADD , "Alias for WA (Watch Add)" },
{TEXT("WA") , CmdWatchAdd , CMD_WATCH_ADD , "Add/Update address or symbol to watch" },
@ -386,6 +405,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
{TEXT("SYM1" ) , CmdSymbolsInfo , CMD_SYMBOLS_MAIN },
{TEXT("SYM2" ) , CmdSymbolsInfo , CMD_SYMBOLS_USER },
{TEXT("SYM3" ) , CmdSymbolsInfo , CMD_SYMBOLS_SRC },
{TEXT("TEXT40") , CmdViewOutput_Text4X , CMD_VIEW_TEXT4X },
{TEXT("TEXT41") , CmdViewOutput_Text41 , CMD_VIEW_TEXT41 },
{TEXT("TEXT42") , CmdViewOutput_Text42 , CMD_VIEW_TEXT42 },
{TEXT("WATCH") , CmdWatchAdd , CMD_WATCH_ADD },
{TEXT("WINDOW") , CmdWindow , CMD_WINDOW },
// {TEXT("W?") , CmdWatchAdd , CMD_WATCH_ADD },
@ -682,9 +705,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
{"RANGE" , NULL, PARAM_CAT_RANGE },
// {TEXT("REGISTERS") , NULL, PARAM_CAT_REGISTERS },
{"SYMBOLS" , NULL, PARAM_CAT_SYMBOLS },
{"VIEW" , NULL, PARAM_CAT_VIEW },
{"WATCHES" , NULL, PARAM_CAT_WATCHES },
{"WINDOW" , NULL, PARAM_CAT_WINDOW },
{"ZEROPAGE" , NULL, PARAM_CAT_ZEROPAGE },
{"ZEROPAGE" , NULL, PARAM_CAT_ZEROPAGE },
// Memory
{TEXT("?") , NULL, PARAM_MEM_SEARCH_WILD },
// {TEXT("*") , NULL, PARAM_MEM_SEARCH_BYTE },
@ -695,6 +719,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
{TEXT("SYMBOLS") , NULL, PARAM_SRC_SYMBOLS },
{TEXT("MERLIN") , NULL, PARAM_SRC_MERLIN },
{TEXT("ORCA") , NULL, PARAM_SRC_ORCA },
// View
// {TEXT("VIEW") , NULL, PARAM_SRC_??? },
// Window Win Cmd WinEffects CmdEffects
{TEXT("CODE") , NULL, PARAM_CODE }, // x x code win only switch to code window
// {TEXT("CODE1") , NULL, PARAM_CODE_1 }, // - x code/data win
@ -6692,6 +6718,114 @@ Update_t CmdSymbolsSave (int nArgs)
}
// View ___________________________________________________________________________________________
// See: CmdWindowViewOutput (int nArgs)
enum ViewVideoPage_t
{
VIEW_PAGE_X, // current page
VIEW_PAGE_1,
VIEW_PAGE_2
};
Update_t _ViewOutput( ViewVideoPage_t iPage, VideoUpdateFuncPtr_t pfUpdate );
Update_t _ViewOutput( ViewVideoPage_t iPage, VideoUpdateFuncPtr_t pfUpdate )
{
g_VideoForceFullRedraw = true;
_Video_Dirty();
switch( iPage )
{
case VIEW_PAGE_X: _Video_SetupBanks( g_bVideoDisplayPage2 ); break; // Page Current
case VIEW_PAGE_1: _Video_SetupBanks( false ); break; // Page 1
case VIEW_PAGE_2: _Video_SetupBanks( true ); break; // Page 2 !
default:
break;
}
_Video_RedrawScreen( pfUpdate );
g_bDebuggerViewingAppleOutput = true;
return UPDATE_NOTHING; // intentional
}
// Text 40
Update_t CmdViewOutput_Text4X (int nArgs)
{
return _ViewOutput( VIEW_PAGE_X, Update40ColCell );
}
Update_t CmdViewOutput_Text41 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_1, Update40ColCell );
}
Update_t CmdViewOutput_Text42 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_2, Update40ColCell );
}
// Text 80
Update_t CmdViewOutput_Text8X (int nArgs)
{
return _ViewOutput( VIEW_PAGE_X, Update80ColCell );
}
Update_t CmdViewOutput_Text81 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_1, Update80ColCell );
}
Update_t CmdViewOutput_Text82 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_2, Update80ColCell );
}
// Lo-Res
Update_t CmdViewOutput_GRX (int nArgs)
{
return _ViewOutput( VIEW_PAGE_X, UpdateLoResCell );
}
Update_t CmdViewOutput_GR1 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_1, UpdateLoResCell );
}
Update_t CmdViewOutput_GR2 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_2, UpdateLoResCell );
}
// Double Lo-Res
Update_t CmdViewOutput_DGRX (int nArgs)
{
return _ViewOutput( VIEW_PAGE_X, UpdateDLoResCell );
}
Update_t CmdViewOutput_DGR1 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_1, UpdateDLoResCell );
}
Update_t CmdViewOutput_DGR2 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_2, UpdateDLoResCell );
}
// Hi-Res
Update_t CmdViewOutput_HGRX (int nArgs)
{
return _ViewOutput( VIEW_PAGE_X, UpdateHiResCell );
}
Update_t CmdViewOutput_HGR1 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_1, UpdateHiResCell );
}
Update_t CmdViewOutput_HGR2 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_2, UpdateHiResCell );
}
// Double Hi-Res
Update_t CmdViewOutput_DHGRX (int nArgs)
{
return _ViewOutput( VIEW_PAGE_X, UpdateDHiResCell );
}
Update_t CmdViewOutput_DHGR1 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_1, UpdateDHiResCell );
}
Update_t CmdViewOutput_DHGR2 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_2, UpdateDHiResCell );
}
// Watches ________________________________________________________________________________________

View File

@ -4,7 +4,7 @@ AppleWin : An Apple //e emulator for Windows
Copyright (C) 1994-1996, Michael O'Brien
Copyright (C) 1999-2001, Oliver Schmidt
Copyright (C) 2002-2005, Tom Charlesworth
Copyright (C) 2006-2007, Tom Charlesworth, Michael Pohoreski
Copyright (C) 2006-2008, Tom Charlesworth, Michael Pohoreski
AppleWin is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/* Description: Debugger
*
* Author: Copyright (C) 2006, Michael Pohoreski
* Author: Copyright (C) 2006-2008 Michael Pohoreski
*/
#include "StdAfx.h"
@ -513,7 +513,7 @@ Update_t CmdHelpSpecific (int nArgs)
nFound = FindCommand( g_aArgs[iArg].sArg, pFunction, & iCommand );
if (nFound && (iCommand != CMD_OUT))
{
iCmdBegin = CMD_OUTPUT_CALC ; iCmdEnd = CMD_OUTPUT_RUN ; break;
iCmdBegin = CMD_OUTPUT_CALC ; iCmdEnd = CMD_OUTPUT_RUN ;
bCategory = true;
}
else
@ -525,18 +525,31 @@ Update_t CmdHelpSpecific (int nArgs)
nFound = FindCommand( g_aArgs[iArg].sArg, pFunction, & iCommand );
if (nFound && (iCommand != CMD_SYMBOLS_LOOKUP) && (iCommand != CMD_MEMORY_SEARCH))
{
iCmdBegin = CMD_SYMBOLS_LOOKUP ; iCmdEnd = CMD_SYMBOLS_LIST ; break;
iCmdBegin = CMD_SYMBOLS_LOOKUP ; iCmdEnd = CMD_SYMBOLS_LIST ;
bCategory = true;
}
else
bCategory = false;
break;
case PARAM_CAT_VIEW :
// HACK: check if we have an exact command match first
// nFound = FindCommand( g_aArgs[iArg].sArg, pFunction, & iCommand );
// if (nFound && (iCommand != CMD_VIEW_TEXT4X))
{
iCmdBegin = CMD_VIEW_TEXT4X ; iCmdEnd = CMD_VIEW_DHGR2 ;
bCategory = true;
}
// else
// bCategory = false;
break;
case PARAM_CAT_WATCHES :
// HACK: check if we have an exact command match first
nFound = FindCommand( g_aArgs[iArg].sArg, pFunction, & iCommand );
if (nFound && (iCommand != CMD_WATCH_ADD))
{
iCmdBegin = CMD_WATCH_ADD ; iCmdEnd = CMD_WATCH_LIST ; break;
iCmdBegin = CMD_WATCH_ADD ; iCmdEnd = CMD_WATCH_LIST ;
bCategory = true;
}
else
@ -666,6 +679,9 @@ Update_t CmdHelpSpecific (int nArgs)
if (iCmd <= CMD_SYMBOLS_LIST)
wsprintf( sCategory, g_aParameters[ PARAM_CAT_SYMBOLS ].m_sName );
else
if (iCmd <= CMD_VIEW_DHGR2)
wsprintf( sCategory, g_aParameters[ PARAM_CAT_VIEW ].m_sName );
else
if (iCmd <= CMD_WATCH_SAVE)
wsprintf( sCategory, g_aParameters[ PARAM_CAT_WATCHES ].m_sName );
else
@ -1242,6 +1258,26 @@ Update_t CmdHelpSpecific (int nArgs)
ConsolePrint( sText );
ConsoleBufferPush( " Looks up symbol in all 3 symbol tables: main, user, source" );
break;
// View
case CMD_VIEW_TEXT4X:
case CMD_VIEW_TEXT41:
case CMD_VIEW_TEXT42:
case CMD_VIEW_TEXT8X:
case CMD_VIEW_TEXT81:
case CMD_VIEW_TEXT82:
case CMD_VIEW_GRX :
case CMD_VIEW_GR1 :
case CMD_VIEW_GR2 :
case CMD_VIEW_DGRX :
case CMD_VIEW_DGR1 :
case CMD_VIEW_DGR2 :
case CMD_VIEW_HGRX :
case CMD_VIEW_HGR1 :
case CMD_VIEW_HGR2 :
case CMD_VIEW_DHGRX :
case CMD_VIEW_DHGR1 :
case CMD_VIEW_DHGR2 :
break;
// Watches
case CMD_WATCH_ADD:
Colorize( sText, " Usage: <address | symbol>" );
@ -1293,6 +1329,7 @@ Update_t CmdHelpSpecific (int nArgs)
ConsolePrint( sText );
ConsoleBufferPush( " * Display extra internal stats" );
break;
default:
if (bAllCommands)
break;
@ -1306,7 +1343,7 @@ Update_t CmdHelpSpecific (int nArgs)
{
//#if DEBUG_COMMAND_HELP
#if _DEBUG
wsprintf( sText, "Command help not done yet: %s", g_aCommands[ iCommand ].m_sName );
wsprintf( sText, "Command help not done yet!: %s", g_aCommands[ iCommand ].m_sName );
ConsoleBufferPush( sText );
#endif
}

View File

@ -581,6 +581,25 @@
// , CMD_SYMBOLS_LOAD_1
// , CMD_SYMBOLS_LOAD_2
// , CMD_SYMBOLS_SAVE
// View
, CMD_VIEW_TEXT4X
, CMD_VIEW_TEXT41
, CMD_VIEW_TEXT42
, CMD_VIEW_TEXT8X
, CMD_VIEW_TEXT81
, CMD_VIEW_TEXT82
, CMD_VIEW_GRX
, CMD_VIEW_GR1
, CMD_VIEW_GR2
, CMD_VIEW_DGRX
, CMD_VIEW_DGR1
, CMD_VIEW_DGR2
, CMD_VIEW_HGRX
, CMD_VIEW_HGR1
, CMD_VIEW_HGR2
, CMD_VIEW_DHGRX
, CMD_VIEW_DHGR1
, CMD_VIEW_DHGR2
// Watch
, CMD_WATCH
, CMD_WATCH_ADD
@ -772,6 +791,27 @@
Update_t CmdSymbolsUser (int nArgs);
Update_t CmdSymbolsSave (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);
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);
// Watch
Update_t CmdWatch (int nArgs);
Update_t CmdWatchAdd (int nArgs);
@ -1255,7 +1295,7 @@
enum Parameters_e
{
// Note: Order must match Breakpoint_Operator_t
// Note: Order must much _PARAM_BREAKPOINT_*
// Note: Order must match _PARAM_BREAKPOINT_*
// Note: Order must match g_aBreakpointSymbols
_PARAM_BREAKPOINT_BEGIN
, PARAM_BP_LESS_EQUAL = _PARAM_BREAKPOINT_BEGIN // <=
@ -1352,6 +1392,7 @@
, PARAM_CAT_RANGE
// , PARAM_CAT_REGISTERS
, PARAM_CAT_SYMBOLS
, PARAM_CAT_VIEW
, PARAM_CAT_WATCHES
, PARAM_CAT_WINDOW
, PARAM_CAT_ZEROPAGE

View File

@ -188,8 +188,6 @@ int const kVLine0State = 0x100; // V[543210CBA] = 100000000
int const kVPresetLine = 256; // line when V state presets
int const kVSyncLines = 4; // lines per VSync duration
typedef bool (*UpdateFunc_t)(int,int,int,int,int);
static BYTE celldirty[40][32];
static COLORREF customcolors[NUM_COLOR_PALETTE]; // MONOCHROME is last custom color
static HBITMAP g_hDeviceBitmap;
@ -219,8 +217,11 @@ static BYTE colormixbuffer[6];
static WORD colormixmap[6][6][6];
//
static int g_nAltCharSetOffset = 0; // alternate character set
static BOOL displaypage2 = 0;
static int g_nAltCharSetOffset = 0; // alternate character set
bool g_bVideoDisplayPage2 = 0;
bool g_VideoForceFullRedraw = 1;
static LPBYTE framebufferaddr = (LPBYTE)0;
static LONG framebufferpitch = 0;
BOOL graphicsmode = 0;
@ -228,7 +229,6 @@ static BOOL hasrefreshed = 0;
static DWORD lastpageflip = 0;
COLORREF monochrome = RGB(0xC0,0xC0,0xC0);
static BOOL rebuiltsource = 0;
static BOOL redrawfull = 1;
static DWORD dwVBlCounter = 0;
static LPBYTE vidlastmem = NULL;
static DWORD vidmode = VF_TEXT;
@ -1015,7 +1015,7 @@ void SetLastDrawnImage () {
bool Update40ColCell (int x, int y, int xpixel, int ypixel, int offset)
{
BYTE ch = *(g_pTextBank0+offset);
bool bCharChanged = (ch != *(vidlastmem+offset+0x400) || redrawfull);
bool bCharChanged = (ch != *(vidlastmem+offset+0x400) || g_VideoForceFullRedraw);
// FLASHing chars:
// - FLASHing if:Alt Char Set is OFF && 0x40<=char<=0x7F
@ -1059,8 +1059,8 @@ bool Update80ColCell (int x, int y, int xpixel, int ypixel, int offset)
BYTE c1 = *(g_pTextBank1 + offset); // aux
BYTE c0 = *(g_pTextBank0 + offset); // main
bool bC1Changed = (c1 != *(vidlastmem + offset + 0) || redrawfull);
bool bC0Changed = (c0 != *(vidlastmem + offset + 0x400) || redrawfull);
bool bC1Changed = (c1 != *(vidlastmem + offset + 0) || g_VideoForceFullRedraw);
bool bC0Changed = (c0 != *(vidlastmem + offset + 0x400) || g_VideoForceFullRedraw);
bool bC1Flashing = (g_nAltCharSetOffset == 0) && (c1 >= 0x40) && (c1 <= 0x7F);
bool bC0Flashing = (g_nAltCharSetOffset == 0) && (c0 >= 0x40) && (c0 <= 0x7F);
@ -1077,7 +1077,7 @@ bool Update80ColCell (int x, int y, int xpixel, int ypixel, int offset)
if ((auxval != *(vidlastmem+offset)) ||
(mainval != *(vidlastmem+offset+0x400)) ||
redrawfull)
g_VideoForceFullRedraw)
{
CopySource(xpixel,ypixel,
(APPLE_FONT_WIDTH / 2), APPLE_FONT_HEIGHT,
@ -1110,7 +1110,7 @@ bool UpdateDHiResCell (int x, int y, int xpixel, int ypixel, int offset)
(byteval3 != *(vidlastmem+offset+yoffset+0x2000)) ||
((x > 0) && ((byteval1 & 0x70) != (*(vidlastmem+offset+yoffset+0x1FFF) & 0x70))) ||
((x < 39) && ((byteval4 & 0x07) != (*(vidlastmem+offset+yoffset+ 1) & 0x07))) ||
redrawfull) {
g_VideoForceFullRedraw) {
DWORD dwordval = (byteval1 & 0x70) | ((byteval2 & 0x7F) << 7) |
((byteval3 & 0x7F) << 14) | ((byteval4 & 0x07) << 21);
#define PIXEL 0
@ -1290,7 +1290,7 @@ bool UpdateHiResCell (int x, int y, int xpixel, int ypixel, int offset)
if ((byteval2 != *(vidlastmem+offset+yoffset+0x2000)) ||
((x > 0) && ((byteval1 & 0x60) != (*(vidlastmem+offset+yoffset+0x1FFF) & 0x60))) ||
((x < 39) && ((byteval3 & 0x03) != (*(vidlastmem+offset+yoffset+0x2001) & 0x03))) ||
redrawfull) {
g_VideoForceFullRedraw) {
#define COLOFFS (((byteval1 & 0x60) << 2) | \
((byteval3 & 0x03) << 5))
if (videotype == VT_COLOR_TVEMU)
@ -1317,7 +1317,7 @@ bool UpdateHiResCell (int x, int y, int xpixel, int ypixel, int offset)
bool UpdateLoResCell (int x, int y, int xpixel, int ypixel, int offset)
{
BYTE val = *(g_pTextBank0+offset);
if ((val != *(vidlastmem+offset+0x400)) || redrawfull)
if ((val != *(vidlastmem+offset+0x400)) || g_VideoForceFullRedraw)
{
CopySource(xpixel,ypixel,
14,8,
@ -1332,7 +1332,6 @@ bool UpdateLoResCell (int x, int y, int xpixel, int ypixel, int offset)
}
//===========================================================================
bool UpdateDLoResCell (int x, int y, int xpixel, int ypixel, int offset)
{
BYTE auxval = *(g_pTextBank1 +offset);
@ -1340,7 +1339,7 @@ bool UpdateDLoResCell (int x, int y, int xpixel, int ypixel, int offset)
if ( (auxval != *(vidlastmem+offset)) ||
(mainval != *(vidlastmem+offset+0x400)) ||
redrawfull
g_VideoForceFullRedraw
)
{
CopySource( xpixel,ypixel,
@ -1375,10 +1374,10 @@ bool UpdateDLoResCell (int x, int y, int xpixel, int ypixel, int offset)
//===========================================================================
BOOL VideoApparentlyDirty ()
{
if (SW_MIXED || redrawfull)
if (SW_MIXED || g_VideoForceFullRedraw)
return 1;
DWORD address = (SW_HIRES && !SW_TEXT) ? (0x20 << displaypage2) : (0x4 << displaypage2);
DWORD address = (SW_HIRES && !SW_TEXT) ? (0x20 << g_bVideoDisplayPage2) : (0x4 << g_bVideoDisplayPage2);
DWORD length = (SW_HIRES && !SW_TEXT) ? 0x20 : 0x4;
while (length--)
if (*(memdirty+(address++)) & 2)
@ -1391,7 +1390,7 @@ BOOL VideoApparentlyDirty ()
// Scan visible text page for any flashing chars
if((SW_TEXT || SW_MIXED) && (g_nAltCharSetOffset == 0))
{
BYTE* pnMemText = MemGetMainPtr(0x400 << displaypage2);
BYTE* pnMemText = MemGetMainPtr(0x400 << g_bVideoDisplayPage2);
// Scan 8 long-lines of 120 chars (at 128 char offsets):
// . Skip 8-char holes in TEXT
@ -1608,9 +1607,9 @@ BYTE __stdcall VideoCheckMode (WORD, WORD address, BYTE, BYTE, ULONG nCyclesLeft
//===========================================================================
void VideoCheckPage (BOOL force) {
if ((displaypage2 != (SW_PAGE2 != 0)) &&
if ((g_bVideoDisplayPage2 != (SW_PAGE2 != 0)) &&
(force || (emulmsec-lastpageflip > 500))) {
displaypage2 = (SW_PAGE2 != 0);
g_bVideoDisplayPage2 = (SW_PAGE2 != 0);
VideoRefreshScreen();
hasrefreshed = 1;
lastpageflip = emulmsec;
@ -1870,36 +1869,58 @@ void VideoRealizePalette (HDC dc) {
//===========================================================================
void VideoRedrawScreen () {
redrawfull = 1;
g_VideoForceFullRedraw = 1;
VideoRefreshScreen();
}
//===========================================================================
void VideoRefreshScreen () {
LPBYTE addr = g_pFramebufferbits;
LONG pitch = 560;
HDC framedc = FrameGetVideoDC(&addr,&pitch);
CreateFrameOffsetTable(addr,pitch);
void _Video_Dirty()
{
ZeroMemory(celldirty,40*32);
}
//===========================================================================
void _Video_SetupBanks( bool bBank2 )
{
g_pHiresBank1 = MemGetAuxPtr (0x2000 << bBank2);
g_pHiresBank0 = MemGetMainPtr(0x2000 << bBank2);
g_pTextBank1 = MemGetAuxPtr (0x400 << bBank2);
g_pTextBank0 = MemGetMainPtr(0x400 << bBank2);
}
//===========================================================================
void VideoRefreshScreen () {
// CHECK EACH CELL FOR CHANGED BYTES. REDRAW PIXELS FOR THE CHANGED BYTES
// IN THE FRAME BUFFER. MARK CELLS IN WHICH REDRAWING HAS TAKEN PLACE AS
// DIRTY.
g_pHiresBank1 = MemGetAuxPtr (0x2000 << displaypage2);
g_pHiresBank0 = MemGetMainPtr(0x2000 << displaypage2);
g_pTextBank1 = MemGetAuxPtr (0x400 << displaypage2);
g_pTextBank0 = MemGetMainPtr(0x400 << displaypage2);
ZeroMemory(celldirty,40*32);
UpdateFunc_t update = SW_TEXT
? SW_80COL
? Update80ColCell
: Update40ColCell
: SW_HIRES
? (SW_DHIRES && SW_80COL)
? UpdateDHiResCell
: UpdateHiResCell
: (SW_DHIRES && SW_80COL)
? UpdateDLoResCell
: UpdateLoResCell;
_Video_Dirty();
_Video_SetupBanks( g_bVideoDisplayPage2 );
VideoUpdateFuncPtr_t pfUpdate = SW_TEXT
? SW_80COL
? Update80ColCell
: Update40ColCell
: SW_HIRES
? (SW_DHIRES && SW_80COL)
? UpdateDHiResCell
: UpdateHiResCell
: (SW_DHIRES && SW_80COL)
? UpdateDLoResCell
: UpdateLoResCell;
bool bMixed = (SW_MIXED) ? true : false;
_Video_RedrawScreen( pfUpdate, bMixed );
g_VideoForceFullRedraw = 0;
}
//===========================================================================
void _Video_RedrawScreen( VideoUpdateFuncPtr_t pfUpdate, bool bMixed )
{
LPBYTE addr = g_pFramebufferbits;
LONG pitch = 560;
HDC framedc = FrameGetVideoDC(&addr,&pitch);
CreateFrameOffsetTable(addr,pitch);
BOOL anydirty = 0;
int y = 0;
@ -1909,7 +1930,7 @@ void VideoRefreshScreen () {
int x = 0;
int xpixel = 0;
while (x < 40) {
anydirty |= celldirty[x][y] = update(x,y,xpixel,ypixel,offset+x);
anydirty |= celldirty[x][y] = pfUpdate(x,y,xpixel,ypixel,offset+x);
++x;
xpixel += 14;
}
@ -1917,16 +1938,18 @@ void VideoRefreshScreen () {
ypixel += 16;
}
if (SW_MIXED)
update = SW_80COL ? Update80ColCell
: Update40ColCell;
if( bMixed ) {
pfUpdate = SW_80COL
? Update80ColCell
: Update40ColCell;
}
while (y < 24) {
int offset = ((y & 7) << 7) + ((y >> 3) * 40);
int x = 0;
int xpixel = 0;
while (x < 40) {
anydirty |= celldirty[x][y] = update(x,y,xpixel,ypixel,offset+x);
anydirty |= celldirty[x][y] = pfUpdate(x,y,xpixel,ypixel,offset+x);
++x;
xpixel += 14;
}
@ -1951,7 +1974,7 @@ void VideoRefreshScreen () {
{
FrameReleaseVideoDC();
SetLastDrawnImage();
redrawfull = 0;
g_VideoForceFullRedraw = 0;
return;
}
@ -2041,7 +2064,6 @@ void VideoRefreshScreen () {
FrameReleaseVideoDC();
SetLastDrawnImage();
redrawfull = 0;
}
//===========================================================================
@ -2053,9 +2075,9 @@ void VideoReinitialize () {
//===========================================================================
void VideoResetState () {
g_nAltCharSetOffset = 0;
displaypage2 = 0;
g_bVideoDisplayPage2 = 0;
vidmode = VF_TEXT;
redrawfull = 1;
g_VideoForceFullRedraw = 1;
}
//===========================================================================
@ -2086,7 +2108,7 @@ BYTE __stdcall VideoSetMode (WORD, WORD address, BYTE write, BYTE, ULONG nCycles
vidmode &= ~VF_PAGE2;
if (oldvalue != g_nAltCharSetOffset+(int)(vidmode & ~(VF_MASK2 | VF_PAGE2))) {
graphicsmode = !SW_TEXT;
redrawfull = 1;
g_VideoForceFullRedraw = 1;
}
if (g_bFullSpeed && oldpage2 && !SW_PAGE2) {
static DWORD lasttime = 0;
@ -2098,16 +2120,16 @@ BYTE __stdcall VideoSetMode (WORD, WORD address, BYTE write, BYTE, ULONG nCycles
}
if (oldpage2 != SW_PAGE2) {
static DWORD lastrefresh = 0;
if ((displaypage2 && !SW_PAGE2) || (!behind)) {
displaypage2 = (SW_PAGE2 != 0);
if (!redrawfull) {
if ((g_bVideoDisplayPage2 && !SW_PAGE2) || (!behind)) {
g_bVideoDisplayPage2 = (SW_PAGE2 != 0);
if (!g_VideoForceFullRedraw) {
VideoRefreshScreen();
hasrefreshed = 1;
lastrefresh = emulmsec;
}
}
else if ((!SW_PAGE2) && (!redrawfull) && (emulmsec-lastrefresh >= 20)) {
displaypage2 = 0;
else if ((!SW_PAGE2) && (!g_VideoForceFullRedraw) && (emulmsec-lastrefresh >= 20)) {
g_bVideoDisplayPage2 = 0;
VideoRefreshScreen();
hasrefreshed = 1;
lastrefresh = emulmsec;
@ -2170,7 +2192,7 @@ DWORD VideoSetSnapshot(SS_IO_Video* pSS)
//
graphicsmode = !SW_TEXT;
displaypage2 = (SW_PAGE2 != 0);
g_bVideoDisplayPage2 = (SW_PAGE2 != 0);
return 0;
}

View File

@ -71,6 +71,23 @@ bool VideoGetSW80COL();
DWORD VideoGetSnapshot(SS_IO_Video* pSS);
DWORD VideoSetSnapshot(SS_IO_Video* pSS);
typedef bool (*VideoUpdateFuncPtr_t)(int,int,int,int,int);
extern bool g_bVideoDisplayPage2;
extern bool g_VideoForceFullRedraw;
void _Video_Dirty();
void _Video_RedrawScreen( VideoUpdateFuncPtr_t update, bool bMixed = false );
void _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);
bool UpdateDLoResCell (int x, int y, int xpixel, int ypixel, int offset);
bool UpdateHiResCell (int x, int y, int xpixel, int ypixel, int offset);
bool UpdateDHiResCell (int x, int y, int xpixel, int ypixel, int offset);
extern bool g_bDisplayPrintScreenFileName;
void Video_TakeScreenShot();