Class NESPeripherals::Controller

Nested Relationships

This class is a nested type of Class NESPeripherals.

Class Documentation

class Controller

Standard NES controller.

Public Types

enum class inputButtons

Bit positions in shifter.

Values:

enumerator A
enumerator B
enumerator SELECT
enumerator START
enumerator UP
enumerator DOWN
enumerator LEFT
enumerator RIGHT
enumerator MIC

Public Functions

inline void putBit(uint8_t pos, bool value)

Helper function to put bit to corresponding position.

Controller() = default
~Controller() = default
uint8_t DATA()

Get serial data from the controller.

void OUT(bool value)

Set strobe latch.

void setState(inputButtons button, bool value)

Set the state of physical buttons.

Public Members

unsigned int debug = 0
uint8_t data
union NESPeripherals::Controller::[anonymous] pressedButtons

Status of physical buttons (which are pressed — in emulator this corresponds to configured keys on keyboard or gamepad). Using int to be compatible with ImGui::CheckboxFlags.

uint8_t dataShifter = 0

Status is copied to this shifter when the strobe latch is on. Using int to be compatible with ImGui::CheckboxFlags.

int shiftedCount = 0
bool mic = false

Microphone status.

bool strobeLatch = false

Latch which enables the status update of dataShifter.