Running and Debugging code
Klive displays a toolbar at the top of the screen in the Emulator window and another in the IDE window. They have the same functionality: they control the emulated machine. The toolbar contains some emulator and IDE-specific functions; however, the machine control commands use the same components.
This screen shows these controls in the emulator:

Move the mouse over a particular control; it displays a tooltip to let you know its function.
The leftmost button starts the machine in the selected mode (running with or without debugging). The dropdown next to the start button lets you select this mode:

The IDE displays Run Project (F5) and Debug Project (Ctrl+F5) options.
Starting the machine has a different meaning for the Emulator and IDE windows.
- In the emulator, you start the machine and let it run.
- With its toolbar control in the IDE, you can start the machine only when a project is loaded. This start not only starts the emulated machine but also injects the compiled code into it and jumps to its entry point (all invokes it, depending on compilation options).
Klive provides views (memory, disassembly, BASIC listing, and many more) that allow you to examine the machine’s state.
When the machine is running, you can use any of the windows to control it (pause, stop, or restart)

- Pause: Klive pauses the machine at the current execution point. Soon, you will learn what you can do with the machine in this mode.
- Stop: This stops the machine (like turning off the hardware). Though the machine is stopped, you can still examine its memory contents and state when turning it off.
- Restart: This function stops the machine and then starts it again. When you restart the machine in the IDE with a project loaded, it restarts your code and not just the machine.

In the paused state of a machine, you can use these actions:
- Continue. Go on running the machine.
- Stop. (As described above)
- Restart. (As described above)
- Step into. Execute the subsequent CPU instruction and pause the machine again.
- Step over. Execute the subsequent CPU instruction entirely. If it is a
CALL
orRST
instruction, a block operation (likeLDIR
), the IDE pauses again at the instruction following the current execution point. - Step out. If you are within a subroutine, this function stops when the subroutine returns to its caller. Please note that this function only works if subroutine calls are completed by some of the
RET
instructions, not stack manipulation and jump statements.
While the machine is paused, you can change between the run/debug execution modes with the dropdown.