SpectNet IDE

Visual Studio 2017/2019 integrated ZX Spectrum IDE for the Community

Scripting » Scripting Object Model

SpectNetIde offers a set of .NET objects that you can use to create scripts that automate everyday tasks with ZX Spectrum virtual machines. You can use these objects in any .NET Framework application, or in scripting languages that allow accessing .NET Framework objects.

To use SpectNetIde scripting, add these assemblies to your projects:

Assembly Description
Spect.Net.Assembler The Z80 Assembler of SpectNetIde. With the help of this component, you can use Z80 source code in scripts.
Spect.Net.RomResources This assembly stores the ROMs of the Spectrum models supported by SpectNetIde.
SpectNet.SpectrumEmu This assembly implements the ZX Spectrum emulator and the scripting object model.

ZX Spectrum virtual machines

The scripting object model supports these ZX Spectrum models:

  • ZX Spectrum 48K
  • ZX Spectrum 128K
  • ZX Spectrum +3E
  • ZX Spectrum Next (still in development)

The virtual machines use a background thread for their execution cycle. You can run the machine with synchronous methods, but you need to pause or stop them, or waiting while their cycle completes with the async/await pattern.

Scripting objects

The table below contains a summary of the .NET types that constitute the ZX Spectrum scripting object model. To get the shortest path to learn using them, I suggest starting with these documentations:

Object type Description
AddressTrackingState This class represents tracking information regarding memory.
AssemblerOptions This class represents the options that can be used when the Z80 Assembler compiles the source code to machine code.
AudioSamples This class stores audio samples for the currently rendered virtual machine frame.
CodeBreakpoints Represents the breakpoint of the Spectrum virtual machine, at which execution should pause when running in debug mode.
CpuZ80 This class represents the Z80 CPU of a Spectrum virtual machine.
ExecuteCycleOptions This class provides options for the execution cycle of the Spectrum virtual machine.
ExecutionCompletionReason The values of this enumeration tell the reason why the virtual machine is in a paused or stopped state.
IAudioConfiguration This interface represents the configuration of the beeper/sound device.
KeyboardEmulator This class is reserved for future extension. Right now, id does not offer any property or method for scripting.
MemoryPagingInfo This class provides properties and methods to obtain information about ROM and RAM paging.
MemorySlice This class represents a slice of the memory in the Spectrum virtual machine.
ReadOnlyMemorySlice This class represents a read-only slice of the memory in the Spectrum virtual machine.
ScreenBitmap This class represents the current screen’s pixels, including the border area.
ScreenConfiguration This class represents the configuration of the virtual machine’s screen
ScreenRenderingStatus Provides properties about the current screen rendering status of the machine
ScreenRenderingTable Represents the screen rendering table of the virtual machine.
ScreenRenderingTact Provides details about a screen rendering tact.
SpectrumMemoryContents This class provides access to the addressable 64KBytes memory contents of the Spectrum virtual machine.
SpectrumModels This class is a repository of all Spectrum models and editions supported by SpectNetIde.
SpectrumVm This class represents a Spectrum virtual machine.
SpectrumVmFactory This class provides methods you can use to create ZX Spectrum virtual machine instances.
VmState The values of this enumeration show the possible states of a ZX Spectrum virtual machine.
Z80InstructionExecutionEventArgs This class provides event arguments the the OperationExecuting and OperationExecuted events of the CpuZ80 class