(back to top)
AppleWin Debugger Cheat Sheet
The debugger built into AppleWin
is extremely handy when figuring out how bits of code work. This is a quick
guide to the essentials for people who have some familiarity with debuggers.
- Pause emulation and enter the debugger with F7. You can close the
debugger the same way, or use "g [enter]".
- There's lots of ways to configure the display. The three most
important are:
- Code display. Type "code [enter]". This gets you a code listing on
the left and a bunch of register and softswitch info on the right.
(This is the default on entry.)
- Data display. Type "data [enter]". Switches to a hex dump
of memory. The single-step commands still work in this mode.
- Console display. Type "[enter]" by itself. Useful if you want to
read some help text more than 5 lines at a time. Hitting "[enter]"
again goes back to the previous mode.
- In Code mode, use [space] to single-step, Shift+[space] to continue
to the next RTS (or "rts [enter]"), and Ctrl+Space to trace over an
instruction (useful if you don't want to trace into a JSR; can
also use "p [enter]").
To advance to a specific address (e.g. to skip to the bottom of a loop),
use up/down arrows to move the cursor, then Ctrl+Down to trace until
that line is reached.
- In Data mode, type "m1 <address>" to jump to that address. This also
creates a mini-window for data that you can see while in Code mode.
Use "m2 <address>" to set a second data mini-window.
- Use arrows and PgUp/PgDn to move around. Add Shift and Ctrl to the
Page keys to move farther. You can do a monitor-style "<address> L" to
position the Code view. If you want to get back to the current
instruction, hit [tab].
- To peek at the Apple II display, use '\ [enter]' to see the current
display, and hit a key to go back. There are commands for specific
screens, e.g. "hgr" shows hi-res page 1. Use "help view"
to list the full set of possibilities.
- Set values like you would in the monitor: "800: 52" sets $800 to $52.
Does not work for I/O locations like $C050 -- use
"out <address> <value>" instead.
- Breakpoints:
- Set an execution breakpoint with "bpx <address>".
- Set a memory breakpoint with "bpm <address>".
- Disable and re-enable breakpoints with "bpd <num>" and
"bpe <num>".
- Clear breakpoints with "bpc <num>", where "num" may be "*"
to clear everything.
The F1 help talks about conditional breakpoints, but the in-debugger
help doesn't seem to.
- When in doubt, go into Console mode and type "help". There's a bunch
of stuff in the console help text that isn't in the F1 help file. Some
useful things to look at:
- "help mem" will tell you how to load/save chunks of memory,
move data around, and search for values.
- "help r" explains how to modify register contents.
- To see how many cycles a piece of code takes to execute, set breakpoints
at the start and end with "bpx". When you break at the entry point, type
"profile" to reset the profile counters, then continue. At the exit
point, hit Enter to go into full-screen command output mode, then type
"profile list" to see the cycle count summary.
Other notes:
- Sometimes when switching display modes, the left area will be blank
(e.g. if you're in Console display mode and type "code"). Just
type the desired mode again.
- Some more stuff from Michael "AppleWin Debugger" Dev:
comp.sys.apple2.
Things I haven't figured out yet:
- How to single-step while watching the Apple II screen.
(Emulator v1.29.3.0, debugger v2.9.0.15)
Copyright 2020 by Andy McFadden