is a very basic debugger
built into the ROM
of every Macintosh
computer from the Macintosh Plus
to the Power Mac G4
. It's like MacsBug, only more arcane and less useful. To quote Apple
's developer's documentation: "MacsBug
is your friend. MicroBug
is much, much less of your friend, but when you're a Mac programmer
with a bug that disappears when you install MacsBug, you need all the friends you can get." You enter it by pressing the programmer's button
, which is either a button on the front or side of the computer
near the reset button
, or doesn't exist at all, in which case you press Command-Power
G, the Go command, restarts execution from the point at which you entered MicroBug. G (address) starts executing from the address provided as an argument.
SM stands for "set memory" and has the syntax SM (address to set) (new value)
If you want merely to view an address and not to change its value, the correct command is DM, for "Dump memory," for which the syntax is DM (address to dump).
There are many people who will say that the commands
G F and G Finder will force quit the current application; while they do cause the current application to exit, they are not actually instructions to exit the current application; they merely restart execution from address F for the first example, or at address 00F27DEB for the second, which are odd addresses, and thus are not valid addresses from which to begin execution, causing the processor to take an address error exception and cease execution of the current application. A saner way to force the current application to exit is to enter the mini-debugger and enter SM 0 A9F4, thus setting address 0 to A9F4, the A-line trap for _exitToShell, and then to enter G 0, executing the _exitToShell command. This is equivalent to the ES command in MacsBug.
TD, the Total Display command, displays the contents of all of the MC680x0 registers. You can also display the contents of a particular register by entering Ax or Dx, where x is an integer such that 0≤x≤7, or with the PC and SR commands. Appending an expression to the end of any of these register commands will set the register to the value of the expression. Unless you know what you're doing, this is an exceptionally bad idea and will crash your computer.
You certainly want to know what different ways there are to form valid expressions in MacsBug, so here:
You can use hex numbers to refer to a particular address, or you can prefix any other valid expression with the @ symbol to return the value of the memory at the expression thereto fed as an argument. RAx or RDx or PC, where x, if present, is constrained as described above, return the contents of the register thereby described; - followed by any other valid expression returns the negation of the expression; and the + and - signs, when prefixed and suffixed with valid expressions, perform the mathematical operations that would seem to make sense given the symbols.
If you're sitting at a Macintosh and you really need to add hexadecimal numbers and you don't have a program to do it, you can enter MicroBug and type DM (hex number)+(hex number) and the result will be the first number displayed in the first row of the results.