diff --git a/CMakeLists.txt b/CMakeLists.txt index 553d452..7b52446 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,4 +29,5 @@ add_executable(ComSquare sources/CPU/Cpu.hpp sources/PPU/Ppu.cpp sources/PPU/Ppu.hpp -) + sources/APU/APU.hpp + sources/APU/APU.cpp) diff --git a/sources/APU/APU.cpp b/sources/APU/APU.cpp new file mode 100644 index 0000000..c459992 --- /dev/null +++ b/sources/APU/APU.cpp @@ -0,0 +1,4 @@ +// +// Created by Melefo on 27/01/2020. +// + diff --git a/sources/APU/APU.hpp b/sources/APU/APU.hpp new file mode 100644 index 0000000..a882ce1 --- /dev/null +++ b/sources/APU/APU.hpp @@ -0,0 +1,61 @@ +// +// Created by Melefo on 24/01/2020. +// + +#ifndef COMSQUARE_APU_HPP +#define COMSQUARE_APU_HPP + +#include "../Memory/IMemory.hpp" + +namespace ComSquare::APU +{ + struct Registers { + //! @brief The Accumulator register + unsigned char a; + + //! @brief The X index register + unsigned char x; + + //! @brief The Y index register + unsigned char y; + + //! @brief The Stack pointer register + unsigned char sp; + + //! @brief The Program counter register + union { + struct { + unsigned char pch; + unsigned char pcl; + }; + unsigned short pc; + }; + + //! @brief Program Status Word register + union psw { + //! @brief Negative flag + bool n : 1; + //! @brief Overflow flag + bool v : 1; + //! @brief Direct page flag + bool p : 1; + //! @brief Break flag + bool b : 1; + //! @brief Half carry flag + bool h : 1; + //! @brief Interrupt enabled flag + bool i : 1; + //! @brief Zero flag + bool z : 1; + //! @brief Carry flag + bool c : 1; + }; + }; + + class APU : IMemory { + private: + Registers _registers; + }; +} + +#endif //COMSQUARE_APU_HPP