1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
*************************************************************************
* *
* Apple II debugger routines for the Linux-x86 Apple II emulator. *
* by Aaron Culliney - chernabog@baldmountain.bbn.com - (C) 1997 *
* *
* My code changes have nothing to do with my employer, BBN. They were *
* written completely on my own time and on my own machine. *
* *
*************************************************************************
The debugger console is a mid-size hack onto the main emulator code.
I did it b/c I wanted to fool around with some of my old games while
they were running and to debug the emulator itself.
The code is kinda ugly in some areas, but seems robust enough; (I've
used flex to handle most of the dangerous UI stuff). I'd like to do a
few more things to it when I get the time: namely add methods for
dumping and search for ASCII text, saving session logs, and saving
machine state to .img files (ApplePC format).
KNOWN PROBLEMS:
--------------
The debugger console sometimes isn't able to recover itself when a
program draws graphics or switches between graphics modes. Same thing
happens sometimes when you try to directly set graphics memory,
("4000:deadc0de"). So I added the command "gr{aphics}" to toggle the
displaying of graphics while in the debugger console which seems to
work. So if you notice the debugger freeze, you should exit with ESC,
re-enter, type "gr{aphics}", and then it's safe to continue.
When you hit a watchpoint or breakpoint, you have to step over it
before you can use the g{o}, f{inish}, or u{ntil} commands again.
Branch offsets printed with the disassemble command are screwy.
Someone please fix my math!
----------------------------------------------------------------------------
Usage:
-----
F7 - enters the debugger. (actually we wait until we've finished with
the current 6502 instruction before we enter the debugger so we're all
synched up if/when we start stepping the machine).
ESC - exits the debugger console.
General Command format:
command {optional part} <mandatory part> (this | that)
----------------------------------------------------------------------------
Disassembling Apple II main memory and language card memory:
d{is} {language card bank} {addrs} {+}{len}
Examples:
"d"
"dis +5"
"dis lc1 d000 5"
Note: {addrs} can be (d000 <-> ffff) or (0 <-> 2fff) for the language
card.
----------------------------------------------------------------------------
Dumping memory:
m{em} {lc1|lc2} {addrs} {+}{len}
a{scii} {lc1|lc2} {addrs} {+}{len}
Examples:
"mem"
"m dead"
"m lc2 2fff 1"
Note: {addrs} can be (d000 <-> ffff) or (0 <-> 2fff) for the language
card. Also you need to specify the {addrs} if you're examining lc
memory.
----------------------------------------------------------------------------
Setting memory:
<addrs> {lc1|lc2} : <byteseq>
"4000:deadc0de"
"0lc2 : def"
Note: {addrs} can be (d000 <-> ffff) or (0 <-> 2fff) for the language
card.
----------------------------------------------------------------------------
Displaying machine state (registers, language card, drive):
r{egs}
l{ang}
dr{ive}
----------------------------------------------------------------------------
Stepping the machine:
(s{tep} | n{ext}) {len}
f{inish}
u{ntil}
g{o} {addr}
-*step* or *next* 0-255 instructions.
-*finish* current stack-frame (stop at RTS).
-step *until* PC > current line (good for finishing loops).
-*go* or jump to {addr} and continue executing until user hits a key.
----------------------------------------------------------------------------
Searching and setting/unsetting memory breakpoints and watchpoints:
sea{rch} {lc1|lc2} <byteseq>
"se deadc0de"
"search lc2 def"
-search forward in memory for byte sequence.
(b{reak} | w{atch}) {addr}
(c{lear} | i{gnore}) {num}
sta{tus}
"w c0e9"
"br"
-break or watch addrs. (use in conjunction with g{o})
-clear breakpoints, ignore watchpoints.
-show break and watchpoint status.
Note: breakpoints and watchpoints persist even when you exit the
debugger console. They are only reset if you clear/ignore them or
virtually reboot.
----------------------------------------------------------------------------
Convenience functions:
gr{aphics}
so{und}
-toggle graphics and sound output while in debug mode.
Note: This is especially important when you are stepping through code
that is drawing to the screen or switching modes. See "Known
Problems" section above.
|