Documentation ¶
Overview ¶
Package emulation is an abstraction of the various modes Gopher2600 can operate in, principally play-mode and the debugger.
It is useful when linking packages/types that require a *passive* knowledge of the emulation. For example, a GUI might want to know what the current state of the emulation is.
Some package types might still need an active knowledge of the emulation however. In which case, simply relying on the Emulation interface is probably not enough.
Index ¶
Constants ¶
const (
UnsupportedEmulationFeature = "unsupported emulation feature: %v"
)
Sentinal error returned if emulation does no support requested feature.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Debugger ¶
type Debugger interface { }
VCS is a minimal abstraction of the Gopher2600 debugger. Exists mainly to avoid a circular import to the debugger package.
The only likely implementation of this interface is the debugger.Debugger type.
type Emulation ¶
type Emulation interface { TV() TV VCS() VCS Debugger() Debugger UserInput() chan userinput.Event // Send a request to set an emulation feature SetFeature(request FeatureReq, args ...FeatureReqData) error // Immediate request for the state and mode of the emulation State() State Mode() Mode }
Emulation defines the public functions required for a GUI implementation (and possibly other things) to interface with the underlying emulator.
type Event ¶ added in v0.15.0
type Event int
Event describes an event that might occur in the emulation which is outside of the scope of the VCS. For example, when the emulation is paused an EventPause can be sent to the GUI (see FeatureReq type in the gui package).
type FeatureReq ¶ added in v0.15.0
type FeatureReq string
FeatureReq is used to request the setting of an emulation attribute eg. a pause request from the GUI
const ( // notify gui of the underlying emulation mode. ReqSetPause FeatureReq = "ReqSetPause" // bool // change emulation mode ReqSetMode FeatureReq = "ReqSetMode" // emulation.Mode )
List of valid feature requests. argument must be of the type specified or else the interface{} type conversion will fail and the application will probably crash.
Note that, like the name suggests, these are requests, they may or may not be satisfied depending on other conditions in the GUI.
type FeatureReqData ¶ added in v0.15.0
type FeatureReqData interface{}
FeatureReqData represents the information associated with a FeatureReq. See commentary for the defined FeatureReq values for the underlying type.
type Mode ¶ added in v0.15.0
type Mode int
Mode inidicates the broad features of the emulation. For example, Debugger indicates that the emulation is capable or is willing to handle debugging features.
type State ¶
type State int
State indicates the emulation's state.
List of possible emulation states.
EmulatorStart is the default state and should never be entered once the emulator has begun.
Initialising can be used when reinitialising the emulator. for example, when a new cartridge is being inserted.
Values are ordered so that order comparisons are meaningful. For example, Running is "greater than" Stepping, Paused, etc.
Note that there is a flaw in this current implementation that means a "catchup" loop which can occur at the end of the Rewinding state, will report as being in the Running (or Stepping and Paused) state, even though we might logically think of it being the Rewinding state. See Debugger.CatchUpLoop() for an example of this and how it affects peripherals.