Added a new directive called PGFX, used for playfield graphics (the

previously defined GFX directive is now used for player graphics
only).  The 6502 core tracks each of these separately, which provides
for more accurate disassembly.

Modified debugger font and disassembler to show GFX and PGFX with
special characters, instead of using 'X' as Distella does.  This also
allows gives much more informative disassembled outout.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2156 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-10-21 17:46:23 +00:00
parent 7411867290
commit 0388ab89e5
6 changed files with 105 additions and 32 deletions

View File

@ -68,8 +68,9 @@ class CartDebug : public DebuggerSystem
SKIP = 1 << 2, // TODO - document this
CODE = 1 << 3, // disassemble-able code segments
GFX = 1 << 4, // addresses loaded into GRPx registers
DATA = 1 << 5, // addresses loaded into registers other than GRPx
ROW = 1 << 6 // all other addresses
PGFX = 1 << 5, // addresses loaded into PFx registers
DATA = 1 << 6, // addresses loaded into registers other than GRPx / PFx
ROW = 1 << 7 // all other addresses
};
struct DisassemblyTag {
DisasmType type;

View File

@ -154,7 +154,8 @@ cerr << "(emul) marking " << HEX4 << (codeAccessPoint+myOffset) << " as CODE\n";
for (int k = 0; k <= myAppData.end; k++)
{
if (!check_bit(k, CartDebug::SKIP|CartDebug::CODE|CartDebug::GFX|CartDebug::DATA))
if (!check_bit(k, CartDebug::SKIP|CartDebug::CODE|CartDebug::GFX|
CartDebug::PGFX|CartDebug::DATA))
mark(k+myOffset, CartDebug::ROW);
}
}
@ -190,7 +191,7 @@ void DiStella::disasm(uInt32 distart, int pass)
myPC = distart - myOffset;
while(myPC <= myAppData.end)
{
if(check_bit(myPC, CartDebug::GFX) && !check_bit(myPC, CartDebug::CODE))
if(check_bit(myPC, CartDebug::GFX|CartDebug::PGFX) && !check_bit(myPC, CartDebug::CODE))
{
if (pass == 2)
mark(myPC+myOffset, CartDebug::VALID_ENTRY);
@ -201,10 +202,11 @@ void DiStella::disasm(uInt32 distart, int pass)
else
myDisasmBuf << HEX4 << myPC+myOffset << "' '";
const string& bit_string = check_bit(myPC, CartDebug::GFX) ? "\x7f" : "\x80";
uInt8 byte = Debugger::debugger().peek(myPC+myOffset);
myDisasmBuf << ".byte $" << HEX2 << (int)byte << " |";
for(uInt8 i = 0, c = byte; i < 8; ++i, c <<= 1)
myDisasmBuf << ((c > 127) ? "X" : " ");
myDisasmBuf << ((c > 127) ? bit_string : " ");
myDisasmBuf << "| $" << HEX4 << myPC+myOffset << "'";
if(settings.gfx_format == kBASE_2)
myDisasmBuf << Debugger::to_bin_8(byte);
@ -215,7 +217,7 @@ void DiStella::disasm(uInt32 distart, int pass)
myPC++;
}
else if (check_bit(myPC, CartDebug::DATA) &&
!check_bit(myPC, CartDebug::CODE|CartDebug::GFX))
!check_bit(myPC, CartDebug::CODE|CartDebug::GFX|CartDebug::PGFX))
{
if (pass == 2)
mark(myPC+myOffset, CartDebug::VALID_ENTRY);
@ -235,7 +237,7 @@ void DiStella::disasm(uInt32 distart, int pass)
myPC++;
}
else if (check_bit(myPC, CartDebug::ROW) &&
!check_bit(myPC, CartDebug::CODE|CartDebug::DATA|CartDebug::GFX))
!check_bit(myPC, CartDebug::CODE|CartDebug::DATA|CartDebug::GFX|CartDebug::PGFX))
{
mark(myPC+myOffset, CartDebug::VALID_ENTRY);
if (pass == 3)
@ -247,7 +249,7 @@ void DiStella::disasm(uInt32 distart, int pass)
myPC++;
while (check_bit(myPC, CartDebug::ROW) &&
!check_bit(myPC, CartDebug::CODE|CartDebug::DATA|CartDebug::GFX)
!check_bit(myPC, CartDebug::CODE|CartDebug::DATA|CartDebug::GFX|CartDebug::PGFX)
&& pass == 3 && myPC <= myAppData.end)
{
bytes++;
@ -886,6 +888,7 @@ void DiStella::addEntry(CartDebug::DisasmType type)
getline(myDisasmBuf, tag.bytes);
break;
case CartDebug::GFX:
case CartDebug::PGFX:
getline(myDisasmBuf, tag.disasm, '\'');
getline(myDisasmBuf, tag.bytes);
break;

View File

@ -30,6 +30,7 @@
#define DISASM_SKIP CartDebug::SKIP
#define DISASM_CODE CartDebug::CODE
#define DISASM_GFX CartDebug::GFX
#define DISASM_PGFX CartDebug::PGFX
#define DISASM_DATA CartDebug::DATA
#define DISASM_ROW CartDebug::ROW
#define DISASM_NONE 0
@ -38,6 +39,7 @@
#define DISASM_SKIP 0
#define DISASM_CODE 0
#define DISASM_GFX 0
#define DISASM_PGFX 0
#define DISASM_DATA 0
#define DISASM_ROW 0
#define DISASM_NONE 0

View File

@ -14,7 +14,7 @@
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: M6502.m4 2152 2010-10-11 23:06:37Z stephena $
// $Id: M6502.m4 2153 2010-10-11 23:32:37Z stephena $
//============================================================================
/**
@ -24,7 +24,7 @@
'm4 M6502.m4 > M6502.ins'
@author Bradford W. Mott
@version $Id: M6502.m4 2152 2010-10-11 23:06:37Z stephena $
@version $Id: M6502.m4 2153 2010-10-11 23:32:37Z stephena $
*/
#ifndef NOTSAMEPAGE
@ -50,10 +50,10 @@
#ifndef CHECK_GFX_WRITE
#ifdef DEBUGGER_SUPPORT
#define CHECK_GFX_WRITE(_addr) \
if((operandAddress == 0x1B || operandAddress == 0x1C || \
operandAddress == 0x0D || operandAddress == 0x0E || operandAddress == 0x0F) && \
_addr) \
mySystem->setAddressDisasmType(_addr, DISASM_GFX);
if((operandAddress == 0x1B || operandAddress == 0x1C) && _addr) \
mySystem->setAddressDisasmType(_addr, DISASM_GFX); \
else if((operandAddress == 0x0D || operandAddress == 0x0E || operandAddress == 0x0F) && _addr) \
mySystem->setAddressDisasmType(_addr, DISASM_PGFX);
#else
#define CHECK_GFX_WRITE(_addr)
#endif

View File

@ -50,10 +50,10 @@
#ifndef CHECK_GFX_WRITE
#ifdef DEBUGGER_SUPPORT
#define CHECK_GFX_WRITE(_addr) \
if((operandAddress == 0x1B || operandAddress == 0x1C || \
operandAddress == 0x0D || operandAddress == 0x0E || operandAddress == 0x0F) && \
_addr) \
mySystem->setAddressDisasmType(_addr, DISASM_GFX);
if((operandAddress == 0x1B || operandAddress == 0x1C) && _addr) \
mySystem->setAddressDisasmType(_addr, DISASM_GFX); \
else if((operandAddress == 0x0D || operandAddress == 0x0E || operandAddress == 0x0F) && _addr) \
mySystem->setAddressDisasmType(_addr, DISASM_PGFX);
#else
#define CHECK_GFX_WRITE(_addr)
#endif

View File

@ -34,7 +34,7 @@ namespace GUI {
ascent: 11
descent: 2
first char: 0 (0x00)
last char: 126 (0x7e)
last char: 128 (0x80)
default char: 0 (0x00)
proportional: no
Public domain font. Share and enjoy.
@ -3114,6 +3114,70 @@ static const uInt16 _console_font_bits[] = {
0x0000,
0x0000,
0x0000,
/* Character 127 (0x7f): large centered ellipse
width 8
+--------+
| |
| |
| **** |
| ****** |
| ****** |
| ****** |
| ****** |
| ****** |
| ****** |
| ****** |
| **** |
| |
| |
+--------+
*/
0x0000,
0x0000,
0x3c00,
0x7e00,
0x7e00,
0x7e00,
0x7e00,
0x7e00,
0x7e00,
0x7e00,
0x3c00,
0x0000,
0x0000,
/* Character 128 (0x80): large centered circle
width 8
+--------+
| |
| |
| |
| |
| **** |
| ****** |
| ****** |
| ****** |
| **** |
| |
| |
| |
| |
+--------+
*/
0x0000,
0x0000,
0x0000,
0x0000,
0x3c00,
0x7e00,
0x7e00,
0x7e00,
0x3c00,
0x0000,
0x0000,
0x0000,
0x0000
};
/* Character->glyph mapping. */
@ -3245,22 +3309,25 @@ static const uInt32 _console_sysfont_offset[] = {
1209, /* (0x7c) */
1222, /* (0x7d) */
1235, /* (0x7e) */
1248, /* (0x7f) */
1261, /* (0x80) */
};
static const FontDesc consoleDesc = {
"8x13",
8,
13,
8, 13, 0, -1,
11,
0,
127,
_console_font_bits,
_console_sysfont_offset, /* encode table */
0, /* fixed width*/
0,
0,
sizeof(_console_font_bits)/sizeof(uInt16)
"8x13", /* font name */
8, /* max width in pixels */
13, /* height in pixels */
8, 13, 0, -1, /* max bounding box */
11, /* ascent (baseline) height */
0, /* first character in bitmap */
129, /* font size in glyphs */
_console_font_bits, /* 16-bit right-padded bitmap data */
_console_sysfont_offset, /* offsets into bitmap data*/
0, /* fixed width*/ /* character widths or NULL if fixed */
0, /* character bounding box or NULL if fixed */
0, /* default char (not glyph index) */
sizeof(_console_font_bits)/sizeof(uInt16) /* # words of bitmap_t bits */
};
} // End of namespace GUI