Go to the documentation of this file.
18 #ifdef DEBUGGER_ENABLED
22 #define FALLTHROUGH __attribute__((fallthrough));
65 std::array<std::array<uint32_t, 1024>, 1024>
_screen;
75 ~PPU()
override =
default;
89 [[nodiscard]] std::string
getName()
const override;
98 virtual void update(
unsigned cycles);
106 [[nodiscard]]
int getBPP(
int bgNumber)
const;
118 template<
int levelLow,
int levelHigh>
122 Background::mergeBackgroundBuffer<levelLow, levelHigh>(this->_mainScreen, this->_mainScreenLevelMap, bg);
125 Background::mergeBackgroundBuffer<levelLow, levelHigh>(this->_subScreen, this->_subScreenLevelMap, bg);
@ Background3
Definition: PPU.hpp:41
void write(uint24_t addr, uint8_t data) override
Write data to this component.
Definition: PPU.cpp:82
Component
Definition: Components.hpp:9
Ram::Ram oamram
Definition: PPU.hpp:50
std::array< std::array< uint32_t, 1024 >, 1024 > _screen
Final Screen buffer.
Definition: PPU.hpp:65
std::string getName() const override
Get the name of this accessor (used for debug purpose)
Definition: PPU.cpp:336
uint24_t getSize() const override
Get the size of the data. This size can be lower than the mapped data.
Definition: PPU.cpp:277
Vector2< bool > getBackgroundMirroring(int bgNumber) const
Tells if the tilemap is expanded for the x and y directions.
Definition: PPU.cpp:545
union ComSquare::PPU::Registers::@96 _t[2]
TM - TS Registers (Main & Sub Screen Designation)
int getBgNumber() const
Get the BackGround Number.
Definition: Background.cpp:153
Registers _registers
Init ppuRegisters.
Definition: PPU.hpp:54
std::array< std::array< uint8_t, 1024 >, 1024 > _mainScreenLevelMap
Definition: PPU.hpp:60
PPU(Renderer::IRenderer &renderer)
Definition: PPU.cpp:18
static constexpr uint32_t CGRamSize
Definition: PPU.hpp:32
uint16_t getTilesetAddress(int bgNumber) const
Give the address to find the correct tileset for a given x and y.
Definition: PPU.cpp:536
@ Background1
Definition: PPU.hpp:39
Definition: PPURegisters.hpp:145
void renderMainAndSubScreen()
Render the Main and sub screen correctly.
Definition: PPU.cpp:553
Definition: Background.cpp:11
unsigned uint24_t
Definition: Ints.hpp:10
std::array< std::array< uint32_t, 1024 >, 1024 > _mainScreen
Main Screen buffer.
Definition: PPU.hpp:59
std::array< std::array< uint8_t, 1024 >, 1024 > _subScreenLevelMap
Sub Screen buffer.
Definition: PPU.hpp:62
int getBPP(int bgNumber) const
get the bpp depending of the bgNumber and the Bgmode
Definition: PPU.cpp:487
Vector2< int > getBgScroll(int bgNumber) const
update the Vram buffer
Definition: PPU.cpp:673
Definition: Background.hpp:20
Struct to save all specific variables needed for the registers (prev values for example)
Definition: PPUUtils.hpp:51
BgName
Enum to access more easily the ppu background array.
Definition: PPU.hpp:38
static constexpr uint32_t OAMRamSize
Definition: PPU.hpp:33
void updateVramReadBuffer()
update the Vram buffer
Definition: PPU.cpp:667
const Registers & getWriteRegisters() const
Allow to look the value of each write register (used by Register debugger)
Definition: PPU.cpp:678
uint8_t raw
Definition: PPURegisters.hpp:155
Background _backgrounds[4]
Backgrounds buffers.
Definition: PPU.hpp:57
virtual void update(unsigned cycles)
Update the PPU of n cycles.
Definition: PPU.cpp:299
int getBgMode() const
Get the current background Mode.
Definition: PPU.cpp:662
std::array< std::array< uint32_t, 1024 >, 1024 > _subScreen
Definition: PPU.hpp:63
Ram::Ram cgram
Definition: PPU.hpp:51
@ Background4
Definition: PPU.hpp:42
void addToMainSubScreen(Background &bg)
Add a bg to the sub and/or main screen.
Definition: PPU.hpp:119
uint16_t getTileMapStartAddress(int bgNumber) const
Give the address where the tilemap starts.
Definition: PPU.cpp:531
Abstract class representing a continuous block of memory.
Definition: AMemory.hpp:18
Definition: IRenderer.hpp:15
uint16_t cgramRead(uint16_t addr)
Allow others components to read the CGRAM.
Definition: PPU.cpp:482
std::string getValueName(uint24_t addr) const override
Give the name of the Address register (used for debug)
Definition: PPU.cpp:341
Renderer::IRenderer & _renderer
Definition: PPU.hpp:55
Vector2< int > getCharacterSize(int bgNumber) const
Give the correct character size depending of the bgMode.
Definition: PPU.cpp:521
Ram::Ram vram
Rams.
Definition: PPU.hpp:49
PPU & operator=(const PPU &)=delete
static constexpr uint32_t VramSize
Definition: PPU.hpp:31
uint16_t getVramAddress() const
Give the Vram Address with the right Address remapping.
Definition: PPU.cpp:282
uint8_t read(uint24_t addr) override
Read data from the component.
Definition: PPU.cpp:37
uint16_t _vramReadBuffer
Used for vram read registers (0x2139 - 0x213A)
Definition: PPU.hpp:67
Component getComponent() const override
Get the component of this accessor (used for debug purpose)
Definition: PPU.cpp:477
@ Background2
Definition: PPU.hpp:40
The class containing all the registers of the PPU.
Definition: PPU.hpp:46
struct Utils::PpuState _ppuState
Struct that contain all necessary vars for the use of the registers.
Definition: PPU.hpp:69