diff --git a/src/Application.hpp b/src/Application.hpp index b2cf02e..4ed7b95 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -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: diff --git a/src/Bus.hpp b/src/Bus.hpp index cfcfbaa..4cd0006 100644 --- a/src/Bus.hpp +++ b/src/Bus.hpp @@ -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: