Documented Bus

This commit is contained in:
Lauchmelder 2022-02-28 16:39:33 +01:00
parent 24101f97ec
commit 377a9a3741
No known key found for this signature in database
GPG key ID: C2403C69D78F011D
2 changed files with 60 additions and 0 deletions

View file

@ -4,15 +4,25 @@ class Bus;
class Window;
class Debugger;
/**
* @brief Contains the program loop and invokes other objects update functions.
*/
class Application
{
public:
/**
* @brief Create and launch a new application.
*/
static void Launch();
private:
Application();
~Application();
/**
* @brief Update the application.
* This includes polling events, ticking the emulator and rendering
*/
bool Update();
private:

View file

@ -7,6 +7,14 @@
#include "PPU.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
{
friend class Debugger;
@ -16,18 +24,60 @@ class Bus
public:
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();
/**
* @brief Resets the NES.
*
* Internal state will be equal to the reset state
*/
void Reset();
/**
* @brief Advance the emulator by one CPU cycle (and 3 PPU cycles).
*/
uint8_t Tick();
/**
* @brief Advance the emulator by one CPU instruction.
*/
bool Instruction();
/**
* @brief Advance the emulator by one Frame.
* The emulator runs until the PPU triggers VBlankStart
*/
bool Frame();
/**
* @brief Read call from the CPU
*/
Byte ReadCPU(Word addr);
/**
* @brief Read call from the PPU
*/
Byte ReadPPU(Word addr);
/**
* @brief Write call from the CPU
*/
void WriteCPU(Word addr, Byte val);
/**
* @brief Write call from the PPU
*/
void WritePPU(Word addr, Byte val);
/**
* @brief Lets the PPU trigger NMIs.
*/
inline void NMI() { cpu.NMI(); }
private: