Commit Graph

574 Commits

Author SHA1 Message Date
stephena 113f32b7e1 Moved initialization of TIADebug from Console to Debugger, since the Console
doesn't really need to know about it, and it belongs to the debugger anyway.

Fixed some makefile issues:
Pure C programs were being compiled with 'cc', when 'g++' (or equivalent)
should have been used.

Only pre-define the compiler flags to include '-O2' if the user doesn't
have a CXXFLAGS env variable set.  Sometimes I want to use '-g', and in
that case I want to override the internal '-O2'.

Fixed TIASound code to not use its own type definitions, and instead use
the ones from bspf.hxx.  Eliminates requirement of specifying -DWIN32,
even when the host system wasn't Win32.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@583 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-29 13:11:03 +00:00
urchlay c64d9b5f64 "tia" command actually starting to do something useful, still needs a
lot more.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@582 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-29 04:23:42 +00:00
urchlay 741efd226a Added label support in disassembler for (indirect), (indirect,x), and
(indirect),y addressing modes.

Added scanline and frame counters to prompt. They're showing the wrong
values during stepping right now :(


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@581 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-29 03:43:38 +00:00
urchlay b2903a36ca Moved frying support from the Debugger to the Console. Also, frying now
occurs once per frame, as long as the backspace key is held down
(previously it happened once per keypress only). Haven't decided
whether this is an improvement or not, need more testing

Also, added missing -O2 to new Makefile.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@580 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-29 00:31:49 +00:00
stephena 77f4c8e007 Second pass at configure support; it actually seems to work this time.
I've only tested it in 32bit Linux, but I don't forsee any problems.
Dependencies seem to work correctly, recompiling parts of the codebase
as necessary.

New files added to the codebase must be listed in the 'module.mk' file
in the same directory where the new file is placed.  Other then that,
no configuration is required.

All configurable options are by default enabled.  They can be manually
disabled by an appropriate command to the configure script, but the
script is smart enough to test for the required libraries and disable
support when one isn't found.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@579 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-28 23:18:16 +00:00
stephena d12f199847 First pass at configure support (no more editing makefiles). This is
adapted from the ScummVM build process, and isn't as big and nasty as
full autoconf support.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@578 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-28 18:56:49 +00:00
urchlay 6283d35618 One-liner fix for "sticky trap" bug pointed out by Lee Fastenau: the
justHitTrap flag wasn't getting reset after a trap was hit.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@577 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-28 12:20:06 +00:00
urchlay 7366c31b3d Added -holdstart, -holdreset, -holdbutton0 command line options. These
should also be selectable from the GUI. They might also need to include
more controls, but these seems to be the ones that cause interesting
effects: -holdreset gives you double shots in space invaders,
-holdbutton0 gives you "the dot" in carnival.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@576 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-28 04:40:21 +00:00
urchlay b500522dda savestate and loadstate commands for the debugger, which do the same thing
as the regular emulator F9 and F11 save/load state. Will add the debugger
state to the statefile in future.

"Frying" support, using Fred Quimby's code from [stella]. Press Backspace
during emulation (or slam it repeatedly like you would the power button
on a real 2600). So far I've been able to duplicate the classic frying
effects from Space Invaders (double shots) and H.E.R.O. (infinite lives).
Also added a "fry" command to the debugger, but it's not very useful
(you need visual feedback when trying to duplicate a known effect,
so the emulator should be running).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@575 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-28 03:34:41 +00:00
urchlay 0dd6f51378 Check that bank is valid before switching to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@574 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-28 01:53:41 +00:00
urchlay 6e4bcb0fc8 ROM-patching and debug-bankswitching fixes.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@573 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-28 01:31:32 +00:00
urchlay 32e1296946 Support debugger bankswitching in almost all cart types.
Support patching ROM in almost all cart types.

The ones that aren't supported are going to take a bit more thought.

Still TODO is to support the extra RAM in carts that have it.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@572 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-28 01:15:17 +00:00
urchlay 8aeb65d4b7 patch() methods for various Cart classes. Still a work in progress,
but we can now change ROM from the debugger on a good chunk of the games
out there.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@571 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-27 23:40:36 +00:00
urchlay ec0accd4a2 Initial support for ROM patching: a "rom" command in the prompt that acts
like the "ram" command. Each Cart type needs its own patch() method to
allow changing ROM. So far, only Cart4K has a working patch() method:
all other cart types inherit Cartridge::patch(), which does nothing and
returns false.

TODO: saverom command?


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@570 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-27 15:07:54 +00:00
urchlay dfdc9de1a9 Updated Debugger.txt doc
Debugger bankswitch support for a few cart types


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@569 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-27 12:43:49 +00:00
urchlay 8ad0d445c3 Bare beginnings of bankswitching support for the debugger.
Unfortunately every single Cart class will have to be touched to make
this work, and there are 20 of them. Currently only CartF8 has the
necessary methods.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@568 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-27 04:45:52 +00:00
urchlay 865416aacd First pass at command completion. Actually this may be the only pass: it
seems to be working just fine.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@567 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-27 03:32:51 +00:00
urchlay 408a90142a New parser + command structure is 95% complete. Argument validation is
a lot better now. There shouldn't be any more crashes due to missing
error checking, as the error checking is done by the parser now, instead
of by each command (so I can't forget it now). Also, now that the commands
are stored in an array, I can start on tab-completion for commands.

TODO: validate multi-byte arguments (e.g. the data for the "ram" command).
Currently the command works, but will accept values that don't fit into
a byte. Also validate multi-word arguments, though we don't have any
commands that use them yet.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@566 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-27 01:36:03 +00:00
stephena 6382ab8e47 Fixed compile-time error where not including snapshot support would cause
compiling to fail.  Since ZIP support was added, we always need to link
to the zlib library, not just when we want snapshot support.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@565 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-26 13:08:43 +00:00
stephena 900157b6b4 Updated version for another alpha release.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@564 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-25 17:26:32 +00:00
stephena ed82864152 Fixed bug where no key events were being sent to any Tab child widget
that had WIDGET_TAB_NAVIGATE set (which is exactly the opposite of
what we want).

Added a dashed line to FrameBuffer::frameRect().  This is currently
used to indicate which widget is selected in debugger mode.  IMO, it
looks much better than using a solid line.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@563 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-25 16:35:36 +00:00
urchlay a935b2bcaf Documented tab completion
One more tab completion fix: made it work when the character before the
label wasn't a space (e.g. "pr *w" now completes to "pr *WSYNC")


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@562 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-25 06:54:20 +00:00
urchlay c7cf7743e3 Beginnings of new parser stuff: a struct to represent a command, including
name, description, argument count & types, and a method pointer to
actually execute the command. Instance method pointers in C++ are even
more annoying that function pointers in C...

The actual parser (the run() and getArgs()) methods don't use the new
stuff, so the actual operation of the debugger is unchanged.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@561 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-25 06:27:01 +00:00
urchlay 4e065da8ed Fixed blank-line buglet in completion.
Also, minimum length command line to attempt label completion is now 2.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@560 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-25 01:25:13 +00:00
urchlay e607410e1f Label completion behaves almost identical to bash completion now. If you
have labels "food" and "foobar", and no others starting with "f", and you
type "pr f<TAB>", it will show you both of them, then leave your prompt
looking like "pr foo" with the cursor after the 2nd "o".

Differences from bash:

- In case of multiple completions, bash's default behaviour requires you
  to press Tab twice to see them. We only need one Tab. bash can actually
  be configured to only need one Tab, too.

- We don't beep. Ever.

- We're case-insensitive. bash is case-sensitive by default, though it
  can be configured to be insensitive.

There's one remaining bug in the completion: when we get to the bottom of
the scroll buffer, and the buffer is full (e.g. when the scroll bar handle
is at its minimum size), *and* there's only one possible completion, the
console prints a new blank line after the new (completed) prompt.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@559 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-25 01:13:00 +00:00
stephena b97d1937de Each bit in the CPU processor status register can now be toggled in
the CpuWidget.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@558 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-24 17:46:11 +00:00
urchlay 6efeb3238b added Debugger::setC(bool) and family, for explicitly setting a CPU flag
DebuggerParser flag-setting commands now take one optional argument, to
support the above.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@557 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-24 16:36:41 +00:00
urchlay d7fa47f917 Somehow I forgot to commit this before: added toggleB() and toggleI()
flag methods to Debugger.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@556 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-24 13:51:57 +00:00
urchlay cfac69f4e5 Fixed parser problem that Steve found. Checking this in "blind" (can't
compile: missing ToggleBitWidget.[ch]xx)


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@555 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-24 12:10:31 +00:00
stephena ff49f7d3b1 Added infrastructure whereby any tab area (in a TabWidget) that doesn't
want to navigate with the TAB key will actually receive the key (ie, it
won't be swallowed).

Updated PromptWidget to use the TAB key for command completion (Escape
is still used as well).

Added 'Alt t' and 'Alt s' for 'Trace' and 'Step' (respectively) to the
debugger area.  These keys are accessible while in any tab, since the
buttons (and associated actions) don't belong to any particular tab.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@554 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-24 12:01:27 +00:00
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