Skip to content

GuardsAPI ​

cpp
#include <VirtualC64.h>
cpp
class GuardsAPI

Defined in VirtualC64.h:240

Guards API

Gives access to one list of guards (the breakpoints or the watchpoints of the CPU). The functions that modify the list come in two flavors, following the usual scheme of the API:

  • The plain functions (e.g., setAt()) return when the emulator thread has carried out the request. A failure throws the corresponding exception (e.g., if a guard to remove does not exist). They throw CoreError (CoreError::NOT_LAUNCHED) if the emulator thread cannot carry out the request, because it has not been launched yet, is halted or suspended, or if they are called from the emulator thread itself.
  • The functions with the Async suffix (e.g., setAtAsync()) queue the request and return at once. A failure is not reported to the caller. The change shows up in the query functions only after the emulator thread has carried it out (see sync()).

Public Methods ​

ReturnNameDescription
isizeelements constReturns the number of guards in the guard list.
std::optional< GuardInfo >guardNr constReturns information about a guard.
std::optional< GuardInfo >guardAt constReturns information about a guard.
voidsetAtSets a guard.
voidsetAtAsyncAsynchronous version of setAt(): queues the request and returns at once.
voidmoveToRelocates a guard.
voidmoveToAsyncAsynchronous version of moveTo(): queues the request and returns at once.
voidremoveDeletes a guard.
voidremoveAsyncAsynchronous version of remove(): queues the request and returns at once.
voidremoveAtDeletes a guard.
voidremoveAtAsyncAsynchronous version of removeAt(): queues the request and returns at once.
voidremoveAllDeletes all guards.
voidremoveAllAsyncAsynchronous version of removeAll(): queues the request and returns at once.
voidenableEnables a guard.
voidenableAsyncAsynchronous version of enable(): queues the request and returns at once.
voidenableAtEnables a guard.
voidenableAtAsyncAsynchronous version of enableAt(): queues the request and returns at once.
voidenableAllEnables all guards.
voidenableAllAsyncAsynchronous version of enableAll(): queues the request and returns at once.
voiddisableDisables a guard.
voiddisableAsyncAsynchronous version of disable(): queues the request and returns at once.
voiddisableAtDisables a guard.
voiddisableAtAsyncAsynchronous version of disableAt(): queues the request and returns at once.
voiddisableAllDisables all guards.
voiddisableAllAsyncAsynchronous version of disableAll(): queues the request and returns at once.
voidtoggleEnables a disabled guard and disables an enabled one.
voidtoggleAsyncAsynchronous version of toggle(): queues the request and returns at once.

elements ​

const

cpp
isize elements() const

Defined in VirtualC64.h:253

Returns the number of guards in the guard list.


guardNr ​

const

cpp
std::optional< GuardInfo > guardNr(isize nr) const

Defined in VirtualC64.h:259

Returns information about a guard.

Returns ​

A copy of the guard's state, or nothing if it does not exist.

Parameters ​

ParameterTypeDescription
nrisizeNumber of the guard in the guard list

guardAt ​

const

cpp
std::optional< GuardInfo > guardAt(u32 target) const

Defined in VirtualC64.h:265

Returns information about a guard.

Returns ​

A copy of the guard's state, or nothing if the target is not guarded.

Parameters ​

ParameterTypeDescription
targetu32The target of the guard to query

setAt ​

cpp
void setAt(u32 target, isize ignores = 0)

Defined in VirtualC64.h:271

Sets a guard.

Parameters ​

ParameterTypeDescription
targetu32The observed memory address (the target of the guard).
ignoresisizeIf a value greater zero is given, the guard has to be hit the specified number of times until program execution is paused.

setAtAsync ​

cpp
void setAtAsync(u32 target, isize ignores = 0)

Defined in VirtualC64.h:274

Asynchronous version of setAt(): queues the request and returns at once.


moveTo ​

cpp
void moveTo(isize nr, u32 target)

Defined in VirtualC64.h:280

Relocates a guard.

Parameters ​

ParameterTypeDescription
nrisizeNumber of the guard in the guard list
targetu32New target

moveToAsync ​

cpp
void moveToAsync(isize nr, u32 target)

Defined in VirtualC64.h:283

Asynchronous version of moveTo(): queues the request and returns at once.


remove ​

cpp
void remove(isize nr)

Defined in VirtualC64.h:288

Deletes a guard.

Parameters ​

ParameterTypeDescription
nrisizeNumber of the guard in the guard list

removeAsync ​

cpp
void removeAsync(isize nr)

Defined in VirtualC64.h:291

Asynchronous version of remove(): queues the request and returns at once.


removeAt ​

cpp
void removeAt(u32 target)

Defined in VirtualC64.h:296

Deletes a guard.

Parameters ​

ParameterTypeDescription
targetu32The target of the guard to be deleted.

removeAtAsync ​

cpp
void removeAtAsync(u32 target)

Defined in VirtualC64.h:299

Asynchronous version of removeAt(): queues the request and returns at once.


removeAll ​

cpp
void removeAll()

Defined in VirtualC64.h:303

Deletes all guards.


removeAllAsync ​

cpp
void removeAllAsync()

Defined in VirtualC64.h:306

Asynchronous version of removeAll(): queues the request and returns at once.


enable ​

cpp
void enable(isize nr)

Defined in VirtualC64.h:311

Enables a guard.

Parameters ​

ParameterTypeDescription
nrisizeNumber of the guard in the guard list

enableAsync ​

cpp
void enableAsync(isize nr)

Defined in VirtualC64.h:314

Asynchronous version of enable(): queues the request and returns at once.


enableAt ​

cpp
void enableAt(u32 target)

Defined in VirtualC64.h:319

Enables a guard.

Parameters ​

ParameterTypeDescription
targetu32The target of the guard to be enabled

enableAtAsync ​

cpp
void enableAtAsync(u32 target)

Defined in VirtualC64.h:322

Asynchronous version of enableAt(): queues the request and returns at once.


enableAll ​

cpp
void enableAll()

Defined in VirtualC64.h:326

Enables all guards.


enableAllAsync ​

cpp
void enableAllAsync()

Defined in VirtualC64.h:329

Asynchronous version of enableAll(): queues the request and returns at once.


disable ​

cpp
void disable(isize nr)

Defined in VirtualC64.h:334

Disables a guard.

Parameters ​

ParameterTypeDescription
nrisizeNumber of the guard in the guard list

disableAsync ​

cpp
void disableAsync(isize nr)

Defined in VirtualC64.h:337

Asynchronous version of disable(): queues the request and returns at once.


disableAt ​

cpp
void disableAt(u32 target)

Defined in VirtualC64.h:342

Disables a guard.

Parameters ​

ParameterTypeDescription
targetu32The target of the guard to be disabled

disableAtAsync ​

cpp
void disableAtAsync(u32 target)

Defined in VirtualC64.h:345

Asynchronous version of disableAt(): queues the request and returns at once.


disableAll ​

cpp
void disableAll()

Defined in VirtualC64.h:349

Disables all guards.


disableAllAsync ​

cpp
void disableAllAsync()

Defined in VirtualC64.h:352

Asynchronous version of disableAll(): queues the request and returns at once.


toggle ​

cpp
void toggle(isize nr)

Defined in VirtualC64.h:357

Enables a disabled guard and disables an enabled one.

Parameters ​

ParameterTypeDescription
nrisizeNumber of the guard in the guard list

toggleAsync ​

cpp
void toggleAsync(isize nr)

Defined in VirtualC64.h:360

Asynchronous version of toggle(): queues the request and returns at once.