mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-12 12:30:31 +00:00
2.6.0.8 Updated: symsrc load "filename" [, offset]
This commit is contained in:
parent
0c80659e03
commit
a83cffb893
104
source/Debug.cpp
104
source/Debug.cpp
@ -4,7 +4,7 @@ AppleWin : An Apple //e emulator for Windows
|
|||||||
Copyright (C) 1994-1996, Michael O'Brien
|
Copyright (C) 1994-1996, Michael O'Brien
|
||||||
Copyright (C) 1999-2001, Oliver Schmidt
|
Copyright (C) 1999-2001, Oliver Schmidt
|
||||||
Copyright (C) 2002-2005, Tom Charlesworth
|
Copyright (C) 2002-2005, Tom Charlesworth
|
||||||
Copyright (C) 2006-2008, Tom Charlesworth, Michael Pohoreski
|
Copyright (C) 2006-2009, Tom Charlesworth, Michael Pohoreski
|
||||||
|
|
||||||
AppleWin is free software; you can redistribute it and/or modify
|
AppleWin is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
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
|
/* Description: Debugger
|
||||||
*
|
*
|
||||||
* Author: Copyright (C) 2006-2008 Michael Pohoreski
|
* Author: Copyright (C) 2006-2009 Michael Pohoreski
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// disable warning C4786: symbol greater than 255 character:
|
// disable warning C4786: symbol greater than 255 character:
|
||||||
@ -38,12 +38,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
// #define DEBUG_ASM_HASH 1
|
// #define DEBUG_ASM_HASH 1
|
||||||
#define ALLOW_INPUT_LOWERCASE 1
|
#define ALLOW_INPUT_LOWERCASE 1
|
||||||
|
|
||||||
// TODO: COLOR RESET
|
|
||||||
// TODO: COLOR SAVE ["filename"]
|
|
||||||
// TODO: COLOR LOAD ["filename"]
|
|
||||||
|
|
||||||
// See Debugger_Changelong.txt for full details
|
// See Debugger_Changelong.txt for full details
|
||||||
const int DEBUGGER_VERSION = MAKE_VERSION(2,6,0,7);
|
const int DEBUGGER_VERSION = MAKE_VERSION(2,6,0,8);
|
||||||
|
|
||||||
|
|
||||||
// Public _________________________________________________________________________________________
|
// Public _________________________________________________________________________________________
|
||||||
@ -891,6 +887,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
bool _CmdSymbolList_Address2Symbol( int nAddress , int bSymbolTables );
|
bool _CmdSymbolList_Address2Symbol( int nAddress , int bSymbolTables );
|
||||||
bool _CmdSymbolList_Symbol2Address( LPCTSTR pSymbol, int bSymbolTables );
|
bool _CmdSymbolList_Symbol2Address( LPCTSTR pSymbol, int bSymbolTables );
|
||||||
|
|
||||||
|
// SymbolOffset
|
||||||
|
int ParseSymbolTable( TCHAR *pFileName, Symbols_e eWhichTableToLoad, int nSymbolOffset = 0 );
|
||||||
|
|
||||||
// Source Level Debugging
|
// Source Level Debugging
|
||||||
static bool BufferAssemblyListing ( char * pFileName );
|
static bool BufferAssemblyListing ( char * pFileName );
|
||||||
static bool ParseAssemblyListing ( bool bBytesToMemory, bool bAddSymbols );
|
static bool ParseAssemblyListing ( bool bBytesToMemory, bool bAddSymbols );
|
||||||
@ -4854,6 +4853,7 @@ Update_t CmdMemorySave (int nArgs)
|
|||||||
BYTE *pDst = pMemory;
|
BYTE *pDst = pMemory;
|
||||||
BYTE *pSrc = mem + nAddressStart;
|
BYTE *pSrc = mem + nAddressStart;
|
||||||
|
|
||||||
|
// memcpy -- copy out of active memory bank
|
||||||
int iByte;
|
int iByte;
|
||||||
for( iByte = 0; iByte < nAddressLen; iByte++ )
|
for( iByte = 0; iByte < nAddressLen; iByte++ )
|
||||||
{
|
{
|
||||||
@ -6345,8 +6345,14 @@ Update_t _CmdSymbolsListTables (int nArgs, int bSymbolTables)
|
|||||||
return ConsoleUpdate();
|
return ConsoleUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Print_Current_Path()
|
||||||
|
{
|
||||||
|
ConsoleDisplayError( g_sProgramDir );
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
int ParseSymbolTable( TCHAR *pFileName, Symbols_e eWhichTableToLoad )
|
int ParseSymbolTable( TCHAR *pFileName, Symbols_e eWhichTableToLoad, int nSymbolOffset )
|
||||||
{
|
{
|
||||||
int nSymbolsLoaded = 0;
|
int nSymbolsLoaded = 0;
|
||||||
|
|
||||||
@ -6365,6 +6371,14 @@ int ParseSymbolTable( TCHAR *pFileName, Symbols_e eWhichTableToLoad )
|
|||||||
sprintf( sFormat2, "%%%ds %%x", MAX_SYMBOLS_LEN ); // i.e. "%13s %x"
|
sprintf( sFormat2, "%%%ds %%x", MAX_SYMBOLS_LEN ); // i.e. "%13s %x"
|
||||||
|
|
||||||
FILE *hFile = fopen(pFileName,"rt");
|
FILE *hFile = fopen(pFileName,"rt");
|
||||||
|
|
||||||
|
if( !hFile )
|
||||||
|
{
|
||||||
|
ConsoleDisplayError( "Symbol File not found:" );
|
||||||
|
Print_Current_Path();
|
||||||
|
nSymbolsLoaded = -1; // HACK: ERROR: FILE NOT EXIST
|
||||||
|
}
|
||||||
|
|
||||||
while(hFile && !feof(hFile))
|
while(hFile && !feof(hFile))
|
||||||
{
|
{
|
||||||
// Support 2 types of symbols files:
|
// Support 2 types of symbols files:
|
||||||
@ -6375,8 +6389,7 @@ int ParseSymbolTable( TCHAR *pFileName, Symbols_e eWhichTableToLoad )
|
|||||||
// . SYMBOL =$0000; Comment
|
// . SYMBOL =$0000; Comment
|
||||||
// . SYMBOL =$FFFF; Comment
|
// . SYMBOL =$FFFF; Comment
|
||||||
//
|
//
|
||||||
DWORD INVALID_ADDRESS = 0xFFFF + 1;
|
DWORD nAddress = _6502_MEM_END + 1; // default to invalid address
|
||||||
DWORD nAddress = INVALID_ADDRESS;
|
|
||||||
char sName[ MAX_SYMBOLS_LEN+1 ] = "";
|
char sName[ MAX_SYMBOLS_LEN+1 ] = "";
|
||||||
|
|
||||||
const int MAX_LINE = 256;
|
const int MAX_LINE = 256;
|
||||||
@ -6398,12 +6411,16 @@ int ParseSymbolTable( TCHAR *pFileName, Symbols_e eWhichTableToLoad )
|
|||||||
p = strstr(szLine, " "); // 1st space between name & value
|
p = strstr(szLine, " "); // 1st space between name & value
|
||||||
int nLen = p - szLine;
|
int nLen = p - szLine;
|
||||||
if (nLen > MAX_SYMBOLS_LEN)
|
if (nLen > MAX_SYMBOLS_LEN)
|
||||||
|
{
|
||||||
memset(&szLine[MAX_SYMBOLS_LEN], ' ', nLen-MAX_SYMBOLS_LEN); // sscanf fails for nAddress if string too long
|
memset(&szLine[MAX_SYMBOLS_LEN], ' ', nLen-MAX_SYMBOLS_LEN); // sscanf fails for nAddress if string too long
|
||||||
|
}
|
||||||
sscanf(szLine, sFormat2, sName, &nAddress);
|
sscanf(szLine, sFormat2, sName, &nAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (nAddress >= INVALID_ADDRESS) || (sName[0] == 0) )
|
// SymbolOffset
|
||||||
|
nAddress += nSymbolOffset;
|
||||||
|
|
||||||
|
if( (nAddress > _6502_MEM_END) || (sName[0] == 0) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
g_aSymbols[ eWhichTableToLoad ] [ (WORD) nAddress ] = sName;
|
g_aSymbols[ eWhichTableToLoad ] [ (WORD) nAddress ] = sName;
|
||||||
@ -6411,7 +6428,9 @@ int ParseSymbolTable( TCHAR *pFileName, Symbols_e eWhichTableToLoad )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hFile)
|
if (hFile)
|
||||||
|
{
|
||||||
fclose(hFile);
|
fclose(hFile);
|
||||||
|
}
|
||||||
|
|
||||||
return nSymbolsLoaded;
|
return nSymbolsLoaded;
|
||||||
}
|
}
|
||||||
@ -6430,6 +6449,8 @@ Update_t CmdSymbolsLoad (int nArgs)
|
|||||||
return ConsoleDisplayError( sFileName );
|
return ConsoleDisplayError( sFileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nSymbols = 0;
|
||||||
|
|
||||||
if (! nArgs)
|
if (! nArgs)
|
||||||
{
|
{
|
||||||
// Default to main table
|
// Default to main table
|
||||||
@ -6444,26 +6465,62 @@ Update_t CmdSymbolsLoad (int nArgs)
|
|||||||
// load user symbols
|
// load user symbols
|
||||||
_tcscat( sFileName, g_sFileNameSymbolsUser );
|
_tcscat( sFileName, g_sFileNameSymbolsUser );
|
||||||
}
|
}
|
||||||
g_nSymbolsLoaded = ParseSymbolTable( sFileName, (Symbols_e) iWhichTable );
|
|
||||||
|
|
||||||
return (UPDATE_DISASM || UPDATE_SYMBOLS);
|
nSymbols = ParseSymbolTable( sFileName, (Symbols_e) iWhichTable );
|
||||||
}
|
}
|
||||||
|
|
||||||
int iArg = 0;
|
int iArg = 1;
|
||||||
while (iArg++ <= nArgs)
|
if (iArg <= nArgs)
|
||||||
{
|
{
|
||||||
TCHAR *pFileName = g_aArgs[ iArg ].sArg;
|
TCHAR *pFileName = NULL;
|
||||||
|
|
||||||
|
if( g_aArgs[ iArg ].bType & TYPE_QUOTED_2 )
|
||||||
|
{
|
||||||
|
pFileName = g_aArgs[ iArg ].sArg;
|
||||||
|
|
||||||
_tcscpy(sFileName,g_sProgramDir);
|
_tcscpy(sFileName,g_sProgramDir);
|
||||||
_tcscat(sFileName, pFileName);
|
_tcscat(sFileName, pFileName);
|
||||||
|
|
||||||
// Remember File ame of symbols loaded
|
// Remember File Name of last symbols loaded
|
||||||
_tcscpy( g_sFileNameSymbolsUser, pFileName );
|
_tcscpy( g_sFileNameSymbolsUser, pFileName );
|
||||||
|
|
||||||
g_nSymbolsLoaded = ParseSymbolTable( sFileName, (Symbols_e) iWhichTable );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (UPDATE_DISASM || UPDATE_SYMBOLS);
|
// SymbolOffset
|
||||||
|
// sym load "filename" [,symbol_offset]
|
||||||
|
int nOffsetAddr = 0;
|
||||||
|
|
||||||
|
iArg++;
|
||||||
|
if( iArg <= nArgs)
|
||||||
|
{
|
||||||
|
if (g_aArgs[ iArg ].eToken == TOKEN_COMMA)
|
||||||
|
{
|
||||||
|
iArg++;
|
||||||
|
if( iArg <= nArgs )
|
||||||
|
{
|
||||||
|
nOffsetAddr = g_aArgs[ iArg ].nValue;
|
||||||
|
if( (nOffsetAddr < _6502_MEM_BEGIN) || (nOffsetAddr > _6502_MEM_END) )
|
||||||
|
{
|
||||||
|
nOffsetAddr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( pFileName )
|
||||||
|
{
|
||||||
|
nSymbols = ParseSymbolTable( sFileName, (Symbols_e) iWhichTable, nOffsetAddr );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( nSymbols > 0 )
|
||||||
|
{
|
||||||
|
g_nSymbolsLoaded = nSymbols;
|
||||||
|
}
|
||||||
|
|
||||||
|
Update_t bUpdateDisplay = UPDATE_DISASM;
|
||||||
|
bUpdateDisplay |= (nSymbols > 0) ? UPDATE_SYMBOLS : 0;
|
||||||
|
|
||||||
|
return bUpdateDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
@ -6672,15 +6729,18 @@ Update_t _CmdSymbolsCommon ( int nArgs, int bSymbolTables )
|
|||||||
if (iParam == PARAM_LOAD)
|
if (iParam == PARAM_LOAD)
|
||||||
{
|
{
|
||||||
nArgs = _Arg_Shift( iArg, nArgs);
|
nArgs = _Arg_Shift( iArg, nArgs);
|
||||||
CmdSymbolsLoad( nArgs );
|
Update_t bUpdate = CmdSymbolsLoad( nArgs );
|
||||||
|
|
||||||
int iTable = _GetSymbolTableFromFlag( bSymbolTables );
|
int iTable = _GetSymbolTableFromFlag( bSymbolTables );
|
||||||
if (iTable != NUM_SYMBOL_TABLES)
|
if (iTable != NUM_SYMBOL_TABLES)
|
||||||
|
{
|
||||||
|
if( bUpdate & UPDATE_SYMBOLS )
|
||||||
{
|
{
|
||||||
wsprintf( sText, " Symbol Table: %s, loaded symbols: %d",
|
wsprintf( sText, " Symbol Table: %s, loaded symbols: %d",
|
||||||
g_aSymbolTableNames[ iTable ], g_nSymbolsLoaded );
|
g_aSymbolTableNames[ iTable ], g_nSymbolsLoaded );
|
||||||
ConsoleBufferPush( sText );
|
ConsoleBufferPush( sText );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ConsoleBufferPush( TEXT(" Error: Unknown Symbol Table Type") );
|
ConsoleBufferPush( TEXT(" Error: Unknown Symbol Table Type") );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user