VirtualC64 v5.0 beta
Commodore 64 Emulator
|
Public API. More...
#include <VirtualC64.h>
Public Member Functions | |
Analyzing the emulator | |
const EmulatorConfig & | getConfig () const |
Returns the component's current configuration. | |
const EmulatorInfo & | getInfo () const |
Returns the component's current state. | |
const EmulatorInfo & | getCachedInfo () const |
Returns the component's current configuration. | |
const EmulatorStats & | getStats () const |
Returns statistical information about the components. | |
Querying the emulator state | |
bool | isPoweredOn () |
Returns true iff the emulator if the emulator is powered on. | |
bool | isPoweredOff () |
Returns true iff the emulator if the emulator is powered off. | |
bool | isPaused () |
Returns true iff the emulator is in paused state. | |
bool | isRunning () |
Returns true iff the emulator is running. | |
bool | isSuspended () |
Returns true iff the emulator has been suspended. | |
bool | isHalted () |
Returns true iff the emulator has shut down. | |
bool | isWarping () |
Returns true iff warp mode is active. | |
bool | isTracking () |
Returns true iff the emulator runs in track mode. | |
void | isReady () |
Checks if the emulator is runnable. | |
Controlling the emulator state | |
void | powerOn () |
Switches the emulator on. | |
void | powerOff () |
Switches the emulator off. | |
void | run () |
Starts emulation. | |
void | pause () |
Pauses emulation. | |
void | halt () |
Terminates the emulator thread. | |
void | suspend () |
Suspends the emulator thread. | |
void | resume () |
Suspends the emulator thread. | |
void | warpOn (isize source=0) |
Enables warp mode. | |
void | warpOff (isize source=0) |
Disables warp mode. | |
void | trackOn (isize source=0) |
Enables track mode. | |
void | trackOff (isize source=0) |
Disables track mode. | |
Single-stepping | |
void | stepInto () |
Steps a single instruction. | |
void | stepOver () |
Steps over the current instruction. | |
Synchronizing the emulator thread | |
void | wakeUp () |
Sends a wakeup signal to the emulator thread. | |
Configuring the emulator | |
void | launch (const void *listener, Callback *func) |
Launches the emulator thread. | |
i64 | get (Option option) const |
Queries a configuration option. | |
i64 | get (Option option, long id) const |
Queries a configuration option. | |
void | set (C64Model model) |
Configures the emulator to match a specific C64 model. | |
void | set (Option opt, i64 value) throws |
Configures a component. | |
void | set (Option opt, i64 value, long id) |
Configures a component. | |
void | exportConfig (const std::filesystem::path &path) const |
Exports the current configuration. | |
void | exportConfig (std::ostream &stream) const |
Launches the emulator thread. | |
Using the command queue | |
void | put (const Cmd &cmd) |
Feeds a command into the command queue. | |
void | put (CmdType type, i64 payload=0, i64 payload2=0) |
Feeds a command into the command queue. | |
void | put (CmdType type, ConfigCmd payload) |
Feeds a command into the command queue. | |
void | put (CmdType type, KeyCmd payload) |
Feeds a command into the command queue. | |
void | put (CmdType type, CoordCmd payload) |
Feeds a command into the command queue. | |
void | put (CmdType type, GamePadCmd payload) |
Feeds a command into the command queue. | |
void | put (CmdType type, TapeCmd payload) |
Feeds a command into the command queue. | |
void | put (CmdType type, AlarmCmd payload) |
Feeds a command into the command queue. | |
Static Public Member Functions | |
static string | version () |
Returns a version string for this release. | |
static string | build () |
eturns a build-number string for this release. | |
Static Public Attributes | |
static DefaultsAPI | defaults |
Custom APIs of subcomponents. | |
Public API.
This class declares the emulator's public API. It consists of functions controlling the execution state, such as running or pausing the emulator, as well as functions configuring the various components. The class contains separate sub-APIs for the subcomponents of the emulator. For example, a VICII API provides additional functions that interact directly with the VICII graphics chip.
void exportConfig | ( | const std::filesystem::path & | path | ) | const |
Exports the current configuration.
The current configuration is exported in form of a RetroShell script. Reading in the script at a later point will restore the configuration.
void exportConfig | ( | std::ostream & | stream | ) | const |
Launches the emulator thread.
This function must be called in the initialization procedure of the emulator. It launches the emulator thread and registers a callback function to the message queue. The callback function is a message receiver processing all incoming messages from the emulator.
listener | An arbitrary pointer which will be passed to the registered callback function as first argument. You can use the argument to pass the address of an object into the callback function. Inside the callback you can utilize the pointer to invoke a message processing function on that object. |
func | The callback function. |
i64 get | ( | Option | option | ) | const |
Queries a configuration option.
This is the main function to query a configuration option.
option | The option to query |
i64 get | ( | Option | option, |
long | id ) const |
Queries a configuration option.
This is the main function to query a configuration option.
option | The option to query |
id | The component to query |
void halt | ( | ) |
Terminates the emulator thread.
Halting the emulator changes the internal state to STATE_HALTED. This state is part of the shutdown procedure and never entered during normal operation.
void isReady | ( | ) |
Checks if the emulator is runnable.
The function checks if the necessary ROMs are installed to lauch the emulator. On success, the functions returns. Otherwise, an exception is thrown.
void launch | ( | const void * | listener, |
Callback * | func ) |
Launches the emulator thread.
This function must be called in the initialization procedure of the emulator. It launches the emulator thread and registers a callback function to the message queue. The callback function is a message receiver processing all incoming messages from the emulator.
listener | An arbitrary pointer which will be passed to the registered callback function as first argument. You can use the argument to pass the address of an object into the callback function. Inside the callback you can utilize the pointer to invoke a message processing function on that object. |
func | The callback function. |
void pause | ( | ) |
Pauses emulation.
Pausing the emulator changes the interal state from STATE_RUNNING to STATE_PAUSED after completing the curent frame. The emulator enteres a frozes state where no more frames are computed.
void powerOff | ( | ) |
Switches the emulator off.
Powering off the emulator changes the interal state of STATE_OFF. Calling this function on an already powered-off emulator has no effect.
void powerOn | ( | ) |
Switches the emulator on.
Powering on the emulator changes the interal state to STATE_PAUSED, the same state that is entered when the user hits the pause button. Calling this function on an already powered-on emulator has no effect.
void resume | ( | ) |
Suspends the emulator thread.
See the Suspendable class for a detailes description of the suspend-resume machanism.
void run | ( | ) |
Starts emulation.
Running the emulator changes the internal state to STATE_RUNNING, which is the normal operation state. Frames are computed at normal pace, if warp mode is switched off, or as fast as possible, if warp mode is switched on. If this function is called for a powere-off emulator, an implicit call to powerOn() will be performed.
void set | ( | C64Model | model | ) |
Configures the emulator to match a specific C64 model.
model | The C64 model to emulate |
void set | ( | Option | opt, |
i64 | value ) |
Configures a component.
This is the main function to set an configuration option.
opt | The option to set |
value | The option's value |
void set | ( | Option | opt, |
i64 | value, | ||
long | id ) |
Configures a component.
This is the main function to set an configuration option.
opt | The option to set |
id | The component to configure |
value | The option's value |
void stepInto | ( | ) |
Steps a single instruction.
If the emulator is paused, calling this functions steps the CPU for a single instruction. Otherwise, calling this function has no effect. The CPU debugger utilizes this function to implement single stepping.
void stepOver | ( | ) |
Steps over the current instruction.
If the emulator is paused, calling this functions runs the emulator until the instruction following the current instruction has been reached. Otherwise, calling this function has no effect. The CPU debugger utilizes this function to implement single stepping.
stepOver() acts like stepInto() except for branching instructions. For instance, if the current instruction is a JSR
instruction, the subroutine will be executed in a single chunk.
void suspend | ( | ) |
Suspends the emulator thread.
See the Suspendable class for a detailes description of the suspend-resume machanism.
void wakeUp | ( | ) |
Sends a wakeup signal to the emulator thread.
To compute frames at the proper pace, the emulator core expects the GUI to send a wakeup signal on each VSYNC pulse. Once this signal is received, the emulator thread starts computing all missing frames. To minimize jitter, the wakeup signal should be sent right after the current texture has been handed over to the GPU.