2005-09-13 18:27:42 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
2019-08-12 07:51:43 +00:00
|
|
|
<title>Stella Debugger</title>
|
2020-01-18 12:47:15 +00:00
|
|
|
<style>
|
|
|
|
table, th, td {
|
|
|
|
border: 1px solid;
|
|
|
|
padding: 4px;
|
|
|
|
padding-left: 8px;
|
|
|
|
padding-right: 8px;
|
|
|
|
border-collapse: collapse;
|
|
|
|
}
|
|
|
|
</style>
|
2005-09-13 18:27:42 +00:00
|
|
|
</head>
|
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<body>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<center><b><font size="7">Stella</font></b></center>
|
2021-04-17 17:29:16 +00:00
|
|
|
<center><h4><b>Release 6.5.3</b></h4></center>
|
2017-12-04 10:02:36 +00:00
|
|
|
<center><h1><b>Integrated Debugger</b></h1></center>
|
|
|
|
<center><h4><b>(a work in progress)</b></h4></center>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<h2>Contents</h2>
|
2017-12-07 08:45:31 +00:00
|
|
|
<ul>
|
2017-12-04 10:02:36 +00:00
|
|
|
<li><a href="#Features">Features</a></li>
|
|
|
|
<li><a href="#HowToDebugger">How to use the Debugger</a>
|
|
|
|
<ul>
|
2017-12-04 17:06:40 +00:00
|
|
|
<li><a href="#Startup">Startup</a></li>
|
2017-12-04 10:02:36 +00:00
|
|
|
<li><a href="#GlobalButtons">Global Buttons</a></li>
|
|
|
|
<li><a href="#ChangeTracking">Change Tracking</a></li>
|
|
|
|
<li><a href="#PromptTab">Prompt Tab</a>
|
|
|
|
<ul>
|
|
|
|
<li><a href="#TabCompletion">Tab Key Auto-Complete</a></li>
|
|
|
|
<li><a href="#Expressions">Expressions</a></li>
|
|
|
|
<ul>
|
|
|
|
<li><a href="#Prefixes">Prefixes</a></li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<li><a href="#BreakpointsEtc">Breakpoints, watches and traps, oh my!</a>
|
|
|
|
<ul>
|
|
|
|
<li><a href="#Breakpoints">Breakpoints</a></li>
|
|
|
|
<li><a href="#ConditionalBreaks">Conditional Breaks</a></li>
|
|
|
|
<li><a href="#Functions">Functions</a></li>
|
|
|
|
<li><a href="#BuiltInFunctions">Built-in Functions</a></li>
|
|
|
|
<li><a href="#PseudoRegisters">Pseudo-Registers</a></li>
|
|
|
|
<li><a href="#Watches">Watches</a></li>
|
|
|
|
<li><a href="#Traps">Traps</a></li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<li><a href="#SaveWork">Save your work!</a></li>
|
2017-12-05 10:03:12 +00:00
|
|
|
<li><a href="#PromptCommands">Prompt Commands</a></li>
|
2017-12-04 10:02:36 +00:00
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<li><a href="#IOTab">I/O Tab</a></li>
|
|
|
|
<li><a href="#AudioTab">Audio Tab</a></li>
|
|
|
|
<li><a href="#TIADisplay">TIA Display</a></li>
|
2017-12-04 18:57:22 +00:00
|
|
|
<li><a href="#TIAInfo">TIA Information</a></li>
|
2017-12-04 10:02:36 +00:00
|
|
|
<li><a href="#TIAZoom">TIA Zoom</a></li>
|
|
|
|
<li><a href="#BreakpointStatus">Breakpoint/Trap Status</a></li>
|
|
|
|
<li><a href="#CPURegisters">CPU Registers</a></li>
|
|
|
|
<li><a href="#DataOpButtons">Data Operations Buttons</a></li>
|
|
|
|
<li><a href="#M6532">M6532/RIOT RAM</a></li>
|
|
|
|
<ul>
|
|
|
|
<li><a href="#M6532Search">M6532/RIOT RAM (search/compare mode)</a></li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<li><a href="#Disassembly">ROM Disassembly</a>
|
|
|
|
<ul>
|
2017-12-04 13:17:54 +00:00
|
|
|
<li><a href="#DisassemblySettings">ROM Disassembly Settings</a></li>
|
2017-12-04 10:02:36 +00:00
|
|
|
<li><a href="#Limitations">Limitations</a></li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<li><a href="#BankswitchInformation">Detailed Bankswitch Information</a></li>
|
|
|
|
<li><a href="#CartridgeRAMInformation">Detailed Cartridge Extended RAM Information</a></li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
2020-08-27 06:53:14 +00:00
|
|
|
<li><a href="#DistellaConfiguration">DiStella Configuration Files</a></li>
|
2017-12-04 10:02:36 +00:00
|
|
|
<li><a href="#Howtohack">Tutorial: How to hack a ROM</a></li>
|
|
|
|
</li>
|
2017-12-07 08:45:31 +00:00
|
|
|
</ul>
|
2017-12-04 10:02:36 +00:00
|
|
|
<br>
|
|
|
|
|
|
|
|
<h1><a name="Features">Features</a></h1>
|
2005-09-13 18:27:42 +00:00
|
|
|
<p>The debugger in Stella may never be complete, as we're constantly
|
2017-12-02 10:34:58 +00:00
|
|
|
adding new features requested by homebrew developers. However, even in its
|
2005-09-13 18:27:42 +00:00
|
|
|
current form it's still quite powerful, and is able to boast at least one
|
|
|
|
feature that no other 2600 debugger has; it's <b>completely</b> cross-platform.</p>
|
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<p>Here's a (non-comprehensive) list of what the debugger can do so far:</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
<ul>
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Display registers and memory.</li>
|
2010-04-08 13:11:36 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Dump state of TIA and RIOT, with things like joystick directions and
|
|
|
|
NUSIZx decoded into English (more-or-less).</li>
|
2010-04-08 13:11:36 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Change registers/memory, including toggles for flags in P register.</li>
|
2010-04-08 13:11:36 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Single step/trace.</li>
|
2010-04-08 13:11:36 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Breakpoints - break running program and enter debugger when the
|
|
|
|
Program Counter hits a predefined address; you can set as many
|
|
|
|
breakpoints as you want.</li>
|
2010-04-08 13:11:36 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Conditional breakpoints - Break running program when some arbitrary
|
2021-05-07 21:13:28 +00:00
|
|
|
condition is true (e.g. "breakIf {a == $7f && c}" will break when the Accumulator value is $7f and the Carry flag is true, no matter where
|
2019-08-12 07:51:43 +00:00
|
|
|
in the program this happens). Unlike the cond breaks in PCAE, Stella's
|
|
|
|
are *fast*: the emulation will run at full speed unless you use lots
|
2021-05-07 21:13:28 +00:00
|
|
|
of breakIf's at the same time, or have a slow CPU.</li>
|
2010-04-08 13:11:36 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Watches - View contents of a location/register before every
|
|
|
|
debugger prompt.</li>
|
2010-04-08 13:11:36 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Traps - Like breakpoints, but break on read/write/any access to
|
|
|
|
*any* memory location. Traps can also be combined with conditions to
|
2017-12-04 10:02:36 +00:00
|
|
|
become conditional traps.</li>
|
2010-04-08 13:11:36 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Frame advance (automatic breakpoint at beginning of next frame)
|
|
|
|
You can advance multiple frames with one command.</li>
|
2010-04-08 13:11:36 +00:00
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<li>Rewind previous advance operations and undo rewinds.</li>
|
|
|
|
|
2020-08-27 06:53:14 +00:00
|
|
|
<li>Supports DiStella 'configuration directives', which may be used to
|
2017-12-02 10:34:58 +00:00
|
|
|
override automatic code/data determination in the disassembly. For now,
|
2020-03-29 10:30:26 +00:00
|
|
|
the following directives are supported: CODE, GFX, PGFX, COL, PCOL, BCOL, AUD, DATA, ROW.
|
|
|
|
These directives can be entered at the debugger prompt, or be (automatically)
|
2010-11-10 22:38:16 +00:00
|
|
|
loaded and saved in configuration files.</li>
|
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Extensive disassembly support, both from the emulation core and with help
|
2020-08-27 06:53:14 +00:00
|
|
|
from DiStella. Where possible, the disassembly differentiates between code,
|
2020-03-29 10:30:26 +00:00
|
|
|
player and playfield graphics, colors and audio (ie, addresses stored in
|
|
|
|
GRPx, PFx, COLUxx, AUDxx)
|
2017-12-02 10:34:58 +00:00
|
|
|
and data (addresses used as an operand of a command). Code sections are also
|
2010-11-10 22:38:16 +00:00
|
|
|
differentiated between actual code, and 'tentative' code (ie, areas that may
|
2017-12-02 10:34:58 +00:00
|
|
|
represent code sections, but haven't actually been executed yet). Such
|
2010-11-10 22:38:16 +00:00
|
|
|
tentative code is marked with a '*' symbol.</li>
|
|
|
|
|
|
|
|
<li>Supports visual representation of the bitmap data of graphics areas,
|
|
|
|
as well as the ability to directly edit these areas in either hex or binary.</li>
|
2010-04-08 13:11:36 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Support for DASM symbol files (created with DASM's -s option),
|
|
|
|
including automatically loading symbol files if they're named
|
|
|
|
romname.sym</li>
|
2010-04-08 13:11:36 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Support for DASM list files (created with DASM's -l option),
|
|
|
|
including automatically loading list files if they're named
|
|
|
|
romname.lst</li>
|
2013-08-15 16:07:58 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Built-in VCS.H symbols, if no symbol file is loaded.</li>
|
2010-04-08 13:11:36 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Symbolic names in disassembly.</li>
|
2010-04-08 13:11:36 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Symbolic names accepted as input.</li>
|
2013-06-26 16:03:08 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Ability to generate DASM-compatible disassembly files (currently single-bank
|
2013-06-26 16:03:08 +00:00
|
|
|
only) with all the features mentioned above.</li>
|
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Tab completion for commands, symbol names and functions.</li>
|
|
|
|
<li>Graphical editor for RIOT and extended RAM. Acts a lot like a spreadsheet.
|
|
|
|
Input in hex, with displays for label/decimal/binary for
|
|
|
|
currently-selected location.</li>
|
|
|
|
<li>GUI CPU state window.</li>
|
|
|
|
<!--Cheat system (similar to MAME) (still needs a way to save/load cheats)-->
|
|
|
|
<li>Reset the 6502.</li>
|
|
|
|
<li>Start emulator in debugger (via command-line option "-debug").</li>
|
|
|
|
<li>Save CLI session to a text file.</li>
|
|
|
|
<li>Supports hex, decimal, and binary input and output almost everywhere.
|
|
|
|
(disassembly is still hex).</li>
|
|
|
|
<li>Support for bank switching. You can see how many banks a cart has and the
|
2010-08-19 21:48:28 +00:00
|
|
|
currently selected bank, and manually change banks.</li>
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Registers/memory that get changed by the CPU during debugging are
|
|
|
|
highlighted when they're displayed.</li>
|
2010-11-10 22:38:16 +00:00
|
|
|
<li>Data sources for the CPU SP/A/X/Y registers, showing the resolved/source
|
|
|
|
address of of load operands.</li>
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Scanline advance (like frame advance, break at beginning
|
2021-05-07 21:13:28 +00:00
|
|
|
of next scanLine).</li>
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>TIA display is updated during step/trace, so we can see our
|
|
|
|
scanlines being drawn as it happens. This isn't 100% perfect: unlike
|
|
|
|
a real TIA, the one in Stella only updates when it's written to.</li>
|
|
|
|
<li>Graphical TIA tab, with register names and GUI buttons for
|
|
|
|
various bits (e.g. click ENAM0 to turn it on).</li>
|
|
|
|
<li>GUI Disassembly window, scrollable, with checkboxes for breakpoints.</li>
|
|
|
|
<li>Script (batch) file support, including auto-running a script file
|
|
|
|
named after the ROM image.</li>
|
|
|
|
<li>Saving the current debugger state to a script file (including
|
|
|
|
breakpoints, traps, etc).</li>
|
2021-05-07 21:13:28 +00:00
|
|
|
<li>Built-in functions for use with "breakIf", to support common conditions
|
2019-08-12 07:51:43 +00:00
|
|
|
(such as breaking when the user presses Game Select...)</li>
|
|
|
|
<li>Patching ROM in-place.</li>
|
|
|
|
<li>Save patched ROM</li>
|
2005-09-13 18:27:42 +00:00
|
|
|
</ul>
|
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<h3>Future planned features:</h3>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<ul>
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>GUI for cheat codes (Cheetah and normal codes).</li>
|
|
|
|
<li>Perhaps 2 panes in the disassembly window (so you can see 2 parts of the
|
|
|
|
code at once).</li>
|
|
|
|
<li>Add bookmark support to disassembly window.</li>
|
|
|
|
<li>More "special variables" for the expression parser.</li>
|
|
|
|
<li>Possibly a mini-assembler</li>
|
|
|
|
<li>Possibly support for recording and playing back input files, like
|
|
|
|
MAME. This isn't a debugger feature per se, but it'll make it easier
|
|
|
|
to reliably trigger a bug so you can debug it.</li>
|
2010-11-10 22:38:16 +00:00
|
|
|
<!--
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Graphics ROM view, so you can see your sprite data (it might still
|
|
|
|
be upside-down though :)</li> -->
|
|
|
|
<li>Various new GUI enhancements</li>
|
2005-09-13 18:27:42 +00:00
|
|
|
</ul>
|
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
</br>
|
|
|
|
<h1><a name="HowToDebugger">How to use the Debugger</a></h1>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>Pressing ` (aka backtick, backquote, grave accent) toggles the debugger on
|
2005-10-15 16:38:17 +00:00
|
|
|
& off. When you exit the debugger, the emulation resumes at the current
|
2005-09-13 18:27:42 +00:00
|
|
|
program counter, and continues until either a breakpoint/trap is hit,
|
2005-10-16 19:53:35 +00:00
|
|
|
or the ` key is pressed again.</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
|
|
|
|
<p>The main debugger window will look similar to the following (note that the
|
|
|
|
letters here are for reference in the document below; they aren't actually
|
|
|
|
present in the debugger):</p>
|
|
|
|
<p><img src="graphics/debugger_main.png"></p>
|
|
|
|
|
|
|
|
<p>For space reasons, the Prompt, TIA, I/O and Audio displays are split into
|
|
|
|
4 tabs, only one of which is visible at a time. You can use the mouse or
|
2017-12-04 10:02:36 +00:00
|
|
|
keyboard to select which tab you want to view. Control/Cmd + Tab cycles between
|
2020-12-21 11:05:46 +00:00
|
|
|
tabs from left-to-right, Shift-Control/Cmd + Tab cycles right-to-left.
|
2017-12-04 10:02:36 +00:00
|
|
|
Pressing Tab (or Shift + Tab) cycles between widgets in the current tab (except
|
|
|
|
for in the Prompt Tab, where 'tab' is used for something else).</p>
|
|
|
|
|
2020-10-15 06:30:50 +00:00
|
|
|
<p>Note for the GUI display:
|
|
|
|
<ul>
|
|
|
|
<li>Hexadecimal values are either not prefixed or with '$'.</li>
|
|
|
|
<li>Decimal values are prefixed with '#'.</li>
|
|
|
|
<li>Binary values are prefixed with '%'.</li>
|
|
|
|
</ul>
|
|
|
|
</p>
|
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<p>You can also enter the debugger at emulator startup by use the 'debug'
|
|
|
|
command on the command line, or alternatively within the ROM launcher in
|
|
|
|
'Power-on options':
|
2005-09-13 18:27:42 +00:00
|
|
|
<pre>
|
2013-08-21 10:53:02 +00:00
|
|
|
; will enter the debugger before any instructions run
|
|
|
|
stella -debug mygame.bin
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2013-08-21 10:53:02 +00:00
|
|
|
; alternatively, you can use 'break' to accomplish the same thing
|
2005-09-13 18:27:42 +00:00
|
|
|
; $fffc is the 6502/6507 init vector. This command will break and enter the
|
|
|
|
; debugger before the first 6507 instruction runs, so you can debug the
|
|
|
|
; startup code:
|
|
|
|
stella -break "*($fffc)" mygame.bin
|
|
|
|
</pre>
|
|
|
|
</p>
|
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<p>Using the ` key will always enter the debugger at the end of
|
2021-05-07 21:13:28 +00:00
|
|
|
the frame (for NTSC games usually scanLine 262). This is because Stella only checks
|
2005-10-16 19:53:35 +00:00
|
|
|
for keystrokes once per frame. Once in the debugger, you can control
|
2021-05-07 21:13:28 +00:00
|
|
|
execution by stepping one instruction, scanLine, or frame at a time
|
2017-12-02 10:34:58 +00:00
|
|
|
(or more than one at a time, using commands in the prompt). You can
|
2005-10-16 19:53:35 +00:00
|
|
|
also set breakpoints or traps, which will cause the emulator to enter
|
|
|
|
the debugger when they are triggered, even if it happens in mid-frame.</p>
|
2017-12-07 08:45:31 +00:00
|
|
|
</br>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
2017-12-07 08:45:31 +00:00
|
|
|
<h2><a name="Startup">Startup</a></h2>
|
2017-12-04 17:06:40 +00:00
|
|
|
At startup, the debugger automatically tries load a number of files which
|
|
|
|
will provide additional information for the debugger and can make debugging
|
|
|
|
more convenient.
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
"autoexec.script"</br>
|
|
|
|
Use this plain text file to define e.g. your own functions or settings.
|
|
|
|
They will be loaded at startup for each ROM.
|
|
|
|
|
|
|
|
<p>The location of this file will depend on the OS as follows:</p>
|
|
|
|
<p>
|
2017-12-07 08:45:31 +00:00
|
|
|
<table cellpadding=4 border="1">
|
2017-12-04 17:06:40 +00:00
|
|
|
<tr>
|
|
|
|
<td><b>Linux/Unix</b></td>
|
2019-08-31 02:13:27 +00:00
|
|
|
<td><i>$HOME/.config/stella/autoexec.script</i></td>
|
2017-12-04 17:06:40 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><b>Macintosh</b></td>
|
2019-08-31 02:13:27 +00:00
|
|
|
<td><i>$HOME/Library/Application Support/Stella/autoexec.script</i></td>
|
2017-12-04 17:06:40 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><b>Windows</b></td>
|
2019-08-31 02:13:27 +00:00
|
|
|
<td><i>%APPDATA%\Stella\autoexec.script</i></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><b>If using 'basedir'<br>or 'baseinappdir'</b></td>
|
|
|
|
<td><i>_BASEDIR_/autoexec.script</i></td>
|
2017-12-04 17:06:40 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</p>
|
|
|
|
</li>
|
|
|
|
<li>
|
2019-08-31 02:13:27 +00:00
|
|
|
"<rom_filename>.script" (located in the same directory as the ROM)</br>
|
2017-12-04 17:06:40 +00:00
|
|
|
In this ROM specific, plain text file you can store breaks, traps, watches
|
|
|
|
etc. for future re-use. Use the "save" command to create this file using
|
|
|
|
the current settings. You can also manually edit the file and add more commands.
|
|
|
|
</br></br>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
"<rom_filename>.cfg"</br>
|
|
|
|
This file is described in <a href="#DistellaConfiguration">
|
2020-08-27 06:53:14 +00:00
|
|
|
<b>DiStella Configuration Files</b></a>.
|
2017-12-04 17:06:40 +00:00
|
|
|
</br></br>
|
|
|
|
</li>
|
|
|
|
<li>
|
2019-08-31 02:13:27 +00:00
|
|
|
"<rom_filename>.lst" (located in the same directory as the ROM)</br>
|
2017-12-04 17:06:40 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2019-08-31 02:13:27 +00:00
|
|
|
"<rom_filename>.sym" (located in the same directory as the ROM)</br>
|
2017-12-04 17:06:40 +00:00
|
|
|
If you provied the -l and -s parameters DASM will create these two files during
|
|
|
|
assembly. Stella uses the file content to display the correct labels.
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p>Note that all files are only accessed if you enter
|
|
|
|
the debugger at least once during a program run. This means you can create
|
|
|
|
these files, and not worry about slowing down emulation unless you're
|
|
|
|
actively using the debugger.</p>
|
|
|
|
|
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
|
|
|
<h2><a name="GlobalButtons">Global Buttons</a></h2>
|
|
|
|
|
|
|
|
<p>There are some buttons on the right top that always show up no matter which
|
2017-12-04 18:57:22 +00:00
|
|
|
tab you are looking at. This is because these are the ones that are most frequently
|
|
|
|
used.</p>
|
2017-12-04 10:02:36 +00:00
|
|
|
|
|
|
|
<ul>
|
|
|
|
<p><img src="graphics/debugger_globalbuttons.png"></p>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<p>The larger button at the left top (labeled '<') performs the rewind operation,
|
2017-12-14 13:25:02 +00:00
|
|
|
which will undo the previous Step/Trace/Scan/Frame... advance, the smaller button at
|
2017-12-04 10:02:36 +00:00
|
|
|
the left bottom (labeled '>') performs the unwind operation, which will undo the
|
2017-12-14 13:25:02 +00:00
|
|
|
previous rewind operation. The rewind buffer is 100 levels deep by default, the
|
|
|
|
size can be configured e.g. in the
|
2017-12-15 17:10:40 +00:00
|
|
|
<b><a href="index.html#Debugger">Developer Settings</a> - Time Machine</b> dialog.<p>
|
2017-12-04 10:02:36 +00:00
|
|
|
|
2020-12-21 11:05:46 +00:00
|
|
|
<p>The other operations are Step, Trace, Scan +1, Frame +1 and Run.</p>
|
2017-12-04 10:02:36 +00:00
|
|
|
|
|
|
|
<p>You can also use the buttons from anywhere in the GUI via hotkeys.</p>
|
2017-12-04 18:57:22 +00:00
|
|
|
<p>
|
2017-12-07 08:45:31 +00:00
|
|
|
<table BORDER=1 cellpadding=4>
|
2017-12-04 13:17:54 +00:00
|
|
|
<tr>
|
|
|
|
<th>Function</th>
|
2021-05-09 17:21:15 +00:00
|
|
|
<th>Key</th>
|
2017-12-04 13:17:54 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Step</td>
|
2021-05-09 17:21:15 +00:00
|
|
|
<td>Control + S</td>
|
2017-12-04 13:17:54 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Trace</td>
|
2021-05-09 17:21:15 +00:00
|
|
|
<td>Control + T</td>
|
2017-12-04 13:17:54 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-12-21 11:05:46 +00:00
|
|
|
<td>Scan +1</td>
|
2021-05-09 17:21:15 +00:00
|
|
|
<td>Control + L</td>
|
2017-12-04 13:17:54 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-12-21 11:05:46 +00:00
|
|
|
<td>Frame +1</td>
|
2021-05-09 17:21:15 +00:00
|
|
|
<td>Control + F</td>
|
2017-12-04 13:17:54 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2017-12-14 13:25:02 +00:00
|
|
|
<td>Rewind 1</td>
|
2021-05-09 17:21:15 +00:00
|
|
|
<td>Alt + Left arrow</td>
|
2017-12-04 13:17:54 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2017-12-14 13:25:02 +00:00
|
|
|
<td>Rewind 10</td>
|
2021-05-09 17:21:15 +00:00
|
|
|
<td>Shift-Alt + Left arrow</td>
|
2017-12-14 13:25:02 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Rewind all</td>
|
2021-05-09 17:21:15 +00:00
|
|
|
<td>Alt + Down arrow</td>
|
2017-12-14 13:25:02 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Unwind 1</td>
|
2021-05-09 17:21:15 +00:00
|
|
|
<td>Alt + Right arrow</td>
|
2017-12-14 13:25:02 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Unwind 10</td>
|
2021-05-09 17:21:15 +00:00
|
|
|
<td>Shift-Alt + Right arrow</td>
|
2017-12-14 13:25:02 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Unwind all</td>
|
2021-05-09 17:21:15 +00:00
|
|
|
<td>Alt + Up arrow</td>
|
2017-12-04 13:17:54 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-12-21 11:05:46 +00:00
|
|
|
<td>Run, exits debugger</td>
|
2021-05-09 17:21:15 +00:00
|
|
|
<td>Backquote (`)</td>
|
2017-12-04 13:17:54 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
2017-12-04 18:57:22 +00:00
|
|
|
</p>
|
2018-02-01 10:25:44 +00:00
|
|
|
For MacOS use 'Cmd' instead of 'Alt' key.
|
2020-04-19 08:45:22 +00:00
|
|
|
<p>To the left of the global buttons, you find the 'Options...' button.</p>
|
2017-12-05 10:03:12 +00:00
|
|
|
<ul>
|
|
|
|
<p><img src="graphics/debugger_options.png"></p>
|
|
|
|
</ul>
|
|
|
|
<p>This opens the <a href="index.html#Options">Options Menu</a> which is described
|
|
|
|
in detail in the <a href="index.html">User's Guide</a>.</p>
|
2017-12-04 10:02:36 +00:00
|
|
|
|
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
|
|
|
<h2><a name="ChangeTracking"></a>Change Tracking</h2>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
2017-12-20 15:20:52 +00:00
|
|
|
<p>The debugger tracks changes to the CPU, TIA and RIOT registers and RAM by
|
|
|
|
displaying changed locations or registers with a red background after each step,
|
2021-05-07 21:13:28 +00:00
|
|
|
trace, scanLine, or frame advance. This sounds simple, and it is, but
|
2005-10-16 19:53:35 +00:00
|
|
|
it's also amazingly useful.</p>
|
|
|
|
|
|
|
|
<p>One clarification about the change tracking: it only tracks when values
|
|
|
|
have <b>changed</b>. If the ROM writes a value into a RAM location that
|
|
|
|
already contained the same value, that's not considered a change (old
|
|
|
|
value was $whatever, new value is the same, so nothing got tracked). This
|
|
|
|
may change in a future version of Stella.</p>
|
|
|
|
|
2009-01-13 14:45:34 +00:00
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
2017-12-04 10:02:36 +00:00
|
|
|
<br>
|
|
|
|
<h2><a name="PromptTab"><u>(A)</u> Prompt Tab</a></h2>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>This is a command-line interface, similar to the DOS DEBUG command
|
2005-10-16 19:53:35 +00:00
|
|
|
or Supermon for the C=64.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2009-01-13 20:26:02 +00:00
|
|
|
<p>Editing keys work about like you'd expect them to in Windows, but many
|
|
|
|
Bash-style commands are also supported:</p>
|
|
|
|
|
2017-12-07 08:45:31 +00:00
|
|
|
<table border="1" cellpadding=4>
|
2021-05-09 17:21:15 +00:00
|
|
|
<tr><th>Function</th><th>Key</th></tr>
|
|
|
|
<tr><td>Move cursor to beginning of line</td><td>Home</td></tr>
|
|
|
|
<tr><td>Move cursor to end of line</td><td>End</td></tr>
|
|
|
|
<tr><td>Remove character to right of cursor</td><td>Delete</td></tr>
|
|
|
|
<tr><td>Remove character to left of cursor</td><td>Backspace</td></tr>
|
|
|
|
<tr><td>Same function as 'Home'</td><td>Control + A</td></tr>
|
|
|
|
<tr><td>Same function as 'End'</td><td>Control + E</td></tr>
|
|
|
|
<tr><td>Same function as 'Delete'</td><td>Control + D</td></tr>
|
|
|
|
<tr><td>Remove all characters from cursor to end of line</td><td>Control + K</td></tr>
|
|
|
|
<tr><td>Remove all characters from cursor to beginning of line</td><td>Control + U</td></tr>
|
|
|
|
<tr><td>Remove entire word to left of cursor</td><td>Control + W</td></tr>
|
|
|
|
<tr><td>Copy current line</td><td>Control + C</td></tr>
|
|
|
|
<tr><td>Cut current line</td><td>Control + X</td></tr>
|
|
|
|
<tr><td>Paste over current line</td><td>Control + V</td></tr>
|
|
|
|
<tr><td>Scroll up through previous commands one screen/page</td><td>Shift + PgUp</td></tr>
|
|
|
|
<tr><td>Scroll down through previous commands one screen/page</td><td>Shift + PgDown</td></tr>
|
|
|
|
<tr><td>Scroll up through previous commands one line</td><td>Shift + Up</td></tr>
|
|
|
|
<tr><td>Scroll down through previous commands one line</td><td>Shift + Down</td></tr>
|
|
|
|
<tr><td>Scroll to beginning of commands</td><td>Shift + Home</td></tr>
|
|
|
|
<tr><td>Scroll to end of commands</td><td>Shift + End</td></tr>
|
2009-01-13 20:26:02 +00:00
|
|
|
</table>
|
2021-05-09 17:21:15 +00:00
|
|
|
<p>You can also scroll with the mouse. Copy and paste is currently only supported for a complete line.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-02 10:34:58 +00:00
|
|
|
<p>To see the available commands, enter "help". For extended help, type "help cmd",
|
|
|
|
where 'cmd' is the command you wish to know about. The available commands are listed
|
2017-12-04 13:17:54 +00:00
|
|
|
in <a href="#PromptCommands"><b>Prompt Commands</b></a> at the end of this section. Bash-style tab completion is supported for commands,
|
2017-07-06 23:25:01 +00:00
|
|
|
labels and functions (see below).</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>For now, there are some functions that only exist in the prompt. We
|
|
|
|
intend to add GUI equivalents for all (or almost all?) of the prompt
|
2009-01-13 14:45:34 +00:00
|
|
|
commands in future releases. People who like command prompts will be able to
|
|
|
|
use the prompt, but people who hate them will have a fully functional
|
|
|
|
debugger without typing (or without typing much, anyway).</p>
|
2017-12-04 18:57:22 +00:00
|
|
|
|
|
|
|
<p>Note: unlike the rest of the UI, whatever is shown in the prompt will not
|
|
|
|
be updated during debugging and thus eventually become "stale". You can update it
|
|
|
|
just by re-running the relevant commands in the prompt.</p>
|
2017-12-04 13:17:54 +00:00
|
|
|
</br>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<h3><a name="TabCompletion">Tab Key Auto-Complete</a></h3>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2010-04-08 18:21:00 +00:00
|
|
|
<p>While entering a command, label or function, you can type a partial name and
|
2021-05-09 09:23:14 +00:00
|
|
|
press the (Shift +) Tab key to attempt to auto-complete it. If you've ever used
|
2005-09-13 18:27:42 +00:00
|
|
|
"bash", this will be immediately familiar. If not, try it: load up
|
2017-11-26 12:42:56 +00:00
|
|
|
a ROM, go to the debugger, type "g" (but don't press Enter),
|
|
|
|
then hit Tab. The "g" will change to "gfx" (since this is the only
|
|
|
|
built-in command starting with a "g"). If there are multiple possible
|
2021-05-09 09:23:14 +00:00
|
|
|
completions (try with "tr" instead of "g"), you can tab through them.
|
2017-11-26 15:26:21 +00:00
|
|
|
After the first character, the autocompletion considers all
|
2017-11-26 12:42:56 +00:00
|
|
|
characters in the right order as a match (e.g. "twf" will be completed to
|
2021-05-07 21:13:28 +00:00
|
|
|
"trapWriteIf"). Alternatively you can make use of the camel case names and type
|
|
|
|
e.g. "tWI" ("trapWriteIf") or "lAS" ("LoadAllStates").</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>Tab completion works on all labels: built-in, loaded from a symbol file,
|
2010-04-08 18:21:00 +00:00
|
|
|
or set during debugging with the "define" command. It also works with
|
|
|
|
built-in functions and those defined with the "function" command,
|
|
|
|
but it doesn't (yet) work on filenames.</p>
|
2017-12-04 13:17:54 +00:00
|
|
|
</br>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<h3><a name="Expressions">Expressions</a></h3>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>Almost every command takes a value: the "a" command takes a
|
|
|
|
byte to stuff into the accumulator, the "break" command
|
|
|
|
takes an address to set/clear a breakpoint at. These values
|
|
|
|
can be as a hex constant ($ff, $1234), or as complex as
|
|
|
|
"the low byte of the 16-bit value located at the address
|
|
|
|
pointed to by the binary number 1010010110100101" (which
|
2005-10-15 16:38:17 +00:00
|
|
|
would be "@<\1010010110100101"). You can also use registers
|
2005-09-13 18:27:42 +00:00
|
|
|
and labels in expressions.</p>
|
|
|
|
|
|
|
|
<p>You can use arithmetic and boolean operators in expressions. The
|
|
|
|
syntax is very C-like. The operators supported are:</p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
+ - * / (add, subtract, multiply, divide: 2+2 is 4)
|
|
|
|
% (modulus/remainder: 3%2 is 1)
|
2005-10-15 16:38:17 +00:00
|
|
|
& | ^ ~ (bitwise AND, OR, XOR, NOT: 2&3 is 2)
|
|
|
|
&& || ! (logical AND, OR, NOT: 2&&3 is 1, 2||0 is 0)
|
2005-09-13 18:27:42 +00:00
|
|
|
( ) (parentheses for grouping: (2+2)*3 is 12)
|
|
|
|
* @ (byte and word pointer dereference: *$80 is the byte stored
|
|
|
|
at location $80)
|
|
|
|
[ ] (array-style byte pointer dereference: $80[1] is the byte
|
|
|
|
stored at location ($80+1) or $81)
|
2005-10-15 16:38:17 +00:00
|
|
|
< > (prefix versions: low and high byte. <$abcd is $cd)
|
|
|
|
== < > <= >= !=
|
2005-09-13 18:27:42 +00:00
|
|
|
(comparison: equality, less-than, greater-than, less-or-equals,
|
|
|
|
greater-or-equals, not-equals)
|
2005-10-15 16:38:17 +00:00
|
|
|
<< >> (bit shifts, left and right: 1<<1 is 2, 2>>1 is 1)
|
2005-09-13 18:27:42 +00:00
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p>Division by zero is not an error: it results in zero instead.</p>
|
|
|
|
|
|
|
|
<p>None of the operators change the values of their operands. There
|
|
|
|
are no variable-assignment or increment/decrement operators. This
|
|
|
|
may change in the future, which is why we used "==" for equality
|
|
|
|
instead of just "=".</p>
|
|
|
|
|
|
|
|
<p>The bitwise and logical boolean operators are different in that the
|
|
|
|
bitwise operators operate on all the bits of the operand (just like
|
|
|
|
AND, ORA, EOR in 6502 asm), while the logical operators treat their
|
|
|
|
operands as 0 for false, non-zero for true, and return either 0 or 1.
|
2005-10-15 16:38:17 +00:00
|
|
|
So $1234&$5678 results in $1230, whereas $1234&&$5678 results in 1.
|
2005-09-13 18:27:42 +00:00
|
|
|
This is just like C or C++...</p>
|
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<h4><a name="Prefixes">Prefixes</a></h4>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>Like some programming languages, the debugger uses prefixed characters
|
|
|
|
to change the meaning of an expression. The prefixes are:</p>
|
|
|
|
|
|
|
|
<ul>
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Dereference prefixes:<br>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-04 18:57:22 +00:00
|
|
|
<p><pre>'*'</pre>
|
2019-08-12 07:51:43 +00:00
|
|
|
Dereference a byte pointer. "*a" means "the byte at the address that
|
|
|
|
the A register points to". If A is 255 (hex $ff), the result will be
|
|
|
|
the value currently stored in memory location 255. This operator
|
|
|
|
will be very familiar to you if you're a C or C++ developer. It's
|
|
|
|
equivalent to the PEEK() function in most 8-bit BASICs. Also, the
|
|
|
|
debugger supports array-like byte dereferences: *address can be
|
|
|
|
written as address[0]. *(address+1) can be written as address[1],
|
|
|
|
etc.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-04 18:57:22 +00:00
|
|
|
<p><pre>'@'</pre>
|
2019-08-12 07:51:43 +00:00
|
|
|
Dereference a pointer to a word. This is just like the "*" byte deref,
|
|
|
|
except it refers to a 16-bit value, occupying 2 locations, in
|
|
|
|
low-byte-first format (standard for the 6507).</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<p>The following are equivalent:</p>
|
|
|
|
<pre>
|
2005-09-13 18:27:42 +00:00
|
|
|
@address
|
|
|
|
*address+$100**(address+1)
|
|
|
|
address[0]+#256*address[1]
|
2019-08-12 07:51:43 +00:00
|
|
|
</pre>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<p>(TODO: add (indirect),y and (indirect,x) syntax)</p>
|
|
|
|
</li>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Hi/Lo Byte Prefixes:<br>
|
2017-12-04 18:57:22 +00:00
|
|
|
<p><pre>'<'</pre>
|
2019-08-12 07:51:43 +00:00
|
|
|
Take the low byte of a 16-bit value. This has no effect on an 8-bit
|
|
|
|
value: "a" is equal to "<a". However, "<$1234" equals "$34".</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-04 18:57:22 +00:00
|
|
|
<p><pre>'>'</pre>
|
2019-08-12 07:51:43 +00:00
|
|
|
Take the high byte of a 16-bit value. For 8-bit values such as
|
|
|
|
the Accumulator, this will always result in zero. For 16-bit values,
|
|
|
|
"<$1234" = "$12".</p>
|
|
|
|
</li>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Number Base Prefixes:<br>
|
2017-12-04 18:57:22 +00:00
|
|
|
<p><pre>'#'</pre>
|
2019-08-12 07:51:43 +00:00
|
|
|
Treat the input as a decimal number.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-04 18:57:22 +00:00
|
|
|
<p><pre>'$'</pre>
|
2019-08-12 07:51:43 +00:00
|
|
|
Treat the input as a hex number.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-04 18:57:22 +00:00
|
|
|
<p><pre>'\'</pre>
|
2019-08-12 07:51:43 +00:00
|
|
|
Treat the input as a binary number.</p>
|
|
|
|
|
|
|
|
<p>These only have meaning when they come before a number, not a
|
|
|
|
label or a register. "\1010" means 10 decimal. So do "$0a" and
|
|
|
|
"#10". "a" by itself is always the Accumulator, no matter what
|
|
|
|
the default base is set to.</p>
|
|
|
|
|
|
|
|
<p>If you don't specify any number base prefix, the number is
|
|
|
|
assumed to be in the default base. When you first start Stella,
|
|
|
|
the default base is 16 (hexadecimal). You can change it with the
|
|
|
|
"base" command. If you want to change the default base to decimal permanently,
|
|
|
|
you can put a
|
2017-12-04 18:57:22 +00:00
|
|
|
<pre>
|
|
|
|
base #10
|
|
|
|
</pre>
|
|
|
|
command in your "autoexec.script" file (for details
|
2017-12-04 17:06:40 +00:00
|
|
|
see <a href="#Startup"><b>Startup</b></a>).</p>
|
|
|
|
</li>
|
2005-09-13 18:27:42 +00:00
|
|
|
</ul>
|
2017-12-04 17:06:40 +00:00
|
|
|
<p>Remember, you can use arbitrarily complex expressions with any
|
|
|
|
command that takes arguments.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-03 16:07:47 +00:00
|
|
|
</br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h3><a name="BreakpointsEtc">Breakpoints, watches and traps, oh my!</a></h3>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<h4><a name="Breakpoints">Breakpoints</a></h4>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>A breakpoint is a "hotspot" in your program that causes the emulator
|
2021-05-06 08:29:45 +00:00
|
|
|
to stop emulating and jump into the debugger ¹. You can set as many
|
2020-02-03 19:42:20 +00:00
|
|
|
breakpoints as you like. The command is "break xx yy" where xx is any
|
|
|
|
expression and yy a bank number. Both arguments are optional. If you have
|
|
|
|
created a symbol file, you can use labels for the expression.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2020-02-03 19:43:51 +00:00
|
|
|
<p>Example: You have got a label called "kernel". To break there,
|
2005-09-13 18:27:42 +00:00
|
|
|
the command is "break kernel". After you've set the breakpoint,
|
2020-04-19 08:45:22 +00:00
|
|
|
exit the debugger (enter "run" or click the 'Run' button). The emulator
|
2005-09-13 18:27:42 +00:00
|
|
|
will run until it gets to the breakpoint, then it will enter the
|
|
|
|
debugger with the Program Counter pointing to the instruction
|
|
|
|
at the breakpoint.</p>
|
|
|
|
|
|
|
|
<p>Breakpoints happen *before* an instruction is executed: the
|
|
|
|
instruction at the breakpoint location will be the "next"
|
|
|
|
instruction.</p>
|
|
|
|
|
|
|
|
<p>To remove a breakpoint, you just run the same command you used to
|
|
|
|
set it. In the example, "break kernel" will remove the breakpoint.
|
|
|
|
The "break" command can be thought of as a *toggle*: it turns the
|
2005-10-15 16:38:17 +00:00
|
|
|
breakpoint on & off, like a light switch.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2021-05-07 21:13:28 +00:00
|
|
|
<p>You could also use "clearBreaks" to remove all the breakpoints. Also,
|
|
|
|
there is a "listBreaks" command that will list them all.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2021-05-07 21:13:28 +00:00
|
|
|
<p>¹ By enabling "logBreaks" you can log the current state into
|
2021-05-06 08:29:45 +00:00
|
|
|
the System Log and continue emulation instead.</p>
|
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<h4><a name="ConditionalBreaks">Conditional Breaks</a></h4>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>A conditional breakpoint causes the emulator to enter the debugger when
|
|
|
|
some arbitrary condition becomes true. "True" means "not zero" here:
|
|
|
|
"2+2" is considered true because it's not zero. "2-2" is false, because
|
|
|
|
it evaluates to zero. This is exactly how things work in C and lots
|
|
|
|
of other languages, but it might take some getting used to if you've
|
|
|
|
never used such a language.</p>
|
|
|
|
|
|
|
|
<p>Suppose you want to enter the debugger when the Game Reset switch is
|
|
|
|
pressed. Looking at the Stella Programmers' Guide, we see that this
|
|
|
|
switch is read at bit 0 of SWCHB. This bit will be 0 if the switch is
|
|
|
|
pressed, or 1 otherwise.</p>
|
|
|
|
|
|
|
|
<p>To have an expression read the contents of an address, we use the
|
|
|
|
dereference operator "*". Since we're looking at SWCHB, we need
|
|
|
|
"*SWCHB".</p>
|
|
|
|
|
|
|
|
<p>We're only wanting to look at bit 0, so let's mask off all the other
|
2005-10-15 16:38:17 +00:00
|
|
|
bits: "*SWCHB&1". The expression now evaluates to bit 0 of SWCHB. We're
|
2005-09-13 18:27:42 +00:00
|
|
|
almost there: this will be 1 (true) if the switch is NOT pressed. We
|
|
|
|
want to break if it IS pressed...</p>
|
|
|
|
|
|
|
|
<p>So we invert the sense of the test with a logical NOT operator (which
|
2005-10-15 16:38:17 +00:00
|
|
|
is the "!" operator): !(*SWCHB&1). The parentheses are necessary as
|
|
|
|
we want to apply the ! to the result of the &, not just the first term
|
2005-09-13 18:27:42 +00:00
|
|
|
(the "*SWCHB").</p>
|
|
|
|
|
2021-05-07 21:13:28 +00:00
|
|
|
<p>"breakIf !(*SWCHB&1)" will do the job for us. However, it's an ugly mess
|
2005-09-13 18:27:42 +00:00
|
|
|
of letters, numbers, and punctuation. We can do a little better:</p>
|
|
|
|
|
2021-05-07 21:13:28 +00:00
|
|
|
<p>"breakIf { !(*SWCHB & 1 ) }" is a lot more readable, isn't it? If
|
2005-09-13 18:27:42 +00:00
|
|
|
you're going to use readable expressions with spaces in them,
|
2010-11-04 19:29:12 +00:00
|
|
|
enclose the entire expression in curly braces.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2005-10-16 19:53:35 +00:00
|
|
|
<p>Remember that Stella only checks for input once per frame, so a break
|
|
|
|
condition that depends on input (like SWCHB) will always happen at the
|
|
|
|
end of a frame. This is different from how a real 2600 works, but most
|
|
|
|
ROMs only check for input once per frame anyway.</p>
|
|
|
|
|
2021-05-07 21:13:28 +00:00
|
|
|
<p>Conditional breaks appear in "listBreaks", numbered starting from
|
|
|
|
zero. You can remove a cond-break with "delBreakIf number", where
|
|
|
|
the number comes from "listBreaks" or by entering the same conditional break again.</p>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
|
|
|
<p>Any time the debugger is entered due to a trap, breakpoint, or
|
2017-12-04 18:57:22 +00:00
|
|
|
conditional break, the reason will be displayed in the
|
|
|
|
<a href="#BreakpointStatus"><b>Breakpoint/Trap Status</b></a> area.
|
2005-10-16 19:53:35 +00:00
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<h4><a name="Functions">Functions</a></h4>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
|
|
|
<p>There is one annoyance about complex expressions: once we
|
2021-05-07 21:13:28 +00:00
|
|
|
remove the conditional break with "delBreakIf" or "clearBreaks",
|
2005-09-13 18:27:42 +00:00
|
|
|
we'd have to retype it (or search backwards with the up-arrow key)
|
|
|
|
if we wanted to use it again.</p>
|
|
|
|
|
|
|
|
<p>We can avoid this by defining the expression as a function, then using
|
2021-05-07 21:13:28 +00:00
|
|
|
"breakIf function_name":</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<pre>
|
2019-08-12 07:51:43 +00:00
|
|
|
function gameReset { !(*SWCHB & 1 ) }
|
2021-05-07 21:13:28 +00:00
|
|
|
breakIf gameReset
|
2005-09-13 18:27:42 +00:00
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p>Now we have a meaningful name for the condition, so we can use it again.
|
|
|
|
Not only that: we can use the function as part of a bigger expression.
|
|
|
|
Suppose we've also defined a gameSelect function that evaluates to true
|
|
|
|
if the Game Select switch is pressed. We want to break when the user
|
|
|
|
presses both Select and Reset:</p>
|
|
|
|
|
|
|
|
<pre>
|
2021-05-07 21:13:28 +00:00
|
|
|
breakIf { gameReset && gameSelect }
|
2005-09-13 18:27:42 +00:00
|
|
|
</pre>
|
|
|
|
|
2021-05-07 21:13:28 +00:00
|
|
|
<p>User-defined functions appear in "listFunctions", which shows the label
|
2017-12-02 10:34:58 +00:00
|
|
|
and expression for each function. Functions can be removed with
|
2021-05-07 21:13:28 +00:00
|
|
|
"delFunction label", where the labels come from "listFunctions".</p>
|
2010-04-10 20:00:16 +00:00
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<h4><a name="BuiltInFunctions">Built-in Functions</a></h4>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
2021-05-07 21:13:28 +00:00
|
|
|
<p>Stella has some pre-defined functions for use with the "breakIf"
|
2017-12-02 10:34:58 +00:00
|
|
|
command. These allow you to break and enter the debugger on various
|
2005-10-16 19:53:35 +00:00
|
|
|
conditions without having to define the conditions yourself.</p>
|
|
|
|
|
|
|
|
<p>Built-in functions and pseudo-registers always start with an _
|
|
|
|
(underscore) character. It is suggested that you don't start labels in
|
|
|
|
your game's source with underscores, if you plan to use them with the
|
|
|
|
Stella debugger.</p>
|
|
|
|
|
2017-12-07 08:45:31 +00:00
|
|
|
<table border="1" cellpadding=4>
|
2005-10-16 19:53:35 +00:00
|
|
|
<tr><th>Function</th><th>Definition</th><th>Description</th></tr>
|
2021-05-07 21:13:28 +00:00
|
|
|
<tr><td> _joy0Left</td><td> !(*SWCHA & $40)</td><td> Left joystick moved left</td></tr>
|
|
|
|
<tr><td> _joy0Right</td><td> !(*SWCHA & $80)</td><td> Left joystick moved right</td></tr>
|
|
|
|
<tr><td> _joy0Up</td><td> !(*SWCHA & $10)</td><td> Left joystick moved up</td></tr>
|
|
|
|
<tr><td> _joy0Down</td><td> !(*SWCHA & $20)</td><td> Left joystick moved down</td></tr>
|
|
|
|
<tr><td> _joy0Fire</td><td> !(*INPT4 & $80)</td><td> Left joystick fire button pressed</td></tr>
|
|
|
|
<tr><td> _joy1Left</td><td> !(*SWCHA & $04)</td><td> Right joystick moved left</td></tr>
|
|
|
|
<tr><td> _joy1Right</td><td> !(*SWCHA & $08)</td><td> Right joystick moved right</td></tr>
|
|
|
|
<tr><td> _joy1Up</td><td> !(*SWCHA & $01)</td><td> Right joystick moved up</td></tr>
|
|
|
|
<tr><td> _joy1Down</td><td> !(*SWCHA & $02)</td><td> Right joystick moved down</td></tr>
|
|
|
|
<tr><td> _joy1Fire</td><td> !(*INPT5 & $80)</td><td> Right joystick fire button pressed</td></tr>
|
2010-08-23 16:19:17 +00:00
|
|
|
<tr><td> _select</td><td> !(*SWCHB & $02)</td><td> Game Select pressed</td></tr>
|
|
|
|
<tr><td> _reset</td><td> !(*SWCHB & $01)</td><td> Game Reset pressed</td></tr>
|
2005-10-16 19:53:35 +00:00
|
|
|
<tr><td> _color</td><td> *SWCHB & $08</td><td> Color/BW set to Color</td></tr>
|
|
|
|
<tr><td> _bw</td><td> !(*SWCHB & $08)</td><td> Color/BW set to BW</td></tr>
|
2021-05-07 21:13:28 +00:00
|
|
|
<tr><td> _diff0B</td><td> !(*SWCHB & $40)</td><td> Left difficulty set to B (easy)</td></tr>
|
|
|
|
<tr><td> _diff0A</td><td> *SWCHB & $40</td><td> Left difficulty set to A (hard)</td></tr>
|
|
|
|
<tr><td> _diff1B</td><td> !(*SWCHB & $80)</td><td> Right difficulty set to B (easy)</td></tr>
|
|
|
|
<tr><td> _diff1A</td><td> *SWCHB & $80</td><td> Right difficulty set to A (hard)</td></tr>
|
2005-10-16 19:53:35 +00:00
|
|
|
</table>
|
|
|
|
|
|
|
|
<p>Don't worry about memorizing them all: the Prompt "help" command
|
|
|
|
will show you a list of them.</p>
|
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<h4><a name="PseudoRegisters">Pseudo-Registers</a></h4>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
2009-01-13 20:26:02 +00:00
|
|
|
<p>These "registers" are provided for you to use in your conditional breaks.
|
|
|
|
They're not registers in the conventional sense, since they don't exist in
|
2017-12-02 10:34:58 +00:00
|
|
|
a real system. For example, while the debugger keeps track of the number
|
2009-01-13 20:26:02 +00:00
|
|
|
of scanlines in a frame, a real system would not (there is no register
|
|
|
|
that holds 'number of scanlines' on an actual console).</p>
|
2017-12-07 08:45:31 +00:00
|
|
|
<table border="1" cellpadding=4>
|
2009-01-13 20:26:02 +00:00
|
|
|
<tr><th>Function</th><th>Description</th></tr>
|
2009-01-14 20:31:07 +00:00
|
|
|
<tr><td> _bank</td><td> Currently selected bank</td></tr>
|
2021-05-07 21:13:28 +00:00
|
|
|
<tr><td> _cClocks</td><td> Color clocks on a scanLine</td></tr>
|
|
|
|
<tr><td> _cyclesHi</td><td> Higher 32 bits of number of cycles since emulation started</td></tr>
|
|
|
|
<tr><td> _cyclesLo</td><td> Lower 32 bits of number of cycles since emulation started</td></tr>
|
|
|
|
<tr><td> _fCount</td><td> Number of frames since emulation started</td></tr>
|
|
|
|
<tr><td> _fCycles</td><td> Number of cycles since frame started</td></tr>
|
|
|
|
<tr><td> _fTimReadCycles</td><td>Number of cycles used by timer reads since frame started</td></tr>
|
|
|
|
<tr><td> _fWsyncCycles</td><td>Number of cycles skipped by WSYNC since frame started</td></tr>
|
|
|
|
<tr><td> _iCycles</td><td> Number of cycles of last instruction</td></tr>
|
2021-09-05 17:20:30 +00:00
|
|
|
<tr><td> _inTim</td><td> Current INTIM value</td></tr>
|
2021-05-07 21:13:28 +00:00
|
|
|
<tr><td> _scan</td><td> Current scanLine count</td></tr>
|
|
|
|
<tr><td> _scanEnd</td><td> Scanline count at end of last frame</td></tr>
|
|
|
|
<tr><td> _sCycles</td><td> Number of cycles in current scanLine</td></tr>
|
2021-09-05 17:20:30 +00:00
|
|
|
<tr><td> _timInt</td><td> Current TIMINT value</td></tr>
|
2021-05-07 21:13:28 +00:00
|
|
|
<tr><td> _timWrapRead</td><td> Timer read wrapped on this cycle</td></tr>
|
|
|
|
<tr><td> _timWrapWrite</td><td> Timer write wrapped on this cycle</td></tr>
|
|
|
|
<tr><td> _vBlank</td><td> Whether vertical blank is enabled (1 or 0)</td></tr>
|
|
|
|
<tr><td> _vSync</td><td> Whether vertical sync is enabled (1 or 0)</td></tr>
|
2009-01-13 20:26:02 +00:00
|
|
|
</table>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
2021-05-07 21:13:28 +00:00
|
|
|
<p><b>_scan</b> always contains the current scanLine count. You can use
|
2005-10-16 19:53:35 +00:00
|
|
|
this to break your program in the middle of your kernel. Example:</p>
|
|
|
|
<pre>
|
2021-05-07 21:13:28 +00:00
|
|
|
breakIf _scan==#64
|
2005-10-16 19:53:35 +00:00
|
|
|
</pre>
|
|
|
|
<p>This will cause Stella to enter the debugger when the TIA reaches the
|
2021-05-07 21:13:28 +00:00
|
|
|
beginning of the 64th scanLine.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2005-10-16 19:53:35 +00:00
|
|
|
<p><b>_bank</b> always contains the currently selected bank. For 2K or 4K
|
|
|
|
(non-bankswitched) ROMs, it will always contain 0. One useful use is:</p>
|
|
|
|
|
|
|
|
<pre>
|
2021-05-07 21:13:28 +00:00
|
|
|
breakIf { pc==myLabel && _bank==1 }
|
2005-10-16 19:53:35 +00:00
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p>This is similar to setting a regular breakpoint, but it will only trigger
|
|
|
|
when bank 1 is selected.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<h4><a name="Watches">Watches</a></h4>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>A watch is an expression that gets evaluated and printed before
|
|
|
|
every prompt. This is useful for e.g. tracking the contents of a
|
|
|
|
memory location while stepping through code that modifies it.</p>
|
|
|
|
|
|
|
|
<p>You can set up to 10 watches (in future the number will be unlimited).
|
|
|
|
Since the expression isn't evaluated until it's used, you can include
|
|
|
|
registers: "watch *y" will show you the contents of the location
|
|
|
|
pointed to by the Y register, even if the Y register changes.</p>
|
|
|
|
|
|
|
|
<p>The watches are numbered. The numbers are printed along with the
|
|
|
|
watches, so you can tell which is which. To delete a watch use the
|
2021-05-07 21:13:28 +00:00
|
|
|
"delWatch" command with the watch number (1 to whatever). You can
|
|
|
|
also delete them all with the "clearWatches" command.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>Note that there's no real point in watching a label or CPU register
|
|
|
|
without dereferencing it: Labels are constants, and CPU registers
|
2017-12-04 13:17:54 +00:00
|
|
|
are already visible in the <a href="#CPURegisters"><b>CPU Registers</b></a> widget</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<h4><a name="Traps">Traps</a></h4>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>A trap is similar to a breakpoint, except that it catches
|
|
|
|
accesses to a memory address, rather than specific location in the
|
|
|
|
program. They're useful for finding code that modifies TIA registers
|
|
|
|
or memory.</p>
|
|
|
|
|
2021-05-07 21:13:28 +00:00
|
|
|
<p>Traps can also combined with a condition ("trapIf"). If an access
|
2017-11-30 12:50:56 +00:00
|
|
|
to a memory address is caught, the condition is evaluated additionally.
|
2017-12-02 10:34:58 +00:00
|
|
|
Only if the condition is true too, the emulations stops. For details
|
2017-12-04 13:17:54 +00:00
|
|
|
about conditions see <a href="#ConditionalBreaks"><b>Conditional Breaks</b></a> described above.</p>
|
2017-11-26 12:42:56 +00:00
|
|
|
|
2005-09-13 18:27:42 +00:00
|
|
|
<p>An example: you are debugging a game, and you want to stop the
|
|
|
|
emulation and enter the debugger whenever RESP0 is strobed. You'd use
|
|
|
|
the command "trap RESP0" to set the trap, then exit the debugger. The
|
|
|
|
emulator will run until the next time RESP0 is accessed (either read
|
|
|
|
or write). Once the trap is hit, you can examine the TIA state to
|
|
|
|
see what the actual player 0 position is, in color clocks (or you
|
|
|
|
can in the future when we implement that feature in the TIA dump!)</p>
|
|
|
|
|
|
|
|
<p>Unlike breakpoints, traps stop the emulation *after* the instruction
|
|
|
|
that triggered the trap. The reason for this is simple: until the
|
2005-10-16 19:53:35 +00:00
|
|
|
instruction is executed, the emulator can't know it's going to hit a
|
|
|
|
trap. After the trap is hit, the instruction is done executing, and
|
|
|
|
whatever effects it may have had on e.g. the TIA state have already
|
2017-12-02 10:34:58 +00:00
|
|
|
happened... but we don't have a way to run the emulated VCS in reverse,
|
2005-10-16 19:53:35 +00:00
|
|
|
so the best we can do is stop before the next instruction runs.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>Traps come in two varieties: read access traps and write access traps.
|
|
|
|
It is possible to set both types of trap on the same address (that's
|
|
|
|
what the plain "trap" command does). To set a read or write only trap,
|
2021-05-07 21:13:28 +00:00
|
|
|
use "trapRead(if)" or "trapWrite(if)".
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2021-05-07 21:13:28 +00:00
|
|
|
<p>All traps appear in "listTraps", numbered starting from zero. You
|
|
|
|
can remove a trap with "delTrap number", where the number comes from
|
|
|
|
"listTraps" or by entering the identical trap again. You can get rid of
|
|
|
|
all traps at once with the "clearTraps" command.</p></p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-03 16:07:47 +00:00
|
|
|
</br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h3><a name="SaveWork">Save your work!</a></h3>
|
2017-12-04 17:06:40 +00:00
|
|
|
<p>Stella offers several commands to save your work inside the debugger for
|
|
|
|
later re-use.</p>
|
2017-12-03 16:07:47 +00:00
|
|
|
|
2017-12-04 17:06:40 +00:00
|
|
|
<ul>
|
|
|
|
<li>
|
2021-05-13 15:26:22 +00:00
|
|
|
<b><a name="savecmd">save</a></b>: If you've defined a lot of complex
|
|
|
|
functions, you probably will want to re-use them in future runs of the
|
|
|
|
debugger. You can save all your functions, breakpoints, conditional breaks,
|
|
|
|
traps and watches with the "save" command. By default it is saved in the
|
|
|
|
user directory with the same as the ROM filename. In this case it will be
|
|
|
|
auto-loaded next time you load the same ROM in Stella. The saved file is
|
|
|
|
just a plain text file called "<rom_filename>.script", so you can
|
|
|
|
edit it and add more functions, etc.
|
|
|
|
<p>Use "autoSave" to automatically execute the "save" command when
|
|
|
|
exiting the debugger.</p>
|
2017-12-04 17:06:40 +00:00
|
|
|
<p>Note: While "save" is ROM specific, you can also create a file called
|
|
|
|
"autoexec.script" which will be loaded when the debugger starts, no matter
|
|
|
|
what ROM you have loaded.<p>
|
|
|
|
See <a href="#Startup"><b>Startup</b></a> for details.
|
|
|
|
</li>
|
|
|
|
<li>
|
2021-05-07 21:13:28 +00:00
|
|
|
<b>saveConfig</b>: The "saveConfig" command creates a
|
2017-12-04 17:06:40 +00:00
|
|
|
<a href="#DistellaConfiguration"><b>DiStella Configuration File</b></a> which is
|
|
|
|
based on Stella's dynamic and static analysis of the current ROM.
|
|
|
|
<p>This will be automatically loaded the next time your start the debugger.
|
2021-05-07 21:13:28 +00:00
|
|
|
From there on, you can continue analyzing the ROM and then use "saveConfig"
|
|
|
|
again to update the configuration. You can also use "loadConfig" to load it
|
2017-12-04 17:06:40 +00:00
|
|
|
manually.
|
|
|
|
<p>Note that this is not tested for multi-banked ROMs.</p>
|
|
|
|
</li>
|
|
|
|
<li>
|
2021-05-07 21:13:28 +00:00
|
|
|
<b>saveDis</b>:
|
2017-12-04 17:06:40 +00:00
|
|
|
While your are playing or debugging a game, Stella will gather dynamic
|
|
|
|
information about the ROM. It can then use that information together with
|
|
|
|
a static analysis of the ROM and therefore create a better disassembly
|
2021-05-07 21:13:28 +00:00
|
|
|
than DiStella alone. "saveDis" allows you to save that disassembly as the
|
2017-12-04 17:06:40 +00:00
|
|
|
result of this combined analysis.
|
|
|
|
<p>Note that this currently only works for single banked ROMs. For larger
|
|
|
|
ROMs, the created disassembly is incomplete.</p>
|
|
|
|
</li>
|
|
|
|
<li>
|
2021-05-07 21:13:28 +00:00
|
|
|
<p><b>saveRom</b>:
|
|
|
|
If you have manipulated a ROM, you can save it with "saveRom". The file is
|
2017-12-04 17:06:40 +00:00
|
|
|
named "<rom_filename>.a26".</p>
|
|
|
|
</li>
|
|
|
|
<li>
|
2021-05-07 21:13:28 +00:00
|
|
|
<p><b>saveSes</b>:
|
|
|
|
The "saveSes" command dumps the whole prompt session into a file named
|
2017-12-04 17:06:40 +00:00
|
|
|
"<YYYY-MM-DD_HH-mm-ss>.txt". So you can later lookup what you did exactly
|
|
|
|
when you were debugging at that time.</p>
|
|
|
|
</li>
|
|
|
|
<li>
|
2021-05-07 21:13:28 +00:00
|
|
|
<p><b>saveAllStates</b>:
|
2019-08-12 07:51:43 +00:00
|
|
|
This command works identical to the save all states hotkey (Alt + F9) during emulation.
|
2021-05-07 21:13:28 +00:00
|
|
|
The saved states can be loaded with "loadAllStates".</p>
|
2019-08-12 07:51:43 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2021-05-07 21:13:28 +00:00
|
|
|
<p><b>saveState</b>:
|
2017-12-04 17:06:40 +00:00
|
|
|
This command works identical to the save state hotkey (F9) during emulation.
|
2021-05-07 21:13:28 +00:00
|
|
|
Any previously saved state can be loaded with "loadState" plus the slot
|
2017-12-04 17:06:40 +00:00
|
|
|
number (0-9).</p>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2017-12-03 16:07:47 +00:00
|
|
|
</br>
|
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<h3><a name="PromptCommands">Prompt Commands</a></h3>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-07-06 23:25:01 +00:00
|
|
|
<p>Type "help" to see this list in the debugger.<br/>
|
|
|
|
Type "help 'cmd'" to see extended information about the given command.</p>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
2005-09-13 18:27:42 +00:00
|
|
|
<pre>
|
2017-11-26 12:42:56 +00:00
|
|
|
a - Set Accumulator to <value>
|
2020-03-29 10:30:26 +00:00
|
|
|
aud - Mark 'AUD' range in disassembly
|
2021-05-13 15:26:22 +00:00
|
|
|
autoSave - Automatically execute "save" when exiting the debugger
|
2017-11-30 15:04:43 +00:00
|
|
|
base - Set default number base to <base> (bin, dec, hex)
|
2021-05-07 21:13:28 +00:00
|
|
|
bCol - Mark 'BCOL' range in disassembly
|
2020-02-03 19:42:20 +00:00
|
|
|
break - Set/clear breakpoint at <address> and <bank>
|
2021-05-07 21:13:28 +00:00
|
|
|
breakIf - Set/clear breakpoint on <condition>
|
|
|
|
breakLabel - Set/clear breakpoint on <address> (no mirrors, all banks)
|
2017-11-26 12:42:56 +00:00
|
|
|
c - Carry Flag: set (0 or 1), or toggle (no arg)
|
|
|
|
cheat - Use a cheat code (see manual for cheat types)
|
2021-05-07 21:13:28 +00:00
|
|
|
clearBreaks - Clear all breakpoints
|
|
|
|
clearConfig - Clear DiStella config directives [bank xx]
|
2021-05-10 18:30:32 +00:00
|
|
|
clearHistory - Clear the prompt history
|
2021-05-07 21:13:28 +00:00
|
|
|
clearSaveStateIfs - Clear all saveState points
|
|
|
|
clearTraps - Clear all traps
|
|
|
|
clearWatches - Clear all watches
|
2017-11-26 12:42:56 +00:00
|
|
|
cls - Clear prompt area of text
|
|
|
|
code - Mark 'CODE' range in disassembly
|
2020-03-29 10:30:26 +00:00
|
|
|
col - Mark 'COL' range in disassembly
|
2021-05-07 21:13:28 +00:00
|
|
|
colorTest - Show value xx as TIA color
|
2017-11-30 15:04:43 +00:00
|
|
|
d - Decimal Mode Flag: set (0 or 1), or toggle (no arg)
|
2017-11-26 12:42:56 +00:00
|
|
|
data - Mark 'DATA' range in disassembly
|
2021-05-07 21:13:28 +00:00
|
|
|
debugColors - Show Fixed Debug Colors information
|
2017-11-26 12:42:56 +00:00
|
|
|
define - Define label xx for address yy
|
2021-05-07 21:13:28 +00:00
|
|
|
delBreakIf - Delete conditional breakIf <xx>
|
|
|
|
delFunction - Delete function with label xx
|
|
|
|
delSaveStateIf - Delete conditional saveState point <xx>
|
|
|
|
delTrap - Delete trap <xx>
|
|
|
|
delWatch - Delete watch <xx>
|
|
|
|
disAsm - Disassemble address xx [yy lines] (default=PC)
|
2020-12-28 11:37:49 +00:00
|
|
|
dump - Dump data at address <xx> [to yy] [1: memory; 2: CPU state; 4: input regs] [?]
|
2017-11-30 12:50:56 +00:00
|
|
|
exec - Execute script file <xx> [prefix]
|
2021-05-07 21:13:28 +00:00
|
|
|
exitRom - Exit emulator, return to ROM launcher
|
2017-11-26 12:42:56 +00:00
|
|
|
frame - Advance emulation by <xx> frames (default=1)
|
|
|
|
function - Define function name xx for expression yy
|
|
|
|
gfx - Mark 'GFX' range in disassembly
|
|
|
|
help - help <command>
|
2021-05-07 21:13:28 +00:00
|
|
|
joy0Up - Set joystick 0 up direction to value <x> (0 or 1), or toggle (no arg)
|
|
|
|
joy0Down - Set joystick 0 down direction to value <x> (0 or 1), or toggle (no arg)
|
|
|
|
joy0Left - Set joystick 0 left direction to value <x> (0 or 1), or toggle (no arg)
|
|
|
|
joy0Right - Set joystick 0 right direction to value <x> (0 or 1), or toggle (no arg)
|
|
|
|
joy0Fire - Set joystick 0 fire button to value <x> (0 or 1), or toggle (no arg)
|
|
|
|
joy1Up - Set joystick 1 up direction to value <x> (0 or 1), or toggle (no arg)
|
|
|
|
joy1Down - Set joystick 1 down direction to value <x> (0 or 1), or toggle (no arg)
|
|
|
|
joy1Left - Set joystick 1 left direction to value <x> (0 or 1), or toggle (no arg)
|
|
|
|
joy1Right - Set joystick 1 right direction to value <x> (0 or 1), or toggle (no arg)
|
|
|
|
joy1Fire - Set joystick 1 fire button to value <x> (0 or 1), or toggle (no arg)
|
2017-11-26 12:42:56 +00:00
|
|
|
jump - Scroll disassembly to address xx
|
2021-05-07 21:13:28 +00:00
|
|
|
listBreaks - List breakpoints
|
|
|
|
listConfig - List DiStella config directives [bank xx]
|
|
|
|
listFunctions - List user-defined functions
|
|
|
|
listSaveStateIfs - List saveState points
|
|
|
|
listTraps - List traps
|
|
|
|
loadConfig - Load DiStella config file
|
|
|
|
loadAllStates - Load all emulator states
|
|
|
|
loadState - Load emulator state xx (0-9)
|
|
|
|
logBreaks - Logs breaks and traps and continues emulation
|
2017-11-26 12:42:56 +00:00
|
|
|
n - Negative Flag: set (0 or 1), or toggle (no arg)
|
|
|
|
palette - Show current TIA palette
|
|
|
|
pc - Set Program Counter to address xx
|
2021-05-07 21:13:28 +00:00
|
|
|
pCol - Mark 'PCOL' range in disassembly
|
|
|
|
pGfx - Mark 'PGFX' range in disassembly
|
2017-11-26 12:42:56 +00:00
|
|
|
print - Evaluate/print expression xx in hex/dec/binary
|
|
|
|
ram - Show ZP RAM, or set address xx to yy1 [yy2 ...]
|
|
|
|
reset - Reset system to power-on state
|
2017-12-02 10:48:34 +00:00
|
|
|
rewind - Rewind state by one or [xx] steps/traces/scanlines/frames...
|
2017-11-26 12:42:56 +00:00
|
|
|
riot - Show RIOT timer/input status
|
|
|
|
rom - Set ROM address xx to yy1 [yy2 ...]
|
|
|
|
row - Mark 'ROW' range in disassembly
|
|
|
|
run - Exit debugger, return to emulator
|
2021-05-07 21:13:28 +00:00
|
|
|
runTo - Run until string xx in disassembly
|
|
|
|
runToPc - Run until PC is set to value xx
|
2017-11-26 12:42:56 +00:00
|
|
|
s - Set Stack Pointer to value xx
|
2021-05-13 15:26:22 +00:00
|
|
|
save - Save breaks, watches, traps and functions to file [xx or ?]
|
2021-05-07 21:13:28 +00:00
|
|
|
saveAccess - Save access counters to CSV file [?]
|
|
|
|
saveConfig - Save DiStella config file (with default name)
|
|
|
|
saveDis - Save DiStella disassembly to file [?]
|
|
|
|
saveRom - Save (possibly patched) ROM to file [?]
|
|
|
|
saveSes - Save console session to file [?]
|
|
|
|
saveSnap - Save current TIA image to PNG file
|
|
|
|
saveAllStates - Save all emulator states
|
|
|
|
saveState - Save emulator state xx (valid args 0-9)
|
|
|
|
saveStateIf - Create saveState on <condition>
|
|
|
|
scanLine - Advance emulation by <xx> scanlines (default=1)
|
2017-11-26 12:42:56 +00:00
|
|
|
step - Single step CPU [with count xx]
|
2021-05-07 21:13:28 +00:00
|
|
|
stepWhile - Single step CPU while <condition> is true
|
2017-11-26 12:42:56 +00:00
|
|
|
tia - Show TIA state
|
|
|
|
trace - Single step CPU over subroutines [with count xx]
|
|
|
|
trap - Trap read/write access to address(es) xx [yy]
|
2021-05-07 21:13:28 +00:00
|
|
|
trapIf - On <condition> trap R/W access to address(es) xx [yy]
|
|
|
|
trapRead - Trap read access to address(es) xx [yy]
|
|
|
|
trapReadIf - On <condition> trap read access to address(es) xx [yy]
|
|
|
|
trapWrite - Trap write access to address(es) xx [yy]
|
|
|
|
trapWriteIf - On <condition> trap write access to address(es) xx [yy]
|
2017-11-26 12:42:56 +00:00
|
|
|
type - Show disassembly type for address xx [yy]
|
2021-05-07 21:13:28 +00:00
|
|
|
uHex - Toggle upper/lowercase HEX display
|
2017-11-26 12:42:56 +00:00
|
|
|
undef - Undefine label xx (if defined)
|
2017-12-02 10:48:34 +00:00
|
|
|
unwind - Unwind state state by one or [xx] steps/traces/scanlines/frames...
|
2017-11-26 12:42:56 +00:00
|
|
|
v - Overflow Flag: set (0 or 1), or toggle (no arg)
|
|
|
|
watch - Print contents of address xx before every prompt
|
|
|
|
x - Set X Register to value xx
|
|
|
|
y - Set Y Register to value xx
|
|
|
|
z - Zero Flag: set (0 or 1), or toggle (no arg)
|
2005-09-13 18:27:42 +00:00
|
|
|
</pre>
|
|
|
|
|
2009-01-13 14:45:34 +00:00
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h2><a name="TIATab"></a><u>(B)</u> TIA Tab</a></h2>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
|
|
|
<p>When selected, this tab shows detailed status of all the TIA registers
|
|
|
|
(except for audio; use the Audio tab for those).</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
<p><img src="graphics/debugger_tiatab.png"></p>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
|
|
|
<p>Most of the values on the TIA tab will be self-explanatory to a 2600
|
2017-11-26 15:26:21 +00:00
|
|
|
developer.<p>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
|
|
|
<p>Many of the variables inside the TIA can only be written to by the
|
2017-12-02 10:34:58 +00:00
|
|
|
6502. The debugger lets you get inside the TIA and see the contents
|
2005-10-16 19:53:35 +00:00
|
|
|
of these variables. These include the color registers, player/missile
|
|
|
|
graphics and positions, and the playfield.</p>
|
|
|
|
|
|
|
|
<p>You can control almost every aspect of the TIA from here, too: most
|
|
|
|
of the displays are editable. You can even toggle individual bits in
|
|
|
|
the GRP0/1 and playfield registers (remember to double-click).</p>
|
|
|
|
|
2020-04-19 08:45:22 +00:00
|
|
|
<p>The buttons allow you to write to any of the strobe registers at
|
|
|
|
any time.</p>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
|
|
|
<p>The collision registers are displayed in decoded format, in a table.
|
|
|
|
You can see exactly which objects have hit what. These are read-only
|
|
|
|
displays; you can't toggle the bits in the current release of Stella. Of
|
2009-01-14 20:31:07 +00:00
|
|
|
course, you can clear all the collisions with the CXCLR Strobe button.</p>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
|
|
|
<p>To the right of each color register, you'll see a small rectangle
|
|
|
|
drawn in the current color. Changing a color register will change the
|
|
|
|
color of this rectangle.</p>
|
|
|
|
|
2017-07-07 22:58:39 +00:00
|
|
|
<p>Both player graphics registers (GRP0 and GRP1) come in two versions:
|
|
|
|
a "new" and an "old" register. Writing GRP0 updates the value in the "new"
|
|
|
|
version of GRP0 and, at the same time, copies the value in the "new" GRP1
|
|
|
|
register into its "old" counterpart. Writing to GRP1 behaves the same way,
|
|
|
|
with the roles of GRP0 and GRP1 switched. The debugger shows both registers,
|
|
|
|
the "old" register being located below the "new" one. If VDEL is off, the
|
|
|
|
TIA displays the content of the "new" register, and the debugger tab reflects
|
|
|
|
this by crossing out the old register. If VDEL is enabled, the TIA displays
|
|
|
|
the "old" register, and the lines are removed in the tab.</p>
|
|
|
|
|
|
|
|
<p>The "enable ball" register (ENABL) also comes in a "new" and an "old"
|
|
|
|
version. The content of "new" is copied into "old" on writes to GRP1, and
|
|
|
|
VDELBL selects the register that is used to control the ball. This is
|
|
|
|
visualized in the debugger in the same way as the two copies of GRP0 and
|
|
|
|
GRP1</p>
|
|
|
|
|
|
|
|
<p>For many registers, writes don't take effect immediatelly as the
|
|
|
|
TIA takes some color clocks to change state. In Stella's TIA core, this
|
|
|
|
is implemented by queueing the writes, and the contents of this queue
|
2017-12-04 18:57:22 +00:00
|
|
|
are visualized in the debugger in the "Queued Writes" area of the TIA tab.</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
|
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h2><a name="IOTab"><u>(C)</u> I/O Tab</a></h2>
|
2009-01-13 14:45:34 +00:00
|
|
|
|
|
|
|
<p>When selected, this tab shows detailed status of the Input, Output,
|
|
|
|
and Timer portion of the RIOT/M6532 chip (the RAM portion is accessed
|
|
|
|
in another part of the debugger).</p>
|
|
|
|
<p><img src="graphics/debugger_iotab.png"></p>
|
|
|
|
|
|
|
|
<p>As with the TIA tab, most of the values here will be self-explanatory to a 2600
|
2017-12-02 10:34:58 +00:00
|
|
|
developer, and almost all can be modified. However, the SWCHx registers need
|
2009-01-14 20:31:07 +00:00
|
|
|
further explanation:<p>
|
2017-12-02 10:34:58 +00:00
|
|
|
<p>SWCHx(W) can be modified; here, the (W) stands for write. Similarly,
|
|
|
|
SWACNT/SWBCNT can be directly modified. However, the results of reading back from
|
2012-01-02 22:09:54 +00:00
|
|
|
the SWCHx register are influenced by SWACNT/SWBCNT, and SWCHx(R) is a read-only display
|
2009-01-14 20:31:07 +00:00
|
|
|
reflecting this result.</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h2><a name="AudioTab"><u>(D)</u> Audio Tab</a></h2>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
2017-12-01 19:57:14 +00:00
|
|
|
<p>This tab lets you view the contents of the TIA audio registers and the effective
|
|
|
|
volume resulting from the two channel volumes.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-01 17:28:13 +00:00
|
|
|
<p><img src="graphics/debugger_audiotab.png"></p>
|
|
|
|
|
2017-12-01 19:57:14 +00:00
|
|
|
<p>This tab will grow some features in a future release.</p>
|
|
|
|
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2009-01-13 14:45:34 +00:00
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h2><a name="TIADisplay"><u>(E)</u> TIA Display</a></h2>
|
2009-01-13 14:45:34 +00:00
|
|
|
|
|
|
|
<p>In the upper left of the debugger, you'll see the current frame of
|
|
|
|
video as generated by the TIA. If a complete frame hasn't been drawn,
|
|
|
|
the partial contents of the current frame will be displayed up to the
|
2021-05-07 21:13:28 +00:00
|
|
|
current scanLine, with the contents of the old frame (in black &
|
2017-12-02 10:34:58 +00:00
|
|
|
white) filling the rest of the display. Note that if 'phosphor mode'
|
2017-07-06 23:25:01 +00:00
|
|
|
or TV effects are enabled, you won't see the effects here; this shows the
|
2017-12-04 13:17:54 +00:00
|
|
|
<b>raw</b> TIA image only.</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
|
2021-05-07 21:13:28 +00:00
|
|
|
<p>To e.g. watch the TIA draw the frame one scanLine at a time, you can
|
2020-04-19 08:45:22 +00:00
|
|
|
use the 'Scan+1' button, the prompt "scan" command or the Control-L key.</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
|
|
|
|
<p>You can also right-click anywhere in this window to show a context menu,
|
|
|
|
as illustrated:</p>
|
|
|
|
<p><img src="graphics/debugger_tiaoutcmenu.png"></p>
|
|
|
|
<p>The options are as follows:</p>
|
|
|
|
<ul>
|
2021-05-07 21:13:28 +00:00
|
|
|
<li><b>Fill to scanLine</b>: This option will draw all scanlines up to the
|
2019-08-12 07:51:43 +00:00
|
|
|
vertical position where the mouse was clicked (see also <a href="#TIAZoom"><b>TIA Zoom</b></a>).</li>
|
|
|
|
<li><b>Toggle breakpoint</b>: Will toggle a conditional breakpoint at the
|
2021-05-07 21:13:28 +00:00
|
|
|
scanLine where the mouse was clicked. You can also use a left-click or
|
2019-08-12 07:51:43 +00:00
|
|
|
the Prompt Tab commands to list and turn off the breakpoint
|
|
|
|
(see also <a href="#TIAZoom"><b>TIA Zoom</b></a>).</li>
|
|
|
|
<li><b>Set zoom position</b>: Influences what is shown in the TIA
|
2017-12-04 18:57:22 +00:00
|
|
|
zoom area (further described in <a href="#TIAZoom"><b>TIA Zoom</b></a>).
|
|
|
|
The zoom area will contain the area centered at the position where the
|
2019-08-12 07:51:43 +00:00
|
|
|
mouse was clicked.</li>
|
|
|
|
<li><b>Save snapshot</b>: Saves the TIA image currently shown,
|
|
|
|
including any current 'effects' (fixed debug colors, partial fill, etc).
|
2014-06-30 19:52:19 +00:00
|
|
|
</li>
|
2009-01-13 14:45:34 +00:00
|
|
|
</ul>
|
2005-10-16 19:53:35 +00:00
|
|
|
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2009-01-13 14:45:34 +00:00
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 18:57:22 +00:00
|
|
|
<h2><a name="TIAInfo"><u>(F)</u> TIA Information</a></h2>
|
2020-10-15 06:30:50 +00:00
|
|
|
<p>To the right of the <a href="#TIADisplay"><b>TIA Display</b></a> area, TIA information is displayed (all values are decimal):</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
<p><img src="graphics/debugger_tiainfo.png"></p>
|
2017-07-06 23:25:01 +00:00
|
|
|
<p>The indicators are as follows (note that all these are read-only):</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
<ul>
|
2020-11-01 22:37:39 +00:00
|
|
|
<li><b>Frame Cycls</b>: The number of CPU cycles that have been executed this frame since
|
2021-05-07 21:13:28 +00:00
|
|
|
VSYNC was cleared at scanLine 0.</li>
|
2020-11-01 22:37:39 +00:00
|
|
|
<li><b>WSync Cycls</b>: The number of CPU cycles that have been skipped by WSYNC this frame since
|
2021-05-07 21:13:28 +00:00
|
|
|
VSYNC was cleared at scanLine 0.</li>
|
2020-11-01 22:37:39 +00:00
|
|
|
<li><b>Timer Cycls</b>: The number of CPU cycles (approximately) that have been used by timer read loops since
|
2021-05-07 21:13:28 +00:00
|
|
|
VSYNC was cleared at scanLine 0.</li>
|
2020-02-03 19:42:20 +00:00
|
|
|
<li><b>Total</b>: The total number of CPU cycles since this ROM was loaded or reset.</li>
|
|
|
|
<li><b>Delta</b>: The number of CPU cycles that have been executed since the last debugger
|
|
|
|
interrupt.</li>
|
2020-10-13 13:11:35 +00:00
|
|
|
<li><b>Frame Cnt.</b>: The number of frames since this ROM was loaded or reset.</li>
|
2021-05-07 21:13:28 +00:00
|
|
|
<li><b>Scanline</b>: The scanLine that's currently being drawn, and the count from the
|
2020-02-03 19:42:20 +00:00
|
|
|
previous frame. Scanline 0 is the one on which VSYNC is cleared (after being set for
|
|
|
|
3 scanlines, as per the Stella Programmer's Guide).</li>
|
2013-08-21 10:53:02 +00:00
|
|
|
<li><b>Scan Cycle</b>: The number of CPU cycles that have been executed since the beginning
|
2021-05-07 21:13:28 +00:00
|
|
|
of the current scanLine.</li>
|
2009-01-13 14:45:34 +00:00
|
|
|
<li><b>Pixel Pos</b>: The current number of visible color clocks that have been displayed on
|
2021-05-07 21:13:28 +00:00
|
|
|
the current scanLine, starting from the beginning of the Horizontal Blank period.
|
2009-01-13 14:45:34 +00:00
|
|
|
During HBLANK, this value will be negative (representing the number of clocks
|
|
|
|
until the first visible one). Since there are 68 color clocks per HBLANK and
|
2021-05-07 21:13:28 +00:00
|
|
|
160 visible clocks per scanLine, the Pixel Position will range from -68 to 159.</li>
|
2013-08-21 10:53:02 +00:00
|
|
|
<li><b>Color Clock</b>: The current number of total color clocks since the beginning of this
|
2021-05-07 21:13:28 +00:00
|
|
|
scanLine's HBLANK. This counter starts at zero, but otherwise displays the same
|
2009-01-13 14:45:34 +00:00
|
|
|
information as the Pixel Position (so Color Clock will always be 68 more than Pixel
|
|
|
|
Position, and will range from 0 to 228).</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h2><a name="TIAZoom"><u>(G)</u> TIA Zoom</a></h2>
|
2017-12-04 18:57:22 +00:00
|
|
|
<p>Below the <a href="#TIAInfo"><b>TIA Information</b></a> is the TIA Zoom area. This allows you to enlarge
|
|
|
|
part of the TIA display, so you can see fine details. Like the
|
|
|
|
<a href="#TIADisplay"><b>TIA Display</b></a> area,
|
|
|
|
this one does generate frames as the real system would.</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
<p>You can also right-click anywhere in this window to show a context menu,
|
|
|
|
as illustrated:</p>
|
|
|
|
<p><img src="graphics/debugger_tiazoomcmenu.png"></p>
|
2019-08-12 07:51:43 +00:00
|
|
|
<p>These options allow you to:</p>
|
|
|
|
<ul>
|
2021-05-07 21:13:28 +00:00
|
|
|
<li><b>Fill to scanLine</b>: This option will draw all scanlines up to the
|
2019-08-12 07:51:43 +00:00
|
|
|
vertical position where the mouse was clicked.</li>
|
|
|
|
<li><b>Toggle breakpoint</b>: Will toggle a conditional breakpoint at the
|
2021-05-07 21:13:28 +00:00
|
|
|
scanLine where the mouse was clicked. You can also
|
2019-08-12 07:51:43 +00:00
|
|
|
the Prompt Tab commands to list and turn off the breakpoint.</li>
|
|
|
|
<li><b>2x|4x|8x zoom</b>: Zoom in on the image for even greater detail.</li>
|
|
|
|
</ul>
|
|
|
|
If you click on the output window, you can zoom with the mouse wheel too. And you can
|
|
|
|
either drag and drop the zoom position with the mouse or you can scroll around using
|
|
|
|
the cursor,
|
2017-12-02 10:34:58 +00:00
|
|
|
PageUp/Dn and Home/End keys. You can also select the zoom position from
|
2017-12-04 13:17:54 +00:00
|
|
|
a context menu in the <a href="#TIADisplay"><b>TIA Display</b></a>.</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h2><a name="BreakpointStatus"></a><u>(H)</u> Breakpoint/Trap Status</a></h2>
|
2017-12-04 18:57:22 +00:00
|
|
|
<p>Below the <a href="#TIAZoom"><b>TIA Zoom</b></a> there is a status line that
|
|
|
|
shows the reason and the address the debugger was entered (if a breakpoint or
|
|
|
|
trap was hit), as shown:</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
<p><img src="graphics/debugger_bpstatus.png"></p>
|
2017-12-02 10:34:58 +00:00
|
|
|
<p>The output here will generally be self-explanatory. Due to space concerns,
|
2017-12-04 18:57:22 +00:00
|
|
|
the reason will be shown as follows:
|
2017-12-04 13:17:54 +00:00
|
|
|
<ul>
|
|
|
|
<li>"CBP:" for conditional breakpoints</li>
|
|
|
|
<li>"BP:" for normal breakpoints</li>
|
|
|
|
<li>"RTrap:" for read traps</li>
|
|
|
|
<li>"WTrap:" for write traps</li>
|
|
|
|
<li>"RTrapIf:" for conditional read traps</li>
|
|
|
|
<li>"WTrapIf:" for conditional write traps</li>
|
2020-03-20 08:37:49 +00:00
|
|
|
<li>"RWP:" for reads from write ports</li>
|
|
|
|
<li>"WRP:" for writes to read ports</li>
|
2017-12-04 13:17:54 +00:00
|
|
|
</ul>
|
|
|
|
</p>
|
|
|
|
See the <a href="#BreakpointsEtc"><b>Breakpoints, watches and traps...</b></a>
|
|
|
|
section for details.</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h2><a name="CPURegisters"><u>(I)</u> CPU Registers</a></h2>
|
2009-01-13 14:45:34 +00:00
|
|
|
<p>This displays the current CPU state, as shown:</p>
|
|
|
|
<p><img src="graphics/debugger_cpuregs.png"></p>
|
|
|
|
<p>All the registers and flags are displayed, and can be changed by
|
2009-06-03 14:49:42 +00:00
|
|
|
double-clicking on them (to the left). Flags are toggled on double-click.
|
2020-04-19 08:45:22 +00:00
|
|
|
Selected registers here can also be changed by using the 'Data Operations' buttons,
|
2017-12-02 10:34:58 +00:00
|
|
|
further described in (J). All items are shown in hex. Any label defined for the
|
|
|
|
current PC value is shown to the right. Decimal and binary equivalents
|
2009-06-03 14:49:42 +00:00
|
|
|
are shown for SP/A/X/Y to the right (first decimal, then binary).</p>
|
2010-11-10 22:38:16 +00:00
|
|
|
<p>The column to the far right shows the 'source' of contents of the respective
|
2017-12-02 10:34:58 +00:00
|
|
|
registers. For example, consider the command 'LDA ($80),Y'. The operand of
|
2010-11-10 22:38:16 +00:00
|
|
|
the command resolves to some address, which isn't always easy to determine at
|
2017-12-02 10:34:58 +00:00
|
|
|
first glance. The 'Src Addr' area shows the actual resulting operand/address
|
2010-11-10 22:38:16 +00:00
|
|
|
being used with the given opcode.</p>
|
2020-03-29 10:30:26 +00:00
|
|
|
<p>The destination address of the last write is shown besides 'Dest'.</p>
|
|
|
|
|
2017-12-04 13:17:54 +00:00
|
|
|
<p>There's not much else to say about the CPU Registers widget: if you know 6502
|
2005-10-16 19:53:35 +00:00
|
|
|
assembly, it's pretty self-explanatory. If you don't, well, you should
|
|
|
|
learn :)</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
|
2009-01-13 14:45:34 +00:00
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h2><a name="DataOpButtons"><u>(J)</u> Data Operations Buttons</a></h2>
|
2017-12-04 18:57:22 +00:00
|
|
|
<p>These buttons can be used to change values in either
|
|
|
|
<a href="#CPURegisters"><b>CPU Registers</b></a>,
|
|
|
|
the <a href="#M6532"><b>M6532/RIOT RAM</b></a> or
|
|
|
|
<a href="#CartridgeRAMInformation"><b>Detailed Cartridge Extended RAM Information</b></a>,
|
|
|
|
depending on which of these widgets is currently in focus.
|
2009-01-13 14:45:34 +00:00
|
|
|
<p><img src="graphics/debugger_dataops.png"></p>
|
|
|
|
<p>Each of these buttons also have a keyboard shortcut (indicated in square
|
2017-12-02 10:34:58 +00:00
|
|
|
brackets). In fact, many of the inputboxes in various parts of the debugger
|
|
|
|
respond to these same keyboard shortcuts. If in doubt, give them a try.</p>
|
2017-12-07 08:45:31 +00:00
|
|
|
<table border="1" cellpadding=4>
|
2017-12-04 18:57:22 +00:00
|
|
|
<tr>
|
|
|
|
<th>Button</th><th>Shortut</th><th>Description</th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>0</td><td><pre>'z'</pre></td><td>Set the current location/register to zero.</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>Inv</td><td><pre>'i' or '!'</pre></td><td>Invert the current location/register (toggle all its bits)</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>Neg</td><td><pre>'n'</pre></td><td>Negate the current location/register (twos' complement negative)</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>++</td><td><pre>'+' or '='</pre></td><td>Increment the current location/register.</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>--</td><td><pre>'-'</pre></td><td>Decrement the current location/register.</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td><<</td><td><pre>'<' or ','</pre></td><td>Shift the current location/register left.</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>>></td><td><pre>'>' or '.'</pre></td><td>Shift the current location/register right.</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<p>Any bits shifted out of the location/register with << or >>
|
|
|
|
are lost (they will NOT end up in the Carry flag).</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2009-01-13 14:45:34 +00:00
|
|
|
|
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h2><a name="M6532"><u>(K)</u> M6532/RIOT RAM</a></h2>
|
2009-01-13 14:45:34 +00:00
|
|
|
<p>This is a spreadsheet-like GUI for inspecting and changing the contents
|
2014-06-30 19:52:19 +00:00
|
|
|
of the 2600's zero-page RAM.</p>
|
2009-06-03 14:49:42 +00:00
|
|
|
<p>You can navigate with either the mouse or the keyboard arrow keys.
|
2020-10-13 13:11:35 +00:00
|
|
|
To change a RAM location, either double-click on it or press 'Enter' while
|
|
|
|
it's highlighted. Enter the new value (hex, other formats using the bottom textboxes), then
|
|
|
|
press 'Enter' to make the change. The currently selected RAM cell
|
2017-12-04 13:17:54 +00:00
|
|
|
can also be changed by using the
|
|
|
|
<a href="#DataOpButtons"><b>Data Operations Buttons</b></a> or the associated
|
|
|
|
shortcut keys.</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
<p><img src="graphics/debugger_ram.png"></p>
|
|
|
|
<p>The 'Undo' button in the upper right should be self-explanatory; it will
|
2017-12-02 10:34:58 +00:00
|
|
|
undo the most previous operation to one cell only. The 'Revert' button is
|
2017-12-04 13:17:54 +00:00
|
|
|
more comprehensive. It will undo <b>all</b> operations on <b>all</b> cells
|
2009-01-13 14:45:34 +00:00
|
|
|
since you first made a change.</p>
|
|
|
|
<p>The UI objects at the bottom refer to the currently selected RAM cell.
|
2017-12-04 13:17:54 +00:00
|
|
|
The 'Label' textbox shows the label attached to this RAM location (if any),
|
2020-10-13 13:11:35 +00:00
|
|
|
and the other three textboxes show the hex, decimal and binary equivalent value.
|
|
|
|
The values can be edited here too.</p>
|
2017-12-04 13:17:54 +00:00
|
|
|
|
|
|
|
<p>The remaining buttons to the right are further explained in the next section.</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
2017-12-04 10:02:36 +00:00
|
|
|
<h3><a name="M6532Search"><u>(L)</u> M6532/RIOT RAM (search/compare mode)</a></h3>
|
2009-06-03 14:49:42 +00:00
|
|
|
<p>The RAM widget also lets you search memory for values such as lives or remaining
|
2005-09-13 18:27:42 +00:00
|
|
|
energy, but it's also very useful when debugging to determine which
|
|
|
|
memory location holds which quantity.</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
<p><img src="graphics/debugger_ramsearch.png"></p>
|
2017-12-04 13:17:54 +00:00
|
|
|
<p>To search the RAM, click 'Search...' and enter a byte value into the search editbox (0-255).
|
|
|
|
All matching values will be highlighted in the RAM widget. If no value was entered,
|
|
|
|
all RAM locations will be highlighted.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2017-12-04 13:17:54 +00:00
|
|
|
<p>The 'Compare...' button is used to compare the given value using all
|
2017-12-02 10:34:58 +00:00
|
|
|
addresses currently highlighted. This may be an absolute number (such as 2),
|
|
|
|
or a comparative number (such as -1). Using a '+' or '-' operator
|
2005-09-13 18:27:42 +00:00
|
|
|
means 'search addresses for values that have changed by that amount'.</p>
|
2013-06-26 16:03:08 +00:00
|
|
|
<p>The 'Reset' button resets the entire operation; it clears the highlighted
|
2009-01-13 14:45:34 +00:00
|
|
|
addresses and allows another search.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
<p>The following is an example of inspecting all addresses that have
|
2009-01-13 14:45:34 +00:00
|
|
|
decreased by 1:</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
<ul>
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Click 'Search...' and then 'OK' (no value entered). All address/values are highlighted</li>
|
|
|
|
<li>Exit debugger mode and lose a life, let your energy decrease, or
|
|
|
|
do whatever it is you're trying to debug</li>
|
|
|
|
<li>Enter debugger mode again, click 'Compare...' and and enter a '-1' for input.
|
|
|
|
This finds all values that have decreased by 1 (as compared to their current
|
|
|
|
values)</li>
|
|
|
|
<li>Repeatedly following these steps may help to narrow number of
|
|
|
|
addresses under consideration, and eventually you'll find the
|
|
|
|
memory address you're looking for</li>
|
|
|
|
<li>Click 'Reset' when you're finished</li>
|
2005-10-16 19:53:35 +00:00
|
|
|
</ul>
|
|
|
|
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2009-01-13 14:45:34 +00:00
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h2><a name="Disassembly"></a><u>(M)</u> ROM Disassembly</a></h2>
|
2013-06-26 16:03:08 +00:00
|
|
|
<p>This area contains a disassembly of the current bank of ROM. If a symbol
|
2017-12-02 10:34:58 +00:00
|
|
|
file is loaded, the disassembly will have labels. Even without a symbol file, the standard TIA/RIOT labels will still be present.</p>
|
2010-11-10 22:38:16 +00:00
|
|
|
<p>The disassembly is often quite extensive, and whenever possible tries to automatically
|
2017-12-02 10:34:58 +00:00
|
|
|
differentiate between code, graphics, data and unused bytes. There are actually two
|
|
|
|
levels of disassembly in Stella. First, the emulation core tracks accesses as a game
|
|
|
|
is running, making for very accurate results. This is known as a <b>dynamic</b> analysis.
|
2020-08-27 06:53:14 +00:00
|
|
|
Second, the built-in DiStella code does a <b>static</b> analysis, which tentatively fills
|
2010-11-10 22:38:16 +00:00
|
|
|
in sections that the dynamic disassembler missed (usually because the addresses haven't
|
|
|
|
been accessed at runtime yet).</p>
|
|
|
|
<p>As such, code can be marked in two ways (absolute, when done by the emulation core),
|
2020-08-27 06:53:14 +00:00
|
|
|
and tentative (when done by DiStella, and the emulation core hasn't accessed it yet).
|
2010-11-10 22:38:16 +00:00
|
|
|
Such 'tentative' code is marked with the '*' symbol, indicating that it has the potential
|
2017-12-02 10:34:58 +00:00
|
|
|
to be accessed as code sometime during the program run. This gives very useful information,
|
2010-11-10 22:38:16 +00:00
|
|
|
since it can indicate areas toggled by an option in the game (ie, when a player dies,
|
2017-12-02 10:34:58 +00:00
|
|
|
when difficulty level changes, etc). It can also indicate whether blocks of code after
|
2010-11-10 22:38:16 +00:00
|
|
|
a relative jump are in fact code, or simply data.</p>
|
|
|
|
|
|
|
|
|
2009-01-13 14:45:34 +00:00
|
|
|
<p><img src="graphics/debugger_rom.png"></p>
|
2005-10-15 16:38:17 +00:00
|
|
|
|
2013-06-26 16:03:08 +00:00
|
|
|
<p>The <B>"Bank state"</B> is self-explanatory, and shows a summary of the current
|
2017-12-02 10:34:58 +00:00
|
|
|
bank information. For normal bankswitched ROMs, this will be the current bank number,
|
|
|
|
however more advanced schemes will show other types of information here. More detailed
|
2017-12-04 13:17:54 +00:00
|
|
|
information is available in <a href="#BankswitchInformation"><b>Detailed Bankswitch Information</b></a>.</p>
|
2010-04-10 20:00:16 +00:00
|
|
|
|
2005-10-15 18:51:16 +00:00
|
|
|
<p>Each line of disassembly has four fields:</p>
|
|
|
|
<ul>
|
2010-04-10 20:00:16 +00:00
|
|
|
<li><b>Breakpoint</b>: This is the area at the far left, to the left of the
|
|
|
|
labels. Normally there will be nothing there: this indicates that there's
|
2005-10-15 18:51:16 +00:00
|
|
|
no breakpoint set at that address. You can set and clear breakpoints by
|
2009-01-13 14:45:34 +00:00
|
|
|
clicking in this area. When a breakpoint is set, there will be a
|
|
|
|
red circle in this area. These are the same breakpoints as used
|
2021-05-07 21:13:28 +00:00
|
|
|
by the <a href="#Breakpoints">break</a> command, <b>not</b> the conditional "breakIf" breakpoints
|
2017-12-04 13:17:54 +00:00
|
|
|
(which makes sense: conditional breaks can break on any condition, the Program
|
2005-10-15 18:51:16 +00:00
|
|
|
Counter isn't necessarily involved).</li>
|
2010-08-19 21:48:28 +00:00
|
|
|
<li><b>Labels</b>: Any labels assigned to the given address, either generated
|
2020-08-27 06:53:14 +00:00
|
|
|
automatically by DiStella, read from a DASM symbol file or custom
|
2017-12-04 13:17:54 +00:00
|
|
|
labels created by the user. If 'Show PC addresses'
|
|
|
|
(see <a href="#DisassemblySettings"><b>ROM Disassembly Settings</b></a>) is enabled,
|
|
|
|
the address will be shown in grey.</li>
|
2010-11-10 22:38:16 +00:00
|
|
|
<li><b>Disassembled bytes</b>: This is either a standard 6502 mnemonic (possibly with operand),
|
2017-12-02 10:34:58 +00:00
|
|
|
or information about graphics and/or data. For instructions, the cycle count will be
|
|
|
|
included, separated by a semicolon. For graphics, a bitmap of the data, and the address
|
|
|
|
of the data is included. For actual data, only the address is included.</li>
|
2010-11-10 22:38:16 +00:00
|
|
|
<li><b>Hex bytes</b>: These are the raw machine bytes for the code/graphics/data.
|
|
|
|
Note that only code, graphics or data will show bytes and can be edited.</li>
|
2005-10-15 18:51:16 +00:00
|
|
|
</ul>
|
|
|
|
|
2010-11-10 22:38:16 +00:00
|
|
|
<p>At this point, we should explain the various 'types' that the disassembler
|
2017-12-02 10:34:58 +00:00
|
|
|
can use. These are known as 'directives', and partly correspond to configuration
|
2020-08-27 06:53:14 +00:00
|
|
|
options from the standalone DiStella program. They are listed in order of
|
2010-11-10 22:38:16 +00:00
|
|
|
decreasing hierarchy:</p>
|
2017-12-07 08:45:31 +00:00
|
|
|
<table border="1" cellpadding=4>
|
2020-03-29 10:30:26 +00:00
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<b>CODE</b>
|
|
|
|
</td><td>
|
|
|
|
Addresses which have appeared in the program counter, or
|
|
|
|
which tentatively can appear in the program counter. These can be edited in hex.
|
|
|
|
</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>
|
|
|
|
<b>GFX</b>
|
|
|
|
</td><td>
|
|
|
|
Addresses which contain data stored in the player graphics registers
|
|
|
|
(GRP0/GRP1). These addresses are shown with a bitmap of the graphics, which
|
|
|
|
can be edited in either hex or binary. The bitmap is shown as large blocks.
|
|
|
|
</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>
|
|
|
|
<b>PGFX</b>
|
|
|
|
</td><td>
|
|
|
|
Addresses which contain data stored in the playfield graphics registers
|
|
|
|
(PF0/PF1/PF2). These addresses are shown with a bitmap of the graphics, which
|
|
|
|
can be edited in either hex or binary. The bitmap is shown as small dashes.
|
|
|
|
</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>
|
|
|
|
<b>COL</b>
|
|
|
|
</td><td>
|
|
|
|
Addresses which contain data stored in the player color registers
|
|
|
|
(COLUP0/COLUP1). These addresses are shown as color constants, which
|
|
|
|
can be edited in hex. The color constant names are depending on the ROM's TV type.
|
|
|
|
</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>
|
|
|
|
<b>PCOL</b>
|
|
|
|
</td><td>
|
|
|
|
Addresses which contain data stored in the playfield color register
|
|
|
|
(COLUPF). These addresses are shown as color constants, which
|
|
|
|
can be edited in hex. The color constant names are depending on the ROM's TV type.
|
|
|
|
</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>
|
|
|
|
<b>BCOL</b>
|
|
|
|
</td><td>
|
|
|
|
Addresses which contain data stored in the background color register
|
|
|
|
(COLUBK). These addresses are shown as color constants, which
|
|
|
|
can be edited in hex. The color constant names are depending on the ROM's TV type.
|
|
|
|
</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>
|
|
|
|
<b>AUD</b>
|
|
|
|
</td><td>
|
|
|
|
Addresses which contain data stored in the audio registers
|
|
|
|
(AUDC0/AUDC1/AUDF0/AUDF1/AUDV0/AUDV1). These can be edited
|
|
|
|
in hex.
|
|
|
|
</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>
|
|
|
|
<b>DATA</b>
|
|
|
|
</td><td>
|
|
|
|
Addresses used as an operand for some opcode. These can be edited
|
|
|
|
in hex.
|
|
|
|
</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>
|
|
|
|
<b>ROW</b>
|
|
|
|
</td><td>
|
|
|
|
Addresses not used as any of the above. These are shown up
|
|
|
|
to 8 per line and cannot be edited.
|
|
|
|
</td>
|
|
|
|
</tr>
|
2010-11-10 22:38:16 +00:00
|
|
|
</table>
|
|
|
|
|
|
|
|
<p>For code sections, the 6502 mnemonic will be UPPERCASE for all standard instructions,
|
2013-06-26 16:03:08 +00:00
|
|
|
or lowercase for "illegal" 6502 instructions (like "dcp"). If automatic resolving
|
|
|
|
of code sections has been disabled for any reason, you'll likely see a lot
|
2017-12-02 10:34:58 +00:00
|
|
|
of illegal opcodes if you scroll to a data table in ROM. This can also
|
2010-08-19 21:48:28 +00:00
|
|
|
occur if the disassembler hasn't yet encountered addresses in the PC.
|
2021-05-07 21:13:28 +00:00
|
|
|
If you step/trace/scanLine/frame advance into such an area, the disassembler
|
2010-08-19 21:48:28 +00:00
|
|
|
will make note of it, and disassemble it correctly from that point on.</p>
|
2005-10-15 18:51:16 +00:00
|
|
|
|
2010-04-10 20:00:16 +00:00
|
|
|
<!-- TODO - is this true any longer?
|
2005-10-15 18:51:16 +00:00
|
|
|
<p>Beware: the cycle counts don't take into account any penalty cycles
|
|
|
|
for crossing page boundaries. All branches are shown as 2 cycles, which
|
|
|
|
is how long they take if the branch isn't taken. Branches that are
|
|
|
|
taken will actually take 3 cycles (plus a penalty cycle if they cross
|
2010-04-10 20:00:16 +00:00
|
|
|
page boundaries).</p> -->
|
2005-10-15 18:51:16 +00:00
|
|
|
|
|
|
|
<p>You can scroll through the disassembly with the mouse or keyboard. To
|
|
|
|
center the display on the current PC, press the Space bar.</p>
|
|
|
|
|
|
|
|
<p>Any time the Program Counter changes (due to a Step, Trace, Frame
|
|
|
|
or Scanline advance, or manually setting the PC), the disassembly will
|
|
|
|
scroll to the current PC location.</p>
|
|
|
|
|
|
|
|
<p>Even though ROM is supposed to be Read Only Memory, this is an
|
2017-12-02 10:34:58 +00:00
|
|
|
emulator: you can change ROM all you want within the debugger. The hex
|
2005-10-15 18:51:16 +00:00
|
|
|
bytes in the ROM Widget are editable. Double-click on them to edit
|
2010-04-10 20:00:16 +00:00
|
|
|
them. When you're done, press Enter to accept the changes (in which case
|
|
|
|
the cart will be re-disasembled) or Escape to cancel them.
|
|
|
|
Note that only instructions that have been fully disassembled
|
2017-12-02 10:34:58 +00:00
|
|
|
can be edited. In particular, blank lines or 'ROW' directives
|
|
|
|
cannot be edited. Also note that certain ROMs can have
|
|
|
|
sections of address space swapped in and out dynamically. As such, changing
|
2010-04-10 20:00:16 +00:00
|
|
|
the contents of a certain address will change the area pointed to <b>at
|
2017-12-02 10:34:58 +00:00
|
|
|
that time</b>. In particular, modifying an address that points to internal
|
|
|
|
RAM will change the RAM, not the underlying ROM. A future release may
|
2010-04-10 20:00:16 +00:00
|
|
|
graphically differentiate between RAM and ROM areas.</p>
|
2005-10-15 18:51:16 +00:00
|
|
|
|
2017-12-04 13:17:54 +00:00
|
|
|
<h3><a name="DisassemblySettings"></a>ROM Disassembly Settings</a></h3>
|
|
|
|
|
2013-06-26 16:03:08 +00:00
|
|
|
<p>The ROM Disassembly also contains a Settings dialog, accessible by right-clicking
|
2009-01-13 14:45:34 +00:00
|
|
|
anywhere in the listing:</p>
|
|
|
|
<p><img src="graphics/debugger_romcmenu.png"></p>
|
2012-05-27 19:27:55 +00:00
|
|
|
<p>The following options are available:</p>
|
2009-01-13 14:45:34 +00:00
|
|
|
<ul>
|
2013-06-26 16:03:08 +00:00
|
|
|
<li><b>Set PC @ current line</b>: Set the Program Counter to the address of the
|
2020-07-24 09:09:01 +00:00
|
|
|
disassembly line where the mouse was clicked.</li>
|
2010-04-10 20:00:16 +00:00
|
|
|
|
2013-06-26 16:03:08 +00:00
|
|
|
<li><b>RunTo PC @ current line</b>: Single-step through code until the Program Counter
|
2020-07-24 09:09:01 +00:00
|
|
|
matches the address of the disassembly line where the mouse was clicked.</li>
|
2010-04-10 20:00:16 +00:00
|
|
|
|
2020-07-24 09:09:01 +00:00
|
|
|
<li><b>Disassemble @ current line</b>: Disassemble from the disassembly line where the mouse was clicked.
|
|
|
|
This allows to fill gaps in the disassembly and is most useful for bankswitched ROMs.</li>
|
2010-11-10 22:38:16 +00:00
|
|
|
|
2020-08-27 06:53:14 +00:00
|
|
|
<li><b>Show tentative code</b>: Allow DiStella to do a static analysis/disassembly.</li>
|
2010-11-10 22:38:16 +00:00
|
|
|
|
2013-06-26 16:03:08 +00:00
|
|
|
<li><b>Show PC addresses</b>: Show Program Counter addresses as labels (where there
|
|
|
|
isn't already a defined label).</li>
|
2010-11-10 22:38:16 +00:00
|
|
|
|
2013-06-26 16:03:08 +00:00
|
|
|
<li><b>Show GFX as binary</b>: Switch between displaying/editing GFX and PGFX sections
|
|
|
|
in either binary or hexidecimal.</li>
|
|
|
|
|
2020-08-27 06:53:14 +00:00
|
|
|
<li><b>Use address relocation</b>: Corresponds to the DiStella '-r' option
|
2020-03-28 08:35:27 +00:00
|
|
|
(Relocate calls out of address range).</br>
|
|
|
|
Note: The code will continue to run fine, but the ROM image will be altered.</li>
|
2012-05-27 19:27:55 +00:00
|
|
|
|
2009-01-13 14:45:34 +00:00
|
|
|
</ul>
|
2005-10-15 18:51:16 +00:00
|
|
|
|
2017-12-04 10:02:36 +00:00
|
|
|
<h3><a name="Limitations">Limitations</a></h3>
|
2005-10-15 18:51:16 +00:00
|
|
|
|
|
|
|
<ul>
|
|
|
|
|
2010-08-19 21:48:28 +00:00
|
|
|
<li>The ROM Widget only works on ROM or zero-page RAM separately. If your game runs
|
|
|
|
code from zero-page RAM, the disassembly will show addresses $80 to $FF (zero-page
|
2017-12-02 10:34:58 +00:00
|
|
|
RAM address space) only. Once your RAM routine returns, the ROM Widget will switch
|
2021-05-07 21:13:28 +00:00
|
|
|
back to ROM space ($1000 - $1FFF and mirrors). The same is true of the "disAsm"
|
2010-08-19 21:48:28 +00:00
|
|
|
command; it will show either ROM or RAM space, not both at the same time.</li>
|
2005-10-15 18:51:16 +00:00
|
|
|
|
|
|
|
<li>The standard VCS memory map has the cartridge port at locations
|
2017-12-02 10:34:58 +00:00
|
|
|
$F000-$FFFF. However, not all the address lines exist on a 6507, so
|
2005-10-15 18:51:16 +00:00
|
|
|
the cartridge port is "mirrored" at every other 4K chunk of address
|
2017-12-02 10:34:58 +00:00
|
|
|
space ($1000, $3000, up to $D000). Some developers find it easier
|
2005-10-15 18:51:16 +00:00
|
|
|
to think of the different banks of ROM as being at different addresses
|
|
|
|
(such as: Bank 0 at $D000 and bank 1 at $F000). When such a ROM runs,
|
|
|
|
the Program Counter can point to one of the mirrors instead of the main
|
2010-04-10 20:00:16 +00:00
|
|
|
area at $F000. This is perfectly OK, and everything works just fine.
|
|
|
|
However, breakpoints are set on actual addresses. If there were a breakpoint
|
|
|
|
set at $F010, and the bank later switched to mirror $D000, the breakpoint
|
|
|
|
will not be shown, and will not break on $D010, even though it's technically
|
|
|
|
the same address.</li>
|
2005-10-15 18:51:16 +00:00
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<p>These limitations will be addressed in a future release of Stella.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2009-01-13 14:45:34 +00:00
|
|
|
|
2013-06-26 16:03:08 +00:00
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h2><a name="BankswitchInformation"><u>(N)</u> Detailed Bankswitch Information</a></h2>
|
2013-06-26 16:03:08 +00:00
|
|
|
|
2017-12-02 10:34:58 +00:00
|
|
|
<p>This area shows a detailed breakdown of the bankswitching scheme. Since
|
2013-06-26 16:03:08 +00:00
|
|
|
the bankswitch schemes can greatly vary in operation, this tab will be
|
|
|
|
different for each scheme, but its specific functionality should be self-explanatory.
|
|
|
|
An example of both 4K (non-bankswitched) and DPC (Pitfall II) is as follows:</p>
|
|
|
|
|
|
|
|
<p><img src="graphics/debugger_banksimple.png"></p>
|
|
|
|
<p><img src="graphics/debugger_bankcomplex.png"></p>
|
|
|
|
|
|
|
|
<p>In many cases, quite a bit of the scheme functionality can be modified.
|
|
|
|
Go ahead and try to change something!</p>
|
|
|
|
|
|
|
|
|
2014-06-30 19:52:19 +00:00
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h2><a name="CartridgeRAMInformation"><u>(O)</u> Detailed Cartridge Extended RAM Information</a></h2>
|
2014-06-30 19:52:19 +00:00
|
|
|
|
|
|
|
<p>If applicable, this area shows a detailed breakdown of any extra RAM supported by
|
2017-12-02 10:34:58 +00:00
|
|
|
the bankswitching scheme. Since the bankswitch schemes can greatly vary in operation,
|
2014-06-30 19:52:19 +00:00
|
|
|
this tab will be different for each scheme, but its specific functionality should be
|
2020-10-15 06:30:50 +00:00
|
|
|
self-explanatory. An example of both F6SC (16K Atari + ram) and DPC (Pitfall II) is
|
2014-06-30 19:52:19 +00:00
|
|
|
as follows:</p>
|
|
|
|
|
|
|
|
<p><img src="graphics/debugger_ram-f8sc.png"></p>
|
|
|
|
<p><img src="graphics/debugger_ram-dpc.png"></p>
|
|
|
|
|
|
|
|
<p>The RAM is shown in a grid similar to how zero-page RAM is shown in M6532/RIOT RAM
|
2017-12-02 10:34:58 +00:00
|
|
|
(K) and (L). See those sections for a description of usage.
|
2014-06-30 19:52:19 +00:00
|
|
|
|
|
|
|
<p>In the cases where RAM is always mapped into the same place in the cartridge
|
2017-12-02 10:34:58 +00:00
|
|
|
address space (such as Sara-chip), the RAM addresses are labeled as such. In other
|
2014-06-30 19:52:19 +00:00
|
|
|
cases, such as when the RAM is either quiescent (and mapped in at different places),
|
|
|
|
or not viewable by the 6507 at all, the RAM addresses are labeled as the cart sees them.
|
2017-12-02 10:34:58 +00:00
|
|
|
In the examples above, F8SC RAM is labeled starting at its read port, or $F080. However,
|
2014-06-30 19:52:19 +00:00
|
|
|
the RAM in the DPC scheme is not viewable by the 6507, so its addresses start from $0.
|
|
|
|
|
2010-11-10 22:38:16 +00:00
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2020-08-27 06:53:14 +00:00
|
|
|
<h1><a name="DistellaConfiguration">DiStella Configuration Files</a></h1>
|
2017-12-04 13:17:54 +00:00
|
|
|
<p>As mentioned in <a href="#Disassembly"><b>ROM Disassembly</b></a>, Stella supports the following directives:
|
2020-03-29 10:30:26 +00:00
|
|
|
CODE, GFX, PGFX, COL, PCOL, BCOL, AUD, DATA, ROW. While the debugger will try to automatically mark address
|
2017-12-02 10:34:58 +00:00
|
|
|
space with the appropriate directive, there are times when it will fail. There are
|
2010-11-10 22:38:16 +00:00
|
|
|
several options in this case:</p>
|
|
|
|
<ol>
|
|
|
|
<li><b>Manually set the directives</b>: Directives can be set in the debugger
|
2021-05-07 21:13:28 +00:00
|
|
|
prompt with the aud/code/col/bcol/gfx/pCol/pGfx/data/row commands. These accept an address range
|
2017-12-02 10:34:58 +00:00
|
|
|
for the given directive type. Setting a range with the same type a second time
|
2010-11-10 22:38:16 +00:00
|
|
|
will remove that directive from the range.</li>
|
|
|
|
<li><b>Use configuration files</b>: Configuration files can be used to automatically
|
2017-12-02 10:34:58 +00:00
|
|
|
load a list of directives when a ROM is loaded. These files can be generated with the
|
2021-05-07 21:13:28 +00:00
|
|
|
'saveConfig' command, and loaded with the 'loadConfig' command. There are also
|
|
|
|
'listConfig' and 'clearConfig' commands to show and erase (respectively) the current
|
2017-12-02 10:34:58 +00:00
|
|
|
directive listing. Upon opening the debugger for the first time, Stella attempts
|
2019-08-31 02:13:27 +00:00
|
|
|
to load a configuration file from the folder containing the ROM. Assuming a ROM named "rr.a26" exists, the config file must be named <i>rr.cfg</i>.
|
2010-11-10 22:38:16 +00:00
|
|
|
</ul>
|
|
|
|
</table>
|
|
|
|
</li>
|
|
|
|
</ol>
|
|
|
|
|
|
|
|
|
2009-01-13 14:45:34 +00:00
|
|
|
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
|
|
|
<br>
|
2017-12-04 10:02:36 +00:00
|
|
|
<h1><a name="HowToHack">Tutorial: How to hack a ROM</a></h1>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>Here is a step-by-step guide that shows you how to use the debugger to
|
|
|
|
actually do something useful. No experience with debuggers is necessary,
|
|
|
|
but it helps to know at least a little about 6502 programming.</p>
|
|
|
|
|
|
|
|
<ol>
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Get the Atari Battlezone ROM image. Make sure you've got the
|
|
|
|
regular NTSC version. Load it up in Stella and press TAB to get to
|
|
|
|
the main menu. From there, click on "Game Information". For "Name", it
|
|
|
|
should say "Battlezone (1983) (Atari)" and for MD5Sum it should say
|
|
|
|
"41f252a66c6301f1e8ab3612c19bc5d4". The rest of this tutorial assumes
|
|
|
|
you're using this version of the ROM; it may or may not work with the
|
|
|
|
PAL version, or with any of the various "hacked" versions floating around
|
|
|
|
on the 'net.</li>
|
|
|
|
|
|
|
|
<li>Start the game. You begin the game with 5 lives (count the tank
|
|
|
|
symbols at the bottom of the screen).</li>
|
|
|
|
|
|
|
|
<li>Enter the debugger by pressing the ` (backquote) key. Don't get
|
|
|
|
killed before you do this, though. You should still have all 5 lives.</li>
|
|
|
|
|
2020-04-19 08:45:22 +00:00
|
|
|
<li>In the RAM display, click the 'Search' button and enter "5" for input.
|
2019-08-12 07:51:43 +00:00
|
|
|
This searches RAM for your value and highlights all addresses that match
|
|
|
|
the input. You should see two addresses highlighted: "00a5" and "00ba".
|
|
|
|
These are the only two addresses that currently have the value 5, so they're
|
|
|
|
the most likely candidates for "number of lives" counter. (However, some
|
|
|
|
games might actually store one less than the real number of lives, or
|
|
|
|
one more, so you might have to experiment a bit. Since this is a "rigged
|
|
|
|
demo", I already know Battlezone stores the actual number of lives.
|
|
|
|
Most games do, actually).</li>
|
|
|
|
|
|
|
|
<li>Exit the debugger by pressing ` (backquote) again. The game will
|
|
|
|
pick up where you left off.</li>
|
|
|
|
|
|
|
|
<li>Get killed! Ram an enemy tank, or let him shoot you. Wait for
|
|
|
|
the explosion to finish. You will now have 4 lives.</li>
|
|
|
|
|
2020-04-19 08:45:22 +00:00
|
|
|
<li>Enter the debugger again. Click the 'Compare...' button in RAM widget and enter
|
2019-08-12 07:51:43 +00:00
|
|
|
a value of 4. Now the RAM widget should only show one highlighted address:
|
|
|
|
"00ba". What we did was search within our previous results (the ones that
|
|
|
|
were 5 before) for the new value 4. Address $00ba used to have the value 5,
|
|
|
|
but now it has 4. This means that Battlezone (almost certainly) stores the
|
|
|
|
current number of lives at address $00ba.</li>
|
|
|
|
|
|
|
|
<li>Test your theory. Go to the RAM display and change address $ba to
|
|
|
|
some high number like $ff (you could use the Prompt instead: enter "ram
|
|
|
|
$ba $ff"). Exit the debugger again (or advance the frame). You should now see lots of lives
|
|
|
|
at the bottom of the screen (of course, there isn't room to display $ff
|
|
|
|
(255) of them!)... play the game, get killed a few times, notice that
|
|
|
|
you have lots of lives.</li>
|
|
|
|
|
|
|
|
<li>Now it's time to decide what sort of "ROM hack" we want to
|
|
|
|
accomplish. We've found the "lives" counter for the game, so we can
|
|
|
|
either have the game start with lots of lives, or change the game
|
|
|
|
code so we can't get killed (AKA immortality), or change the code
|
|
|
|
so we always have the same number of lives (so we never run out, AKA
|
|
|
|
infinite lives). Let's go for infinite lives: it's a little harder than
|
|
|
|
just starting with lots of lives, but not as difficult as immortality
|
|
|
|
(for that, we have to disable the collision checking code, which means
|
|
|
|
we have to find and understand it first!)</li>
|
|
|
|
|
2021-05-07 21:13:28 +00:00
|
|
|
<li>Set a Write Trap on the lives counter address: "trapWrite $ba"
|
2019-08-12 07:51:43 +00:00
|
|
|
in the Prompt. Exit the debugger and play until you get killed. When
|
|
|
|
you die, the trap will cause the emulator to enter the debugger with the
|
|
|
|
Program Counter pointing to the instruction *after* the one that wrote
|
|
|
|
to location $ba.</li>
|
|
|
|
|
|
|
|
<li>Once in the debugger, look at the ROM display. The PC should be at address
|
|
|
|
$f238, instruction "LDA $e1". You want to examine a few instructions before
|
|
|
|
the PC, so scroll up using the mouse or arrow keys. Do you see
|
|
|
|
the one that affects the lives counter? That's right, it's the "DEC $ba"
|
|
|
|
at location $f236.</li>
|
|
|
|
|
|
|
|
<li>Let's stop the DEC $ba from happening. We can't just delete the
|
|
|
|
instruction (it would mess up the addressing of everything afterwards,
|
|
|
|
if it were even possible), but we can replace it with some other
|
|
|
|
instruction(s).
|
|
|
|
|
|
|
|
<p>Since we just want to get rid of the instruction, we can replace it with
|
|
|
|
NOP (no operation). From looking at the disassembly, you can see that
|
|
|
|
"DEC $ba" is a 2-byte long instruction, so we will need two one-byte
|
|
|
|
NOP instructions to replace it. From reading the prompt help (the "help"
|
|
|
|
command), you can see that the "rom" command is what we use to patch ROM.
|
|
|
|
|
|
|
|
<p>Unfortunately, Stella doesn't contain an assembler, so we can't just
|
|
|
|
type NOP to put a NOP instruction in the code. We'll have to use the
|
|
|
|
hex opcode instead.
|
|
|
|
|
|
|
|
<p>Now crack open your 6502 reference manual and look up the NOP
|
|
|
|
instruction's opcode... OK, OK, I'll just tell you what it is: it's $EA
|
|
|
|
(234 decimal). We need two of them, so the bytes to insert will look like:
|
|
|
|
|
|
|
|
<pre> $ea $ea</pre>
|
|
|
|
|
|
|
|
<p>Select the line at address $f236 and enter 'ROM patch' mode. This is done
|
|
|
|
by either double-clicking the line, or pressing enter. Then delete the bytes
|
|
|
|
with backspace key and enter "ea ea". Another way to do this would have been
|
|
|
|
to enter "rom $f236 $ea $ea" in the Prompt widget.
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li>Test your patch. First, set location $ba to some number of
|
|
|
|
lives that can be displayed on the screen ("poke $ba 3" or enter directly into
|
|
|
|
the RAM display). Now exit the debugger and play the game. You should see 3
|
|
|
|
lives on the screen.</li>
|
|
|
|
|
|
|
|
<li>The crucial test: get killed again! After the explosion, you
|
|
|
|
will *still* see 3 lives: Success! We've hacked Battlezone to give us
|
|
|
|
infinite lives.</li>
|
|
|
|
|
2021-05-07 21:13:28 +00:00
|
|
|
<li>Save your work. In the prompt: "saveRom". You now
|
2019-08-12 07:51:43 +00:00
|
|
|
have your very own infinite-lives version of Battlezone. The file will
|
|
|
|
be saved in your HOME directory (NOT your ROM directory), so you might
|
|
|
|
want to move it to your ROM directory if it isn't the current directory.
|
2013-06-26 16:03:08 +00:00
|
|
|
</li>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
2019-08-12 07:51:43 +00:00
|
|
|
<li>Test the new ROM: exit Stella, and re-run it. Open your ROM
|
|
|
|
(or give its name on the command line) and play the game. You can play
|
|
|
|
forever! It worked.</li>
|
2005-09-13 18:27:42 +00:00
|
|
|
</ol>
|
|
|
|
|
|
|
|
<p>Now, try the same techniques on some other ROM image (try Pac-Man). Some
|
|
|
|
games store (lives+1) or (lives-1) instead of the actual number,
|
2010-04-10 20:00:16 +00:00
|
|
|
so try searching for those if you can't seem to make it work.</p>
|
2005-09-13 18:27:42 +00:00
|
|
|
|
|
|
|
<p>If you successfully patch a ROM in the debugger, but the saved version
|
|
|
|
won't work, or looks funny, you might need to add an entry to the
|
|
|
|
stella.pro file, to tell Stella what bankswitch and/or TV type to use.
|
|
|
|
That's outside the scope of this tutorial :)</p>
|
|
|
|
|
|
|
|
<p>Of course, the debugger is useful for a lot more than cheating and
|
|
|
|
hacking ROMs. Remember, with great power comes great responsibility,
|
|
|
|
so you have no excuse to avoid writing that game you've been thinking
|
|
|
|
about for so long now :)</p>
|