Skip to content

Overview ​

The whole public API hangs off a single object of class vc64::VirtualC64. It has two kinds of members:

  • Functions that act on the emulator as a whole: controlling the execution state, resetting, configuring, and synchronizing with the emulator thread.
  • Sub-APIs, one per hardware component or subsystem. They are public data members, so a call reads like c64.cpu.getInfo() or c64.drive8.insert(...). Sub-APIs may contain further sub-APIs, for example c64.cpu.breakpoints or c64.controlPort1.joystick.

All API classes are derived from vc64::API, which provides suspend() and resume().

Sub-APIs ​

MemberClassPurpose
c64vc64::C64APIThe machine as a whole: snapshots, workspaces, ROMs, media files.
memvc64::MemoryAPIMemory configuration and state.
cpuvc64::CPUAPICPU state, disassembler, breakpoints and watchpoints.
cia1, cia2vc64::CIAAPIThe two CIA chips.
sidvc64::SIDAPIThe SID chip(s).
viciivc64::VICIIAPIThe VICII graphics chip.
audioPort, videoPortvc64::AudioPortAPI, vc64::VideoPortAPIAudio and video output.
controlPort1, controlPort2vc64::ControlPortAPIThe control ports with their joystick, mouse, and paddle.
expansionPortvc64::ExpansionPortAPICartridges, REU, GeoRAM.
serialPort, userPortvc64::SerialPortAPI, vc64::UserPortAPIThe serial (IEC) port and the user port with its RS232 adapter.
keyboardvc64::KeyboardAPIKey presses, auto-typing.
drive8, drive9vc64::DriveAPIThe floppy drives and their disks.
datasettevc64::DatasetteAPIThe tape recorder.
retroShellvc64::RetroShellAPIThe command console.
remoteManagervc64::RemoteManagerAPIRemote servers (RetroShell, RPC, DAP, ...).
xrayvc64::XRayAPIThe X-Ray visualizer.
defaults (static)vc64::DefaultsAPIPersistent user defaults. Available without an emulator instance.

Conventions ​

PatternMeaning
getConfig(), get(Opt) / set(Opt, ...)Read and change the configuration. Options are identified by the enumeration vc64::Opt.
getInfo(), getCachedInfo(), getMetrics(), ...Read the state of a component.
foo() / fooAsync()Blocking and asynchronous flavor of a state-changing function.

To be notified about events, register a message callback with launch(). The messages are listed in the enumeration vc64::Msg. The Architecture explains which thread may call what.

Errors ​

API functions report failures by throwing exceptions derived from utl::Error. Each function documents what it can throw with @throw.

ExceptionMeaning
vc64::CoreErrorThe request does not match the state of the emulator, e.g., an invalid option value or a missing ROM.
utl::IOErrorA file or folder could not be accessed.
vc64::MediaErrorA ROM, snapshot, or disk image is invalid or not supported.
cpp
try {
    c64.run();
} catch (const CoreError &e) {
    if (e.fault() == CoreError::ROM_KERNAL_MISSING) { /* ask the user for a ROM */ }
}