Documented Bus
This commit is contained in:
parent
24101f97ec
commit
377a9a3741
|
@ -4,15 +4,25 @@ class Bus;
|
||||||
class Window;
|
class Window;
|
||||||
class Debugger;
|
class Debugger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Contains the program loop and invokes other objects update functions.
|
||||||
|
*/
|
||||||
class Application
|
class Application
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Create and launch a new application.
|
||||||
|
*/
|
||||||
static void Launch();
|
static void Launch();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Application();
|
Application();
|
||||||
~Application();
|
~Application();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Update the application.
|
||||||
|
* This includes polling events, ticking the emulator and rendering
|
||||||
|
*/
|
||||||
bool Update();
|
bool Update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
50
src/Bus.hpp
50
src/Bus.hpp
|
@ -7,6 +7,14 @@
|
||||||
#include "PPU.hpp"
|
#include "PPU.hpp"
|
||||||
#include "Cartridge.hpp"
|
#include "Cartridge.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The main bus for hardware to communicate.
|
||||||
|
*
|
||||||
|
* This is not a realistic representation of the NES's bus, as the
|
||||||
|
* CPU and PPU don't share a bus in the real world. However this
|
||||||
|
* bus class still doesn't give the CPU/PPU direct access to the other
|
||||||
|
* components address space.
|
||||||
|
*/
|
||||||
class Bus
|
class Bus
|
||||||
{
|
{
|
||||||
friend class Debugger;
|
friend class Debugger;
|
||||||
|
@ -16,18 +24,60 @@ class Bus
|
||||||
public:
|
public:
|
||||||
Bus();
|
Bus();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reboot the NES.
|
||||||
|
*
|
||||||
|
* This equates to turning the NES off and on again.
|
||||||
|
* Internal state will be equal to the powerup state
|
||||||
|
*/
|
||||||
void Reboot();
|
void Reboot();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Resets the NES.
|
||||||
|
*
|
||||||
|
* Internal state will be equal to the reset state
|
||||||
|
*/
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Advance the emulator by one CPU cycle (and 3 PPU cycles).
|
||||||
|
*/
|
||||||
uint8_t Tick();
|
uint8_t Tick();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Advance the emulator by one CPU instruction.
|
||||||
|
*/
|
||||||
bool Instruction();
|
bool Instruction();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Advance the emulator by one Frame.
|
||||||
|
* The emulator runs until the PPU triggers VBlankStart
|
||||||
|
*/
|
||||||
bool Frame();
|
bool Frame();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read call from the CPU
|
||||||
|
*/
|
||||||
Byte ReadCPU(Word addr);
|
Byte ReadCPU(Word addr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read call from the PPU
|
||||||
|
*/
|
||||||
Byte ReadPPU(Word addr);
|
Byte ReadPPU(Word addr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write call from the CPU
|
||||||
|
*/
|
||||||
void WriteCPU(Word addr, Byte val);
|
void WriteCPU(Word addr, Byte val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write call from the PPU
|
||||||
|
*/
|
||||||
void WritePPU(Word addr, Byte val);
|
void WritePPU(Word addr, Byte val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Lets the PPU trigger NMIs.
|
||||||
|
*/
|
||||||
inline void NMI() { cpu.NMI(); }
|
inline void NMI() { cpu.NMI(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue