gb::GameboyCore class

Encapsulation for Gameboy emulation.

Contents

Public functions

void update(int steps = 1)
void emulateFrame()
void open(const std::string& filename)
void loadROM(const std::vector<uint8_t>& buffer)
void loadROM(const uint8_t* rom, uint32_t size)
void reset()
void setDebugMode(bool debug)
void setColorTheme(ColorTheme theme)
auto readMemory(uint16_t addr) -> uint8_t
void writeMemory(uint16_t addr, uint8_t value)
void setScanlineCallback(GPU::RenderScanlineCallback callback)
void setVBlankCallback(GPU::VBlankCallback callback)
void setAudioSampleCallback(APU::AudioSampleCallback callback)
void input(Joy::Key key, bool pressed)
auto getBatteryRam() const -> std::vector<uint8_t>
void setBatteryRam(const std::vector<uint8_t>& ram)
void linkWrite(uint8_t byte)
void setLinkReadyCallback(Link::ReadyCallback callback)
auto serialize() const -> std::vector<uint8_t>
void deserialize(const std::vector<uint8_t>& data)
void setTimeProvider(const TimeProvider provider)
void setInstructionCallback(std::function<void(const gb::Instruction&, const uint16_t addr)> instr)

Function documentation

void gb::GameboyCore::update(int steps = 1)

runs steps number of steps on the gameboycore

void gb::GameboyCore::emulateFrame()

Run emulation for a single frame

void gb::GameboyCore::open(const std::string& filename)

Load a ROM file

void gb::GameboyCore::loadROM(const std::vector<uint8_t>& buffer)

Load byte buffer into virtual memroy

void gb::GameboyCore::loadROM(const uint8_t* rom, uint32_t size)

Load byte buffer into virtual memory

void gb::GameboyCore::reset()

Reset the GameboyCore state

void gb::GameboyCore::setDebugMode(bool debug)

Enable debug output

void gb::GameboyCore::setColorTheme(ColorTheme theme)

Set Color theme

uint8_t gb::GameboyCore::readMemory(uint16_t addr)

Read memory

void gb::GameboyCore::writeMemory(uint16_t addr, uint8_t value)

Write memory

void gb::GameboyCore::setScanlineCallback(GPU::RenderScanlineCallback callback)

Set scanline callback

void gb::GameboyCore::setVBlankCallback(GPU::VBlankCallback callback)

Set VBlank callback

void gb::GameboyCore::setAudioSampleCallback(APU::AudioSampleCallback callback)

Set audio sample callback

void gb::GameboyCore::input(Joy::Key key, bool pressed)

Joypad key input event

std::vector<uint8_t> gb::GameboyCore::getBatteryRam() const

Get battery RAM

This copies the battery backed RAM from the emulator and returns it to the user

void gb::GameboyCore::setBatteryRam(const std::vector<uint8_t>& ram)

Set battery RAM

void gb::GameboyCore::linkWrite(uint8_t byte)

Write a byte to the serial port

void gb::GameboyCore::setLinkReadyCallback(Link::ReadyCallback callback)

Set Link ready callback

Set a callback that fires when the core is ready to transfer a byte to the serial port

std::vector<uint8_t> gb::GameboyCore::serialize() const

Serialize GameboyCore state

void gb::GameboyCore::deserialize(const std::vector<uint8_t>& data)

Deserialize GameboyCore state

void gb::GameboyCore::setTimeProvider(const TimeProvider provider)

Set the time to be read from the RTC register (MBC3)

void gb::GameboyCore::setInstructionCallback(std::function<void(const gb::Instruction&, const uint16_t addr)> instr)

Set instruction callback