diff --git a/Announce.txt b/Announce.txt index 2b0842c70..36765477a 100644 --- a/Announce.txt +++ b/Announce.txt @@ -19,7 +19,7 @@ all of your favorite Atari 2600 games on your PC thanks to Stella! Stella is a multi-platform Atari 2600 VCS emulator. It allows you to play all of your favorite Atari 2600 games again! Stella was originally developed for Linux by Bradford W. Mott, however, it has been ported to a -number of other platforms. +number of other platforms and is currently maintained by Stephen Anthony. This is the 3.0 release of Stella for Linux, Mac OSX and Windows. The distributions currently available are: diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index b46af0169..debfb74dc 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -207,10 +207,14 @@ bool CartDebug::disassemble(const string& autocode, bool force) { // Test current disassembly; don't re-disassemble if it hasn't changed // Also check if the current PC is in the current list + // Note that for now, we don't re-disassemble if the PC isn't in cart + // address space, since Distella doesn't yet support disassembling from + // zero-page RAM and ROM at the same time uInt16 PC = myDebugger.cpuDebug().pc(); int pcline = addressToLine(PC); bool changed = (force || myConsole.cartridge().bankChanged() || - (pcline == -1) || mySystem.isPageDirty(0x1000, 0x1FFF)); + (pcline == -1 && (PC & 0x1000)) || + mySystem.isPageDirty(0x1000, 0x1FFF)); if(changed) { // Look at previous accesses to this bank to begin @@ -278,22 +282,23 @@ int CartDebug::addressToLine(uInt16 address) const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string CartDebug::disassemble(uInt16 start, uInt16 lines) const { - if(!(start & 0x1000)) - return DebuggerParser::red("Disassembly below 0x1000 not yet supported"); - +// if(!(start & 0x1000)) +// return DebuggerParser::red("Disassembly below 0x1000 not yet supported"); +// FIXME DisassemblyList list; DiStella distella(list, start, false); // Fill the string with disassembled data start &= 0xFFF; ostringstream buffer; - for(uInt32 i = 0; i < list.size() && lines > 0; ++i, --lines) + for(uInt32 i = 0; i < list.size() && lines > 0; ++i) { const CartDebug::DisassemblyTag& tag = list[i]; if((tag.address & 0xfff) >= start) { buffer << uppercase << hex << setw(4) << setfill('0') << tag.address << ": " << tag.disasm << " " << tag.bytes << endl; + --lines; } } diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index f1f4e40a7..cf47a980e 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -1511,7 +1511,7 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = { "Disassemble from address (default=pc)", false, false, - { kARG_WORD, kARG_END_ARGS }, + { kARG_WORD, kARG_MULTI_BYTE }, &DebuggerParser::executeDisasm }, diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index b8e0fe5bd..56f6bce62 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -23,25 +23,16 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DiStella::DiStella(CartDebug::DisassemblyList& list, uInt16 start, bool autocode) - : myList(list), - labels(NULL) /* array of information about addresses */ + : myList(list) { while(!myAddressQueue.empty()) myAddressQueue.pop(); - myAppData.start = 0x0; - myAppData.length = 4096; - myAppData.end = 0x0FFF; + myAppData.start = 0x0000; + myAppData.end = 0x0FFF; + myAppData.length = 4096; - /*====================================*/ - /* Allocate memory for "labels" variable */ - labels=(uInt8*) malloc(myAppData.length); - if (labels == NULL) - { - fprintf (stderr, "Malloc failed for 'labels' variable\n"); - return; - } - memset(labels,0,myAppData.length); + memset(labels, 0, 0x1000); /*============================================ The offset is the address where the code segment @@ -88,8 +79,6 @@ DiStella::DiStella(CartDebug::DisassemblyList& list, uInt16 start, // Third pass disasm(myOffset, 3); - - free(labels); /* Free dynamic memory before program ends */ } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -501,6 +490,9 @@ void DiStella::disasm(uInt32 distart, int pass) if (d1 >= 128) ad = d1 - 256; +// uInt16 address = PC + (Int8)operand; + + labfound = mark(myPC+ad+myOffset, REFERENCED); if (pass == 1) { @@ -600,8 +592,8 @@ int DiStella::mark(uInt32 address, MarkType bit) We sweep for hardware/system equates, which are valid addresses, outside the scope of the code/data range. For these, we mark its corresponding hardware/system array element, and return "2" or "3" - (depending on which system/hardware element was accessed). If this - was not the case... + (depending on which system/hardware element was accessed), or "5" + for zero-page RAM. If this was not the case... Next we check if it is a code "mirror". For the 2600, address ranges are limited with 13 bits, so other addresses can exist outside of the @@ -614,6 +606,8 @@ int DiStella::mark(uInt32 address, MarkType bit) =========================================================== $00-$3d = system equates (WSYNC, etc...); mark the array's element with the appropriate bit; return 2. + $0080-$00FF = zero-page RAM; mark the array's element + with the appropriate bit; return 5. $0280-$0297 = system equates (INPT0, etc...); mark the array's element with the appropriate bit; return 3. $1000-$1FFF = CODE/DATA, mark the code/data array for the mirrored address @@ -643,12 +637,16 @@ int DiStella::mark(uInt32 address, MarkType bit) } else if (address >= 0 && address <= 0x3f) { -// reserved[address] = 1; return 2; } +/* This isn't supported by the core code yet, so why waste time checking + else if (address >= 0x80 && address <= 0xff) + { + return 5; + } +*/ else if (address >= 0x280 && address <= 0x297) { -// ioresrvd[address-0x280] = 1; return 3; } else if (address > 0x1000) diff --git a/src/debugger/DiStella.hxx b/src/debugger/DiStella.hxx index eeac13118..a8e73d82f 100644 --- a/src/debugger/DiStella.hxx +++ b/src/debugger/DiStella.hxx @@ -82,16 +82,16 @@ class DiStella CartDebug::DisassemblyList& myList; stringstream myDisasmBuf; queue myAddressQueue; - uInt32 myOffset, myPC, myPCBeg, myPCEnd; + uInt16 myOffset, myPC, myPCBeg, myPCEnd; struct resource { uInt16 start; - uInt32 length; uInt16 end; + uInt16 length; } myAppData; - /* Memory */ - uInt8* labels; + /* Stores info on how each address is marked */ + uInt8 labels[0x1000]; /** Enumeration of the 6502 addressing modes