mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-13 19:29:55 +00:00
new DISASM command to change disassembly view options
This commit is contained in:
parent
85c235ba90
commit
a1aad9460f
@ -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,3,2);
|
||||
const int DEBUGGER_VERSION = MAKE_VERSION(2,5,3,4);
|
||||
|
||||
|
||||
// Public _________________________________________________________________________________________
|
||||
@ -164,6 +164,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
{TEXT("BW") , CmdConfigColorMono , CMD_CONFIG_BW , "Sets/Shows RGB for Black & White scheme" },
|
||||
{TEXT("COLOR") , CmdConfigColorMono , CMD_CONFIG_COLOR , "Sets/Shows RGB for color scheme" },
|
||||
{TEXT("CONFIG") , CmdConfigMenu , CMD_CONFIG_MENU , "Access config options" },
|
||||
{TEXT("DISASM") , CmdConfigDisasm , CMD_CONFIG_DISASM , "Sets disassembly view options." },
|
||||
{TEXT("ECHO") , CmdConfigEcho , CMD_CONFIG_ECHO , "Echo string, or toggle command echoing" },
|
||||
{TEXT("FONT") , CmdConfigFont , CMD_CONFIG_FONT , "Shows current font or sets new one" },
|
||||
{TEXT("HCOLOR") , CmdConfigHColor , CMD_CONFIG_HCOLOR , "Sets/Shows colors mapped to Apple HGR" },
|
||||
@ -523,9 +524,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
// Disassembly
|
||||
bool g_bConfigDisasmOpcodeSpaces = true; // TODO: CONFIG SPACE [0|1]
|
||||
bool g_bConfigDisasmAddressColon = true; // TODO: CONFIG COLON [0|1]
|
||||
int g_iConfigDisasmBranchType = DISASM_BRANCH_FANCY; // TODO: CONFIG BRANCH [0|1]
|
||||
bool g_bConfigDisasmOpcodesView = true;
|
||||
bool g_bConfigDisasmOpcodeSpaces = true;
|
||||
bool g_bConfigDisasmAddressColon = true;
|
||||
int g_iConfigDisasmBranchType = DISASM_BRANCH_FANCY;
|
||||
|
||||
|
||||
// Display ____________________________________________________________________
|
||||
@ -581,6 +583,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
{TEXT("R") , NULL, PARAM_FLAG_R }, // --1- ---- Reserved
|
||||
{TEXT("V") , NULL, PARAM_FLAG_V }, // -1-- ---- Overflow
|
||||
{TEXT("N") , NULL, PARAM_FLAG_N }, // 1--- ---- Sign
|
||||
// Disasm
|
||||
{TEXT("BRANCH") , NULL, PARAM_CONFIG_BRANCH },
|
||||
{TEXT("COLON") , NULL, PARAM_CONFIG_COLON },
|
||||
{TEXT("OPCODE") , NULL, PARAM_CONFIG_OPCODE },
|
||||
{TEXT("SPACES") , NULL, PARAM_CONFIG_SPACES },
|
||||
// Disk
|
||||
{TEXT("EJECT") , NULL, PARAM_DISK_EJECT },
|
||||
{TEXT("PROTECT") , NULL, PARAM_DISK_PROTECT },
|
||||
@ -2079,6 +2086,8 @@ Update_t CmdConfigMenu (int nArgs)
|
||||
nArgs = _Arg_Shift( iArg, nArgs );
|
||||
return CmdConfigLoad( nArgs );
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
{
|
||||
TCHAR sText[ CONSOLE_WIDTH ];
|
||||
@ -2212,6 +2221,70 @@ Update_t CmdConfigSave (int nArgs)
|
||||
}
|
||||
|
||||
|
||||
// Disasm - Config ________________________________________________________________________________
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdConfigDisasm( int nArgs )
|
||||
{
|
||||
int iParam = 0;
|
||||
|
||||
for (int iArg = 1; iArg <= nArgs; iArg++ )
|
||||
{
|
||||
if (FindParam( g_aArgs[iArg].sArg, MATCH_FUZZY, iParam ))
|
||||
{
|
||||
|
||||
// if (_tcscmp( g_aArgs[ iArg ].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName ) == 0)
|
||||
// All -- for saving
|
||||
// g_aArgs[ iArg ]
|
||||
|
||||
switch (iParam)
|
||||
{
|
||||
case PARAM_CONFIG_BRANCH:
|
||||
iArg++;
|
||||
if (iArg > 2)
|
||||
return Help_Arg_1( CMD_CONFIG_DISASM ); // CMD_CONFIG_DISASM_BRANCH );
|
||||
|
||||
|
||||
g_iConfigDisasmBranchType = g_aArgs[ iArg ].nVal1;
|
||||
if (g_iConfigDisasmBranchType < 0)
|
||||
g_iConfigDisasmBranchType = 0;
|
||||
if (g_iConfigDisasmBranchType >= NUM_DISASM_BRANCH_TYPES)
|
||||
g_iConfigDisasmBranchType = NUM_DISASM_BRANCH_TYPES - 1;
|
||||
break;
|
||||
|
||||
case PARAM_CONFIG_COLON:
|
||||
iArg++;
|
||||
if (iArg > 2)
|
||||
return Help_Arg_1( CMD_CONFIG_DISASM ); // CMD_CONFIG_DISASM_COLON );
|
||||
|
||||
g_bConfigDisasmAddressColon = (g_aArgs[ iArg ].nVal1 & 1);
|
||||
break;
|
||||
|
||||
case PARAM_CONFIG_OPCODE:
|
||||
iArg++;
|
||||
if (iArg > 2)
|
||||
return Help_Arg_1( CMD_CONFIG_DISASM ); // CMD_CONFIG_DISASM_OPCODE );
|
||||
|
||||
g_bConfigDisasmOpcodesView = (g_aArgs[ iArg ].nVal1 & 1);
|
||||
break;
|
||||
|
||||
case PARAM_CONFIG_SPACES:
|
||||
iArg++;
|
||||
if (iArg > 2)
|
||||
return Help_Arg_1( CMD_CONFIG_DISASM ); // CMD_CONFIG_DISASM_SPACES );
|
||||
|
||||
g_bConfigDisasmOpcodeSpaces = (g_aArgs[ iArg ].nVal1 & 1);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return Help_Arg_1( CMD_CONFIG_DISASM ); // CMD_CONFIG_DISASM_OPCODE );
|
||||
}
|
||||
}
|
||||
}
|
||||
return UPDATE_CONSOLE_DISPLAY | UPDATE_DISASM;
|
||||
}
|
||||
|
||||
// Font - Config __________________________________________________________________________________
|
||||
|
||||
|
||||
|
@ -50,11 +50,10 @@ using namespace std;
|
||||
extern const int WINDOW_DATA_BYTES_PER_LINE;
|
||||
|
||||
// Disassembly
|
||||
extern int g_iConfigDisasmBranchType;
|
||||
|
||||
extern bool g_bConfigDisasmOpcodeSpaces ;//= true; // TODO: CONFIG DISASM SPACE [0|1]
|
||||
extern bool g_bConfigDisasmAddressColon ;//= true; // TODO: CONFIG DISASM COLON [0|1]
|
||||
extern bool g_bConfigDisasmFancyBranch ;//= true; // TODO: CONFIG DISASM BRANCH [0|1]
|
||||
extern bool g_bConfigDisasmOpcodesView ;//= true; // TODO: CONFIG {DISASM} OPCODES [0|1]
|
||||
extern bool g_bConfigDisasmOpcodeSpaces ;//= true; // TODO: CONFIG {DISASM} SPACE [0|1]
|
||||
extern bool g_bConfigDisasmAddressColon ;//= true; // TODO: CONFIG {DISASM} COLON [0|1]
|
||||
extern int g_iConfigDisasmBranchType ;//DISASM_BRANCH_FANCY; // TODO: CONFIG {DISASM} BRANCH [0|1|2]
|
||||
|
||||
// Display
|
||||
extern bool g_bDebuggerViewingAppleOutput;
|
||||
|
@ -430,8 +430,8 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB
|
||||
if (g_bConfigDisasmOpcodeSpaces)
|
||||
{
|
||||
_tcscat( pDst, TEXT(" " ) );
|
||||
pDst++; // 2.5.3.3 fix
|
||||
}
|
||||
pDst++;
|
||||
}
|
||||
while (_tcslen(sOpCodes_) < nMinBytesLen)
|
||||
{
|
||||
@ -822,11 +822,54 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text)
|
||||
//> ^ ^ ^ ^ ^
|
||||
//> 6 17 27 41 46
|
||||
const int nDefaultFontWidth = 7; // g_aFontConfig[FONT_DISASM_DEFAULT]._nFontWidth or g_nFontWidthAvg
|
||||
int X_OPCODE = 6 * nDefaultFontWidth;
|
||||
int X_LABEL = 17 * nDefaultFontWidth;
|
||||
int X_INSTRUCTION = 26 * nDefaultFontWidth; // 27
|
||||
int X_IMMEDIATE = 40 * nDefaultFontWidth; // 41
|
||||
int X_BRANCH = 46 * nDefaultFontWidth;
|
||||
|
||||
|
||||
enum TabStop_e
|
||||
{
|
||||
TS_OPCODE
|
||||
, TS_LABEL
|
||||
, TS_INSTRUCTION
|
||||
, TS_IMMEDIATE
|
||||
, TS_BRANCH
|
||||
, _NUM_TAB_STOPS
|
||||
};
|
||||
|
||||
int aTabs[ _NUM_TAB_STOPS ] =
|
||||
{ 6, 16, 26, 40, 46 }; // 17, 27, 41
|
||||
|
||||
if (! g_bConfigDisasmAddressColon)
|
||||
{
|
||||
aTabs[ TS_OPCODE ] -= 1;
|
||||
}
|
||||
|
||||
if ((g_bConfigDisasmOpcodesView) && (! g_bConfigDisasmOpcodeSpaces))
|
||||
{
|
||||
aTabs[ TS_LABEL ] -= 3;
|
||||
aTabs[ TS_INSTRUCTION ] -= 2;
|
||||
aTabs[ TS_IMMEDIATE ] -= 1;
|
||||
}
|
||||
|
||||
const int OPCODE_TO_LABEL_SPACE = aTabs[ TS_INSTRUCTION ] - aTabs[ TS_LABEL ];
|
||||
|
||||
int iTab = 0;
|
||||
int nSpacer = 9;
|
||||
for (iTab = 0; iTab < _NUM_TAB_STOPS; iTab++ )
|
||||
{
|
||||
if (! g_bConfigDisasmOpcodesView)
|
||||
{
|
||||
aTabs[ iTab ] -= nSpacer;
|
||||
if (nSpacer > 0)
|
||||
nSpacer -= 2;
|
||||
}
|
||||
|
||||
aTabs[ iTab ] *= nDefaultFontWidth;
|
||||
}
|
||||
|
||||
// int X_OPCODE = 6 * nDefaultFontWidth;
|
||||
// int X_LABEL = 17 * nDefaultFontWidth;
|
||||
// int X_INSTRUCTION = 26 * nDefaultFontWidth; // 27
|
||||
// int X_IMMEDIATE = 40 * nDefaultFontWidth; // 41
|
||||
// int X_BRANCH = 46 * nDefaultFontWidth;
|
||||
|
||||
const int DISASM_SYMBOL_LEN = 9;
|
||||
|
||||
@ -929,16 +972,18 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text)
|
||||
DebugDrawTextHorz( TEXT(":"), linerect );
|
||||
|
||||
// Opcodes
|
||||
linerect.left = X_OPCODE;
|
||||
linerect.left = aTabs[ TS_OPCODE ];
|
||||
|
||||
if (! bCursorLine)
|
||||
SetTextColor( dc, DebuggerGetColor( FG_DISASM_OPCODE ) );
|
||||
// DebugDrawTextHorz( TEXT(" "), linerect );
|
||||
DebugDrawTextHorz( (LPCTSTR) sOpcodes, linerect );
|
||||
|
||||
if (g_bConfigDisasmOpcodesView)
|
||||
DebugDrawTextHorz( (LPCTSTR) sOpcodes, linerect );
|
||||
// DebugDrawTextHorz( TEXT(" "), linerect );
|
||||
|
||||
// Label
|
||||
linerect.left = X_LABEL;
|
||||
linerect.left = aTabs[ TS_LABEL ];
|
||||
|
||||
LPCSTR pSymbol = FindSymbolFromAddress( nBaseAddress );
|
||||
if (pSymbol)
|
||||
@ -951,7 +996,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text)
|
||||
// DebugDrawTextHorz( TEXT(" "), linerect );
|
||||
|
||||
// Instruction
|
||||
linerect.left = X_INSTRUCTION;
|
||||
linerect.left = aTabs[ TS_INSTRUCTION ];
|
||||
|
||||
if (! bCursorLine)
|
||||
SetTextColor( dc, DebuggerGetColor( iForeground ) );
|
||||
@ -1044,7 +1089,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text)
|
||||
}
|
||||
|
||||
// Immediate Char
|
||||
linerect.left = X_IMMEDIATE;
|
||||
linerect.left = aTabs[ TS_IMMEDIATE ];
|
||||
|
||||
// Memory Pointer and Value
|
||||
if (bDisasmFormatFlags & DISASM_TARGET_POINTER) // (bTargetValue)
|
||||
@ -1106,7 +1151,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text)
|
||||
// }
|
||||
|
||||
// Branch Indicator
|
||||
linerect.left = X_BRANCH;
|
||||
linerect.left = aTabs[ TS_BRANCH ];
|
||||
|
||||
if (bDisasmFormatFlags & DISASM_BRANCH_INDICATOR)
|
||||
{
|
||||
|
@ -450,6 +450,12 @@ Update_t CmdHelpSpecific (int nArgs)
|
||||
ConsoleBufferPush( TEXT(" Re-enables breakpoint previously set, or all.") );
|
||||
break;
|
||||
// Config - Color
|
||||
case CMD_CONFIG_MENU:
|
||||
ConsoleBufferPush( TEXT(" Load/Save configuration, or change disasm view options.\n" ) );
|
||||
wsprintf( sText, TEXT(" %s" ": Loads config from last/default \"filename\"" ), g_aParameters[ PARAM_SAVE ].m_sName ); ConsoleBufferPush( sText );
|
||||
wsprintf( sText, TEXT(" %s" ": Saves config to \"filename\"" ), g_aParameters[ PARAM_LOAD ].m_sName ); ConsoleBufferPush( sText );
|
||||
break;
|
||||
|
||||
case CMD_CONFIG_COLOR:
|
||||
ConsoleBufferPush( TEXT(" Usage: [{#} | {# RR GG BB}]" ) );
|
||||
ConsoleBufferPush( TEXT(" 0 params: switch to 'color' scheme" ) );
|
||||
@ -466,6 +472,30 @@ Update_t CmdHelpSpecific (int nArgs)
|
||||
ConsoleBufferPush( TEXT(" Usage: {address8 | address16 | symbol} ## [##]") );
|
||||
ConsoleBufferPush( TEXT(" Ouput a byte or word to the IO address $C0xx" ) );
|
||||
break;
|
||||
// Config - Diasm
|
||||
case CMD_CONFIG_DISASM:
|
||||
ConsoleBufferPush( TEXT("Note: All commands effect the disassembly view" ) );
|
||||
|
||||
wsprintf( sText, TEXT(" Usage: %s [#]" ), g_aParameters[ PARAM_CONFIG_BRANCH ].m_sName );
|
||||
ConsoleBufferPush( sText );
|
||||
wsprintf( sText, TEXT(" # is from 0 to %d\n"), NUM_DISASM_BRANCH_TYPES - 1 );
|
||||
ConsoleBufferPush( sText );
|
||||
ConsoleBufferPush( TEXT(" Set the type of branch character:" ) );
|
||||
ConsoleBufferPush( TEXT(" 0 none, 1 = plain, 2 = fancy" ) );
|
||||
|
||||
wsprintf( sText, TEXT(" Usage: %s [0|1]" ), g_aParameters[ PARAM_CONFIG_COLON ].m_sName );
|
||||
ConsoleBufferPush( sText );
|
||||
ConsoleBufferPush( TEXT(" Display a colon after the address" ) );
|
||||
|
||||
wsprintf( sText, TEXT(" Usage: %s [0|1]" ), g_aParameters[ PARAM_CONFIG_OPCODE ].m_sName );
|
||||
ConsoleBufferPush( sText );
|
||||
ConsoleBufferPush( TEXT(" Display opcode(s) after colon" ) );
|
||||
|
||||
wsprintf( sText, TEXT(" Usage: %s [0|1]" ), g_aParameters[ PARAM_CONFIG_SPACES ].m_sName );
|
||||
ConsoleBufferPush( sText );
|
||||
ConsoleBufferPush( TEXT(" Display spaces between opcodes" ) );
|
||||
break;
|
||||
|
||||
// Config - Font
|
||||
case CMD_CONFIG_FONT:
|
||||
wsprintf( sText, TEXT(" Usage: [%s | %s] \"FontName\" [Height]" ),
|
||||
|
@ -429,6 +429,13 @@
|
||||
, CMD_CONFIG_BW // BW # rr gg bb
|
||||
, CMD_CONFIG_COLOR // COLOR # rr gg bb
|
||||
, CMD_CONFIG_MENU
|
||||
|
||||
, CMD_CONFIG_DISASM
|
||||
// , CMD_CONFIG_DISASM_BRANCH
|
||||
// , CMD_CONFIG_DISASM_COLON
|
||||
// , CMD_CONFIG_DISASM_OPCODE
|
||||
// , CMD_CONFIG_DISASM_SPACES
|
||||
|
||||
, CMD_CONFIG_ECHO
|
||||
, CMD_CONFIG_FONT
|
||||
// , CMD_CONFIG_FONT2 // PARAM_FONT_DISASM PARAM_FONT_INFO PARAM_FONT_SOURCE
|
||||
@ -636,6 +643,7 @@
|
||||
Update_t CmdConfigBaseHex (int nArgs);
|
||||
Update_t CmdConfigBaseDec (int nArgs);
|
||||
Update_t CmdConfigColorMono (int nArgs);
|
||||
Update_t CmdConfigDisasm (int nArgs);
|
||||
Update_t CmdConfigEcho (int nArgs);
|
||||
Update_t CmdConfigFont (int nArgs);
|
||||
Update_t CmdConfigHColor (int nArgs);
|
||||
@ -1108,13 +1116,13 @@
|
||||
|
||||
// Note: Order must match Breakpoint_Source_t
|
||||
, _PARAM_REGS_BEGIN = _PARAM_BREAKPOINT_END // Daisy Chain
|
||||
// Regs
|
||||
, PARAM_REG_A = _PARAM_REGS_BEGIN
|
||||
, PARAM_REG_X
|
||||
, PARAM_REG_Y
|
||||
|
||||
, PARAM_REG_PC // Program Counter
|
||||
, PARAM_REG_SP // Stack Pointer
|
||||
|
||||
// Flags
|
||||
, PARAM_FLAGS // Processor Status
|
||||
, PARAM_FLAG_C // Carry
|
||||
, PARAM_FLAG_Z // Zero
|
||||
@ -1127,7 +1135,17 @@
|
||||
, _PARAM_REGS_END
|
||||
, PARAM_REGS_NUM = _PARAM_REGS_END - _PARAM_REGS_BEGIN
|
||||
|
||||
, _PARAM_DISK_BEGIN = _PARAM_REGS_END // Daisy Chain
|
||||
// Disasm
|
||||
, _PARAM_CONFIG_BEGIN = _PARAM_REGS_END // Daisy Chain
|
||||
, PARAM_CONFIG_BRANCH = _PARAM_CONFIG_BEGIN // g_iConfigDisasmBranchType [0|1|2]
|
||||
, PARAM_CONFIG_COLON // g_bConfigDisasmAddressColon [0|1]
|
||||
, PARAM_CONFIG_OPCODE // g_bConfigDisasmOpcodesView [0|1]
|
||||
, PARAM_CONFIG_SPACES // g_bConfigDisasmOpcodeSpaces [0|1]
|
||||
, _PARAM_CONFIG_END
|
||||
, PARAM_CONFIG_NUM = _PARAM_CONFIG_END - _PARAM_CONFIG_BEGIN
|
||||
|
||||
// Disk
|
||||
, _PARAM_DISK_BEGIN = _PARAM_CONFIG_END // Daisy Chain
|
||||
, PARAM_DISK_EJECT = _PARAM_DISK_BEGIN // DISK 1 EJECT
|
||||
, PARAM_DISK_PROTECT // DISK 1 PROTECT
|
||||
, PARAM_DISK_READ // DISK 1 READ Track Sector NumSectors MemAddress
|
||||
|
Loading…
x
Reference in New Issue
Block a user