# Debugger

Description The debugger is an integral part of the emulator, and can be used to trace what the program is doing. Both Euphoric and Oricutron have a built in debugger, unfortunately they have different keyboard shortcuts so please make sure you use the correct ones :)
Euphoric | Oricutron
To access Euphoric's debugger you need to press the F11 key. This will show you this screen: Pressing F11 again will leave the debugger. | To access Oricutron's debugger you need to press the F2 key. This will show you this screen: In the monitor, number arguments are decimal by default, or prefixed with $ for hex or % for binary. Pretty much everything is output in hex. In most places where you can enter a number or address, you can pass a CPU or VIA register. (VIA registers are prefixed with V, e.g. VDDRA). Anywhere you can pass an address, you can also use a symbol.
Commands
To use Euphoric's debugger, you need to know some keys: F2: step by step tracing (enter in JSR) F3: step by step tracing (do not enter in subroutines) F4: show Oric screen (can crash...) F5: execute up to breakpoint address F6: reset F7: nmi F10: exit Euphoric F11: enter/leave from the debugger F12: abort execution (during F3 or F5) UP & DOWN arrows: scroll zero page window PAGE UP & PAGE DOWN: scroll the memory window A xxxx: assemble code B xxxx: set a breakpoint D xxxx: set the memory window adress E xxxx: edit a value in memory F xxxx: fill memory with a single value M xxxx: copy a block of memory U xxxx: disassemble code P: set PC R: change Register. Type register to change (A,X,Y,S,P), or type N,V,B,D,I,Z,C to change a flag. | To use Oricutron's debugger, you need to know some keys: F2: Return to the emulator F3: Toggle console/debug output/memwatch F4: Toggle VIA/AY information F9: Reset cycle count F10: Step over code F11: Step over code without tracing into subroutines. F12: Skip instruction You also have some more advanced commands: ? - Help a - Assemble bc - Clear breakpoint bcm - Clear mem breakpoint bl - List breakpoints blm - List mem breakpoints bs - Set breakpoint bsm [rwc] - Set mem breakpoint bz - Zap breakpoints bzm - Zap mem breakpoints d - Disassemble df - Disassemble to file m - Dump memory mm - Modify memory mw - Memory watch at addr nl - Load snapshot ns - Save snapshot r - Set to q, x or qm - Quit monitor qe - Quit emulator sa - Add or move user symbol sk - Kill user symbol sc - Symbols not case-sensitive sC - Symbols case-sensitive sl - Load user symbols sx - Export user symbols sz - Zap user symbols wm - Write mem to disk
Advanced features
Euphoric's debugger has been slightly improved (there's a small assembler now) and made more consistent with existing PC debuggers (like debug :-). Here are the commands: A: Assembler B: set Breakpoint address D: Dump memory E: Enter hex data F: Fill memory block with a single value M: Move memory block P: set PC R: change Register. Type register to change (A,X,Y,S,P), or type N,V,B,D,I,Z,C to change a flag. U: Unassembler | Oricutron supports two types of breakpoints. "Normal" breakpoints trigger when the CPU is about to execute an instruction at the breakpoint address. "Memory" breakpoints trigger when the breakpoint address is accessed or modified. There are three ways a memory breakpoint can be triggered; when the CPU is about to read the address (r), and the CPU is about to write the address (w), or after the value at the address changes for any reason (c). You specify which ways you'd like the breakpoint to trigger when you set the memory breakpoint: bsm r $0c00 <-- Break when the CPU is about to read from $0c00 bsm rw $0c00 <-- Break when the CPU is about to access $0c00 bsm c $0c00 <-- Break after then contents of $0c00 change bsm rwc $0c00 <-- Break just before the CPU accesses $0c00, or just after it changes for any reason.
Symbols Since the assemblers are compatible with both Euphoric and Oricutron's symbol formats, you should see all the symbols defined in your program directly while debugging.