Go to the first, previous, next, last section, table of contents.


9 Monitor

Every VICE emulator has a complete built-in monitor, which can be used to examine, disassemble and assemble machine language programs, as well as debug them through breakpoints. It can be activated by using the "Activate monitor" command (left button menu). Notice that you have to run the emulator from a terminal emulation program (such as rxvt or xterm) in order to use the monitor.

Warning: this version of the monitor is still under construction, and some of the features are not fully working yet.

9.1 Terminology

`address_space'
This refers to the range of memory locations and a set of registers. This can be the addresses available to the computer's processor, the disk drive's processor or a specific memory configuration of one of the mentioned processors.
`bankname'
The CPU can only see 64k of memory at any one time, due to its 16 bit address bus. The C64 and other computers have more than this amount, and this is handled by banking: a memory address can have different contents, depending on the active memory bank. A bankname names a specific bank in the current address_space.
`register'
One of the following: program counter (PC), stack pointer (SP), accumulator (A), X register (X), or Y register (Y).
`address'
A specific memory location in the range $0000 to $FFFF.
`address_range'
Two addresses. If the second address is less than the first, the range is assumed to wraparound from $FFFF to $0000. Both addresses must be in the same address space.
`address_opt_range'
An address or an address range.
`prompt'
The prompt has the format [x:y]. If x is -, memory reads from the monitor do not have side effects. Otherwise, x is S. The second part of the prompt, y, shows the default address space.
`checkpoint'
The monitor has the ability to setup triggers that perform an action when a specified situation occurs. There are three types of checkpoints; breakpoints, tracepoints and watchpoints.
`breakpoint'
A breakpoint is triggered based on the program counter. When it is triggered, the monitor is entered.
`tracepoint'
Like breakpoints, a tracepoint is triggered based on the program counter. Instead of entering the monitor, the program counter is printed and execution continues.
`watchpoint'
Watchpoints are triggered by a read and/or write to an address. When a watchpoint is triggered, the monitor is entered.
`<...>'
A data type.
`*'
Zero or more occurrences.
`[...]'
An optional argument.

9.2 Machine state commands

goto <address>
Change the PC to address and continue execution.
io
Nothing yet. Will display VIC/VIA/CIA/SID registers.
next [<count>]
Advance to the next instruction. Subroutines are treated as a single instruction.
registers [<reg_name> = <number> [, <reg_name> = <number>]*]
Assign respective registers. With no parameters, display register values.
return
Continues execution and returns to the monitor just after the next RTS or RTI is executed.
step [<count>]
Single step through instructions. An optional count allows stepping more than a single instruction at a time.

9.3 Memory commands

bank [<bankname>]
Without a bankname, display all available banks for the current address_space. With a bankname given, switch to the specified bank. If a bank is not completely filled (ROM banks for example) normally the ram bank is used where the bank has holes. The cpu bank uses the bank currently used by the CPU.
compare <address_range> <address>
Compare memory from the source specified by the address range to the destination specified by the address. The regions may overlap. Any values that miscompare are displayed using the default displaytype.
device [c:|8:|9:]
Set the default address space to either the computer `c:' or the specified drive `8:' or `9:'
fill <address_range> <data_list>
Fill memory in the specified address range with the data in <data_list>. If the size of the address range is greater than the size of the data_list, the data_list is repeated.
hunt <address_range> <data_list>
Hunt memory in the specified address range for the data in <data_list>. If the data is found, the starting address of the match is displayed. The entire range is searched for all possible matches.
i <address_opt_range>
Display memory contents as PETSCII text.
m [<data_type>] [<address_opt_range>]
Display the contents of memory. If no datatype is given, the default is used. If only one address is specified, the length of data displayed is based on the datatype. If no addresses are given, the 'dot' address is used.
mc [<data_type>] [<address_opt_range>]
Display the contents of memory as character data. If only one address is specified, only one character is displayed. If no addresses are given, the "dot" address is used.
ms [<data_type>] [<address_opt_range>]
Display the contents of memory as sprite data. If only one address is specified, only one sprite is displayed. If no addresses are given, the "dot" address is used.
move <address_range> <address>
Move memory from the source specified by the address range to the destination specified by the address. The regions may overlap.
sidefx [on|off|toggle]
Control how monitor generated reads affect memory locations that have read side-effects, like CIA interrupt registers for example. If the argument is 'on' then reads may cause side-effects. If the argument is 'off' then reads don't cause side-effects. If the argument is 'toggle' then the current mode is switched. No argument displays the current state.
> [<address>] <data_list>
Write the specified data at address.

9.4 Assembly commands

a <address> [ <instruction> [: <instruction>]* ]
Assemble instructions to the specified address. If only one instruction is specified, enter assembly mode (enter an empty line to exit assembly mode).
d [<address> [<address>]]
Disassemble instructions. If two addresses are specified, they are used as a start and end address. If only one is specified, it is treated as the start address and a default number of instructions are disassembled. If no addresses are specified, a default number of instructions are disassembled from the dot address.

9.5 Checkpoint commands

break [<address> [if <cond_expr>] ]
This command allows setting a breakpoint or listing the current breakpoints. If no address is given, the currently valid checkpoints are printed. If an address is given, a breakpoint is set for that address and the breakpoint number is printed. A conditional expression can also be specified for the breakpoint. For more information on conditions, see the CONDITION command.
enable <checknum>
disable <checknum>
Each checkpoint can be enabled or disabled. This command allows changing between these states.
command <checknum> "<command>"
When checkpoint checknum is hit, the specified command is executed by the monitor. Note that the x command is not yet supported as a command argument.
condition <checknum> if <cond_expr>
Each time the specified checkpoint is examined, the condition is evaluated. If it evalutes to true, the checkpoint is activated. Otherwise, it is ignores. If registers are specified in the expression, the values used are those at the time the checkpoint is examined, not when the condition is set.
delete <checknum>
Delete the specified checkpoint.
ignore <checknum> [<count>]
Ignore a checkpoint a given number of crossings. If no count is given, the default value is 1.
trace [address [address]]
This command is similar to the break command except that it operates on tracepoints. A tracepoint differs from a breakpoint by not stopping execution but simply printing the PC, giving the user an execution trace. The second optional address can be used to specify the end of an range of addresses to be traced.
watch [loadstore] [address [address]]
This command is similar to the previous two commands except that it operates on watchpoints. A watchpoint differs from the others by stopping on a read and/or write to an address or range of addresses. If no addresses are given, a list of all the watchpoints is printed. The loadstore parameter can be either "load" or "store" to determine on which operation the monitor breaks. If not specified, the monitor breaks on both operations.

9.6 General commands

cd <directory>
Change the working directory.
device [c:|d:]
Set the default memory device to either the computer (c:) or the disk (d:).
radix [H|D|O|B]
Set the default radix to hex, decimal, octal, or binary. With no argument, the current radix is printed.
sidefx [on|off|toggle]
Control how monitor generated reads affect memory locations that have read side-effects. If the argument is 'on' then reads may cause side-effects. If the argument is 'off' then reads don't cause side-effects. If the argument is 'toggle' then the current mode is switched. No argument displays the current state.
system <system command>
Nothing yet.

9.7 Disk commands

br <track> <sector> [<address>]
Read the block at the specified track and sector. If an address is specified, the data is loaded into memory. If no address is given, the data is displayed using the default datatype.
bw <track> <sector> <address>
Write a block of data at address to the specified track and sector of disk in drive 8.
@<disk command>
Perform a disk command on the currently attached disk image on drive 8. The specified disk command is sent to the drive's channel #15.
load "<filename>" <address>
Load the specified file into memory at the specified address.
save "<filename>" <address1> <address2>
Save the memory from address1 to address2 to the specified file.

9.8 Command file commands

playback "<filename>"
Monitor commands from the specified file are read and executed. This command stops at the end of file or when a STOP command is read.
record "<filename>"
After this command, all commands entered are written to the specified file until the STOP command is entered.
stop
Stop recording commands. See record.

9.9 Label commands

add_label <address> <label>
Map a given address to a label. This label can be used when entering assembly code and is shown during disassembly.
delete_label [<memspace>] <label>
Remove the specified label from the label tables. If no memory space is checked, all tables are checked.
load_labels [<memspace>] "<filename>"
Load a file containing a mapping of labels to addresses. If no memory space is specified, the default readspace is used.
save_labels [<memspace>] "<filename>"
Save labels to a file. If no memory space is specified, all of the labels are saved.
show_labels [<memspace>]
Display current label mappings. If no memory space is specified, show all labels.

9.10 Miscellaneous commands

exit
Leave the monitor and return to execution.
print <expression>
Evaluate the specified expression and output the result.
quit
Exit the emulator immediately.
~ <number>
Display the specified number in decimal, hex, octal and binary.


Go to the first, previous, next, last section, table of contents.