Commit Graph

594 Commits

Author SHA1 Message Date
stephena c8e4156e4a Oops, forgot to add the ToggleBitWidget class.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@553 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-24 11:05:00 +00:00
urchlay 18aebd77c9 First pass at label completion in prompt. Since Tab is used for switching
between widgets, I used Escape as the completion key. It's almost working
correctly, but the implementation should be cleaned up.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@552 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-24 00:03:39 +00:00
stephena 7db440c0b1 Added ToggleBitWidget, which is very similar to the DataGridWidget, except
instead of editing values, you toggle values.

Implemented the processor status register as a ToggleBitWidget, since most
people are more familiar with the separate bits (vs. the actual value of the
byte).

Currently, the toggle signal is sent to the CpuWidget, but the register
itself isn't changed.  Brian, I only see toggleX() methods for 5 of the
bits, but there are 7 used.  Is that intentional, because if the other two
aren't meant to be used, I need to remove the visual cue that they're
being toggled.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@551 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-23 18:11:59 +00:00
stephena 92a7352e30 Reworked the FrameBuffer update system so that TIA updates and overlay
updates are actually two separate things (and often done independently).

Previously, the only overlay was the menu, and since this was always drawn
over the TIA, updating one or the other was the same thing.

Now, the debugger area can be updated without affecting the TIA, since
technically it isn't really an overlay (it doesn't sit on top of the TIA).

There are still some TODO's wrt using dirty rectangles instead of full
updates, but at least the full updates are now restricted to just the
overlay area.

Fixed multiple frame step in the PromptWidget by changing
FrameBuffer::advance() to advance a given number of frames.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@550 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-23 14:33:12 +00:00
urchlay cbd3258604 Implemented "reload" command, reloads ROM and symbol files. Debugger
PromptWidget gets reset, but not the Debugger itself, so any breaks,
traps, or watches are still there (though watches might depend on
symbols that aren't defined in the newly-loaded file).

When reloading, we do NOT check to see whether the ROM has changed.
This is deliberate: the user might leave the debugger open while he
assembles a new version of his game (I probably would).

TODO: reload symbol file if it doesn't get autoloaded the first time
TODO: don't reset the prompt history on reload
TODO: after the symbol file's loaded, clear any watches that are no
      longer valid (e.g. symbol not defined any more)


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@549 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-23 02:56:45 +00:00
urchlay 4a1038257d "frame" command now takes an optional count and advances that many
frames. With no argument, advances 1 frame.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@548 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-23 02:13:49 +00:00
urchlay 0a207b50ce This fixes the "stale prompt syndrome" for the "frame" command, but I'm
not 100% sure it doesn't break anything else. Steve...?


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@547 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-23 02:10:11 +00:00
urchlay a9609b026a Got rid of M6502Low class. No ROM uses it any more, and hasn't for at
least 6 months now. This shouldn't affect anyone running Stella on a
CPU faster than a pentium-166 or -200 anyway.

Implemented a few new debugger commands: "listtraps", "saveses", "savesym",
"undef", and renamed "label" to "define"... See the console help for
details.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@546 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-23 01:10:26 +00:00
stephena 4238125b69 Updates for VC++ .net project.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@545 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-23 00:38:14 +00:00
urchlay a372543f0e Fixed bug that kept us from parsing symbol files if any symbol was longer
than 24 characters. Thanks to Rich Boniface for pointing out the bug.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@544 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-22 20:25:20 +00:00
stephena e8102b3ec3 Made EditableWidget take a flag that disables editing (ie, read-only).
Added decimal, binary, and label fields to the RamWidget, which contain
values for the currently selected cell.

Added label, current instruction, cycle count, and status (breakpoint or
trap set) fields to the CpuWidget.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@543 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-22 18:30:44 +00:00
urchlay 06ef6f0ee2 Exposed breakpoints(), readtraps(), writetraps() public methods
in Debugger, for use by the GUI


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@542 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-22 13:00:58 +00:00
stephena 4c790bcbd5 Eliminated final Valgrind complaints about uninitialized data. The rest
occur in libraries, so there's not much I can do about those.

Eliminated memory leaks in DebuggerParser by using the GUI::Array class.
This is basically a dynamically sized array implementation.  As a result,
there's no longer a hardcoded limit on the # of arguments or watches.

Brian, this new array class is a bit different than raw arrays in the
following ways:

1)  You add to it with push_back().  You *can* add to it with index
notation, but it will assert and exit if you attempt to walk past the
end of it.

2)  Because it's dynamically sized, you can't assume it has 100
elements (or even 1 element).  That's why push_back() should be used
for assignment, unless you check the bound of the index first.

2)  It has a size() method, so you always know how far to walk it.

3)  You can erase all items with clear().

4)  It makes use of templates, so is quite fast.

5)  The syntax is close to STL containers. so when we eventually
move to a faster container (hashmap, etc), minimal syntax changes
will be required.

6)  And finally, it frees you from having to deal with memory issues
(new/delete or malloc/free).

Have a look at gui/Array.hxx (which probably should be moved to
common/Array.hxx at some point).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@541 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-21 23:01:25 +00:00
urchlay 1ff07b3be2 Documentation for debugger commands, breakpoints, traps, watches.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@540 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-21 19:33:41 +00:00
stephena f6d40c4700 Fixed some Valgrind errors, mostly non-initialized data.
Fixed some memory leaks in EquateList, and moved to using a dynamic array.
This greatly simplifies the code and abstracts away all new/delete
operations.  More cleanup can still be done, since the symfile no longer has
to be scanned for # of lines.  Still TODO is similar code for the watchlist
stuff, so all memleaks can be eliminated.

Changed launcher so that if Stella is started with no romdir specified
(maybe first time it's been used), the launcher options are shown so
you can select the romdir.  Thanks to Brad for the advice.

Updated LauncherOptionsDialog to send a signal when a romdir has been
set.  When that happens, the launcher automatically reloads the rom listing.
Again, thanks to Brad for the advice.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@539 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-21 18:46:34 +00:00
urchlay 88108e44f0 Traps now work. Had to be done in the M6502 class, not System.
Unfortunately, there's no way to trap a memory access before it happens.
Unlike breakpoints, traps can occur in mid-instruction. We can't stop
the 6502 in mid-instruction, and wouldn't want to if we could (for one
thing there's no way to continue from that point). This means that, when
you hit a trap, the current instruction is the one *after* the one that
triggered the trap. (This is different from a breakpoint: when you hit
a breakpoint, the current instruction will be the one at the breakpoint,
which hasn't executed yet).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@538 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-21 05:00:46 +00:00
urchlay bb47a4b341 Added initial trap support. It doesn't quite work yet: when I hit a
trap, the PC keeps getting reset to the start of the frame. FYI,
traps are like breakpoints, only they trigger on any access of the
trap location (e.g. loading data from it, rather than executing it
as a breakpoint).

Fixed two nasty bugs:

1. Debugger::disassemble() was printing hex bytes from the wrong address.
This is because I used readRAM(), which wants a parameter of 0-127, and
reads only from RAM. I *should* have been using peek(), which takes a
16-bit address. In fact, readRAM() is only for the GUI.

2. D6502::disassemble() was printing wrong operands in zero,x and
zero,y addressing modes, due to me passing a wrong number of places
(and thus creating a wrong format string).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@537 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-21 04:30:49 +00:00
stephena 8f49bb5d88 A few fixes for the Win32 VC++ .net build.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@536 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-21 01:05:49 +00:00
urchlay 9a2d410a4d Watch support: you can set up to 10 arbitrary expressions which will get
evaluated and printed before each prompt. Since they're evaluated at
print-time, you can say e.g. "watch a" or "watch *myCounter" and it'll
do what you want.

Added "dump" command. This dumps any address you give it, not just RAM,
and it respects the current base setting (bin, dec, hex). Actually I may
rename the "ram" command to "mem" and allow it to work on non-RAM, and
merge the "dump" command with that.

The debugger state() now respects the default base (the registers are
printed in whatever base the user has selected with the "base" command).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@535 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-21 00:13:49 +00:00
stephena 5433918ba7 Cleaned up the 'string to value' and 'value to string' methods.
Added PC, SP, A, X, Y registers to the CpuWidget.  These registers
can now be changed and viewed while stepping/tracing.

Still TODO is add a ToggleBitWidget to enable toggling of the
individual bits in the Processor Flag register.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@534 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-20 21:01:37 +00:00
stephena b20a2ffc32 Added first pass of CpuWidget.
Renamed ByteGridWidget to DataGridWidget, because it can be used to accept data
other than bytes (also words).

Further work on making the GUI use whichever base you set as default.  This
one seems to be a hard nut to crack.

Changed behaviour of '-debugheight' to specify the number of lines to use
for the debugging area, vs the absolute pixels to use.  So '-debugheight 20'
would make the debugger be 20 lines tall (in the PromptWidget).  The minimum
height is now 15 lines, and all GUI elements will be drawn according to this.

Still TODO is get the 'height' command to work in the debugger.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@533 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-20 18:32:12 +00:00
urchlay f3fd39be4c Debugger::parseArgument() now takes an optional outputBase parameter,
which defaults to kBASE_DEFAULT (which means to use the DebuggerParser's
current input base, set with the "base" command).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@532 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-20 02:36:39 +00:00
urchlay 7051819948 Added -debug command line option to make Stella start in the debugger.
Added -debugheight command line option. The height may not be set to
anything below 383 (which is the default).

Attempted to implement a "height" command in the prompt, but either I'm
doing something wrong (most likely), or the debugger can't be resized
after it's started.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@531 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-19 16:53:57 +00:00
urchlay 2afcf0cd4f DebuggerParser::parseArg now properly formats its string result, depending
on the current default base.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@530 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-19 08:37:29 +00:00
urchlay b5b07d41ed Reworked argument processor. Now it can be called as a public method from
another class. Also added decimal support, plus default base support. As
a side benefit, there's much better syntax checking.

Also you can now do a word-pointer dereference with "@address". This
works just like "*address" except that it returns a 16-bit value.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@529 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-19 08:29:40 +00:00
urchlay cb6232cc25 Implemented prefix operators < and > (low byte and high byte) in CLI.
They work just like the ones in DASM: "<1234" is "34" and ">1234" is "12".
They can of course be used with labels, and they can be prefixed with "*"
for dereference.

Implemented binary input in CLI. Like DASM: prefix with "%" to treat
your argument as binary. "%10101010" means hex "ff". Can be stacked with
other prefixes.

Stacking order of prefixes is important. "*" must come first, if present.
Then ">" or "<" if present (but not both!). Then "%" if present. Currently
there's no real error checking for this.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@528 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-18 19:00:44 +00:00
urchlay 5378b2c971 Added register names to argument processing. This means you can set e.g.
location 80 to the contents of the X register by saying "ram 80 x". This
also means that there's a small conflict: if you're inputting the value
0x0a (decimal 10), you need to either say "0a" or "A". Otherwise the
parser thinks you're talking about the "a" register instead of the hex
number "a".

Added dereference operator to arg processing. This works the same way as
in C: you prefix a "*" to an argument. So "80" means a literal hex 80,
as before, but you can say "*80" to mean "the memory location pointed to
by location 80"... this also works with the registers. Example: if the X
register holds the value ff, you can say "*x" and it will be treated as
the value ff. Unlike C, multiple levels of dereference are not supported.
Also, the result of a dereference is always a byte for now.

Added "eval" command to debugger prompt. This evaluates one or more
arguments (which may hex values or a labels, and may have a * in front)
and prints the results in hex, binary, and decimal, along with the label
that has that value, if any.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@527 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-18 17:28:18 +00:00
urchlay a92a6b0ab8 Implemented missing "clearbreaks" command in prompt. This command nulls
out the M6502's breakPoints, so any speed decrease caused by breakpoint
checking logic should go away after breakpoints are cleared.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@526 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-18 15:45:05 +00:00
stephena 17d72c8d12 Updated debugger.txt with info on cheat system. This document will
eventually become part of the main HTML manual.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@525 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-18 13:45:34 +00:00
urchlay e681c06799 Added "frame" command to the prompt, identical to the Frame+1 button.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@524 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-18 07:12:53 +00:00
urchlay 999f4b52b6 Initial documentation for the debugger. Also changed negate button label
in RAM tab from "~" to "Neg". ~ is the invert/complement operator in C,
not negation. I thought about using a minus sign, but it's visually too
similar to the -- for decrement...


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@523 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-18 06:59:43 +00:00
stephena fc6401eb2f Updates for the VC++ project file. Fullscreen OpenGL support in Win32
is currently somewhat broken, and I'm thinking this may be related to the
mysterious OpenGL Linux problems as well.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@522 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-18 00:51:15 +00:00
urchlay eaa8fa898b Implemented "disassemble" command in prompt, in case you want to see more
code than the current line.

On ROM load, we replace the file extension with .sym and attempt to load
that as a symbol file for the debugger. No harm is done if the file is
missing.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@521 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-17 21:59:54 +00:00
stephena 09bb356f52 Added zero, invert, negate, increment, decrement, shift left and shift right
buttons to the RamWidget.  They operate on the currently selected memory
location.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@520 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-17 21:46:24 +00:00
stephena 53fb6d00d4 Fixed problem with changing RAM locations and input longer than 2 hex digits.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@519 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-17 18:17:15 +00:00
stephena f58a258b94 Added 'Frame Advance' and 'Exit' buttons to the DebuggerDialog. Advancing
the frame by 1 can be very useful, in that you can change a memory location,
do a frame advance, and then see any results graphically.

Eventually the trace and step will work the same way, and show changes
to the scanline as it's being drawn.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@518 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-17 17:34:01 +00:00
stephena 07ea0bbae1 Re-added (center) commandline argument, which was in a previous version
of Stella.  It defaults to true/on, so if you don't want centering, use
'-center false' on the commandline at least once (or edit the config file).

Some more work on the RamWidget and ByteGridWidget.  Entering values in hex
now works correctly, and 128 byte RAM area is now updated.

More work on the automatic updating of the tabs.  Tabs are now updated when
debugging mode is entered, or when a new tab is selected.

Shortened the width of the debugging tab area and added an area for commonly
use actions/buttons on the right.  Currently it contains 'Step' and 'Trace'
buttons.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@517 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-17 14:42:49 +00:00
urchlay 379aa0c3ed Major surgery on the breakpoint support. It all seems to work correctly
now: set/clear a breakpoint, clear all breakpoints, list breakpoints
(including labels in the output!). The 6502 no longer gets "stuck" on a
breakpoint if you quit the debugger while the current PC is a breakpoint.

Some work on the prompt console. The CPU state information shouldn't be
stale any more.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@516 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-17 03:49:10 +00:00
stephena f1617b1db8 Further work on the RamWidget. It now shows row labels in hex, but I
may not be able to add column labels because we need the vertical space
for buttons.  Also, the ByteGrid is now drawn correctly.

Added initial infrastructure for a tab to reload itself, either on command
or when a new tab is selected.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@515 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-16 22:18:02 +00:00
stephena 028f95768d First pass at the RAM input widget.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@514 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-16 18:40:17 +00:00
urchlay ee8e3fcd0c Got rid of SDL window-centering option, so the $#@#^ window will stay put
when switching between debugger and emulator mode.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@513 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-16 16:36:49 +00:00
stephena 05d67232a6 Only start/exit the debugger when necessary (don't start it when it's
already going, and don't stop when it isn't).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@512 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-16 16:26:27 +00:00
urchlay 33155b9138 The processor state + disassembly now appears as part of the prompt,
rather than the result of each command. This makes breakpoints a little
nicer (you see the state as soon as you hit the breakpoint).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@511 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-16 16:18:57 +00:00
stephena 9473ca0dd5 Added support for informing the M6502 of the debugger, so it can call it
directly.

Updated M6502 classes to call Debugger::start when a breakpoint is hit.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@510 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-16 12:28:54 +00:00
urchlay c693074377 Partial breakpoint support: the "break" command in the console sets &
clears breakpoints, and the 6502 core emits a "hit breakpoint" message
to standard error when it sees a breakpoint. Still TODO is to figure out
how to enter the debugger from within the 6502 core! (Stephen?)


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@509 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-16 02:16:26 +00:00
stephena 008c49e507 More copyright fixes.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@508 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-16 01:11:29 +00:00
stephena 7d9fc41053 Updated the copyright notice on all files.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@507 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-16 00:56:00 +00:00
stephena f42399092d Added border around active widget. Currently it's drawn in an ugly red
color; this will have to change.  This makes it much easier to navigate
with the keyboard, since it's now easy to see which widget you've tabbed to.

Added some copyright stuff to the debugger classes.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@506 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-16 00:20:12 +00:00
urchlay bbd77f6a51 Cleaned up equateList stuff. Now there's only one instance, in the
Debugger, which gets used by both DebuggerParser and D6502, but
neither one keeps a pointer to it permanently.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@505 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-15 23:45:04 +00:00
stephena 1b332ef8f0 The CheatWidget seems complete; RAM contents can now be changed.
Still TODO is somehow draw around the currently active widget,
to show which widget is actually active.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@504 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-15 21:18:47 +00:00