SpectNetIDE would not be useful without an emulator to develop programs. The ZX Spectrum Emulator tool window shows the screen of the embedded ZX Spectrum virtual machine that runs in the background.
As you see, the toolbar at the top of the window contains buttons to control the virtual machine.
This button turns of the virtual machine if it stopped, or continues running it if the machine is stopped.
As you see, the toolbar at the top of the window contains buttons to control the virtual machine. You can use the
Ctrl + F5 key as a shortcut.
Note: shortcut keys are available only when the focus is in one of the emulator-related tool windows, including the emulator, ZX Spectrum Memory, Z80 Disassembly, Z80 Registers, and Watch Memory tool windows. You cannot use them while you are in the code editor or in Solution Explorer.
Immediately turns off the virtual machine (
Ctrl + M, then
Ctrl + S). It is as if you turned the hardware off.
You can pause the running virtual machine at any time. Pausing suspends the execution, and the emulator-related tool windows display the state of the virtual machine, such as the current register values, the memory contents, or the execution point in the Disassembly view.
When you use step-by-step debugging, the virtual machine pauses every time it reaches a new breakpoint.
Restarts the virtual machine, just as if you turned it off and on again.
You can start the virtual machine in debug mode (
F5). In this mode, the virtual machine pauses when it reaches a breakpoint (and the optional breakpoint condition is satisfied). If you run the virtual machine with Start (
Ctrl + F5), it won’t pause at breakpoints.
Note: The caption of the ZX Spectrum Emulator window shows the (Debugging) label when it runs in debug mode.
While the machine is paused, the Step-Into function (
F11) executes the next Z80 instruction. If the subsequent operation is a subroutine call (such as
RST), Step-Into pauses at the first operation of the subroutine. Should the next one be a block instruction (such as
LDIR), Step-Into breaks after the first loop of the block. Thus, if the block takes ten iterations, you have to Step-Into ten time to get to the following operation.
F10) works the same for most instructions as Step-Into. Nonetheless, if the next operation is a
RST), Step-Over executes the entire subroutine and pauses at the next instruction following the call. If there’s a block instruction (e.g.
LDIR), Step-Over breaks at the next statement, completing the entire block operation.
Note: If a subroutine call manipulates the stack and returns to somewhere else, Step-Over may not pause at the location you expect.
When you are within a subroutine call, Step-Out continues the execution flow until the current subroutine returns to the caller, and pauses the machine right after returning.
Note: If a subroutine call manipulates the stack and returns to somewhere else, Step-Out may not pause at the location you expect.
Save Virtual Machine State
Any time the virtual machine is stopped, you can save its state including the CPU, memory, execution flow, devices, etc. into a
Load Virtual Machine State
When the virtual machine is paused, you can restore its former state by loading it from a
.vmstate file. Saving and loading the state allows you to suspend debugging between Visual Studio sessions.
Add Virtual Machine State to the project
If you are analyzing code, it is useful if the virtual machine state files are the part of your project so that you can handle them with the same source control procedures as other project files. You can not only save a
.vmstate file, but also add it to your project’s
Note: In other articles, you can find more details about working with
As soon as you load a ZX Spectrum project into Visual Studio, the IDE creates a new ZX Spectrum virtual machine according to the type specified when you created the project. This machine does not run; you need to start it explicitly.
Even if the ZX Spectrum Emulator tool window is closed, the virtual machine still runs in the background once you’ve started it. It halts if you explicitly stop it, close the current solutions, or exit the Visual Studio IDE.
While the ZX Spectrum Emulator tool window has the focus, the IDE forward the keystrokes to the emulator that senses them as if you pressed a key on the ZX Spectrum hardware.