mirror of https://github.com/stella-emu/stella.git
Optimized Distella in the case of 2K ROMs. Now only half the
address space is shown (either $F000 - $F7FF or $F800 - $FFFF). This eliminates a lot of .byte directives that are invalid in 2K mode anyway, and speeds up the disassembly a little. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2113 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
b81bb187b7
commit
f742f67788
|
@ -261,7 +261,9 @@ bool CartDebug::fillDisassemblyList(AddressList& addresses,
|
|||
|
||||
myDisassembly.list.clear();
|
||||
myDisassembly.fieldwidth = 10 + myLabelLength;
|
||||
DiStella distella(*this, myDisassembly.list, addresses, resolvedata);
|
||||
uInt16 banksize =
|
||||
!BSPF_equalsIgnoreCase(myConsole.cartridge().name(), "Cartridge2K") ? 4 : 2;
|
||||
DiStella distella(*this, myDisassembly.list, addresses, banksize, resolvedata);
|
||||
|
||||
// Parts of the disassembly will be accessed later in different ways
|
||||
// We place those parts in separate maps, to speed up access
|
||||
|
@ -297,7 +299,9 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const
|
|||
Disassembly disasm;
|
||||
AddressList addresses;
|
||||
addresses.push_back(start);
|
||||
DiStella distella(*this, disasm.list, addresses, false);
|
||||
uInt16 banksize =
|
||||
!BSPF_equalsIgnoreCase(myConsole.cartridge().name(), "Cartridge2K") ? 4 : 2;
|
||||
DiStella distella(*this, disasm.list, addresses, banksize, false);
|
||||
|
||||
// Fill the string with disassembled data
|
||||
start &= 0xFFF;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
|
||||
AddressList& addresses, bool resolvedata)
|
||||
AddressList& addresses, uInt16 banksize, bool resolvedata)
|
||||
: myDbg(dbg),
|
||||
myList(list)
|
||||
{
|
||||
|
@ -33,42 +33,53 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
|
|||
while(!myAddressQueue.empty())
|
||||
myAddressQueue.pop();
|
||||
|
||||
/*============================================
|
||||
The offset is the address where the code segment
|
||||
starts. For a 4K game, it is usually 0xf000,
|
||||
which would then have the code data end at 0xffff,
|
||||
but that is not necessarily the case. Because the
|
||||
Atari 2600 only has 13 address lines, it's possible
|
||||
that the "code" can be considered to start in a lot
|
||||
of different places. So, we use the start
|
||||
address as a reference to determine where the
|
||||
offset is, logically-anded to produce an offset
|
||||
that is a multiple of 4K.
|
||||
|
||||
Example:
|
||||
Start address = $D973, so therefore
|
||||
Offset to code = $D000
|
||||
Code range = $D000-$DFFF
|
||||
=============================================*/
|
||||
|
||||
AddressList::iterator it = addresses.begin();
|
||||
uInt16 start = *it++;
|
||||
|
||||
if(start & 0x1000) // ROM space
|
||||
if(start & 0x1000)
|
||||
{
|
||||
myAppData.start = 0x0000;
|
||||
myAppData.end = 0x0FFF;
|
||||
myAppData.length = 4096;
|
||||
if(banksize == 4) // 4K ROM space
|
||||
{
|
||||
/*============================================
|
||||
The offset is the address where the code segment
|
||||
starts. For a 4K game, it is usually 0xf000.
|
||||
|
||||
Example:
|
||||
Start address = $D973, so therefore
|
||||
Offset to code = $D000
|
||||
Code range = $D000-$DFFF
|
||||
=============================================*/
|
||||
myAppData.start = 0x0000;
|
||||
myAppData.end = 0x0FFF;
|
||||
myAppData.length = 4096;
|
||||
|
||||
myOffset = (start - (start % 0x1000));
|
||||
}
|
||||
else // 2K ROM space
|
||||
{
|
||||
/*============================================
|
||||
The offset is the address where the code segment
|
||||
starts. For a 2K game, it is usually 0xf800,
|
||||
but can also be 0xf000.
|
||||
=============================================*/
|
||||
myAppData.start = 0x0000;
|
||||
myAppData.end = 0x07FF;
|
||||
myAppData.length = 2048;
|
||||
|
||||
myOffset = (start & 0xF800);
|
||||
}
|
||||
}
|
||||
else // ZP RAM
|
||||
else // ZP RAM
|
||||
{
|
||||
// For now, we assume all accesses below $1000 are zero-page
|
||||
myAppData.start = 0x0080;
|
||||
myAppData.end = 0x00FF;
|
||||
myAppData.length = 128;
|
||||
}
|
||||
memset(labels, 0, 0x1000);
|
||||
|
||||
myOffset = (start - (start % 0x1000));
|
||||
myOffset = 0;
|
||||
}
|
||||
|
||||
memset(labels, 0, 0x1000);
|
||||
myAddressQueue.push(start);
|
||||
|
||||
if(resolvedata)
|
||||
|
|
|
@ -49,10 +49,11 @@ class DiStella
|
|||
@param dbg The CartDebug instance containing all label information
|
||||
@param list The results of the disassembly are placed here
|
||||
@param addresses The address(es) at which to start disassembly
|
||||
@param banksize Size of the bank in KB (possible values are 4 or 2)
|
||||
@param resolvedata If enabled, try to determine code vs. data sections
|
||||
*/
|
||||
DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
|
||||
AddressList& addresses, bool resolvedata = true);
|
||||
AddressList& addresses, uInt16 banksize = 4, bool resolvedata = true);
|
||||
|
||||
~DiStella();
|
||||
|
||||
|
|
Loading…
Reference in New Issue