From bd44cc2c96553428a90ead00adbc778547561ca7 Mon Sep 17 00:00:00 2001 From: Justin Scofield Date: Mon, 11 Jul 2022 21:35:35 -0400 Subject: [PATCH] added psuedo_vram --- src/CMakeLists.txt | 1 + src/app/gfx/psuedo_vram.cc | 7 +++++ src/app/gfx/psuedo_vram.h | 53 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 src/app/gfx/psuedo_vram.cc create mode 100644 src/app/gfx/psuedo_vram.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2dd0b917..5c9a9d5e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -49,6 +49,7 @@ add_executable( app/core/constants.cc app/core/controller.cc app/gfx/bitmap.cc + app/gfx/psuedo_vram.cc app/gfx/snes_tile.cc app/gfx/snes_palette.cc app/zelda3/overworld.cc diff --git a/src/app/gfx/psuedo_vram.cc b/src/app/gfx/psuedo_vram.cc new file mode 100644 index 00000000..f9435e41 --- /dev/null +++ b/src/app/gfx/psuedo_vram.cc @@ -0,0 +1,7 @@ +#include "psuedo_vram.h" + +namespace yaze { +namespace app { +namespace gfx {} +} // namespace app +} // namespace yaze \ No newline at end of file diff --git a/src/app/gfx/psuedo_vram.h b/src/app/gfx/psuedo_vram.h new file mode 100644 index 00000000..5c4d29e3 --- /dev/null +++ b/src/app/gfx/psuedo_vram.h @@ -0,0 +1,53 @@ +#ifndef YAZE_APP_GFX_PSUEDO_VRAM_H +#define YAZE_APP_GFX_PSUEDO_VRAM_H + +#include + +#include +#include + +#include "app/core/gfx/bitmap.h" + +namespace yaze { +namespace app { +namespace gfx { + +// Picture Processor Unit: 15-Bit + +// Video RAM: 64 KB of VRAM for screen maps (for 'background' layers) and tile +// sets (for backgrounds and objects); 512 + 32 bytes of 'OAM' (Object Attribute +// Memory) for objects; 512 bytes of 'CGRAM' for palette data. + +// Palette: 256 entries; 15-Bit color (BGR555) for a total of 32,768 colors. +// Maximum colors per layer per scanline: 256. Maximum colors on-screen: 32,768 +// (using color arithmetic for transparency effects). + +// Resolution: between 256x224 and 512x448. Most games used 256x224 pixels since +// higher resolutions caused slowdown, flicker, and/or had increased limitations +// on layers and colors (due to memory bandwidth constraints); the higher +// resolutions were used for less processor-intensive games, in-game menus, +// text, and high resolution images. + +// Maximum onscreen objects (sprites): 128 (32 per line, up to 34 8x8 tiles per +// line). + +// Maximum number of sprite pixels on one scanline: 256. The renderer was +// designed such that it would drop the frontmost sprites instead of the +// rearmost sprites if a scanline exceeded the limit, allowing for creative +// clipping effects. + +// Most common display modes: Pixel-to-pixel text mode 1 (16 colors per tile; 3 +// scrolling layers) and affine mapped text mode 7 (256 colors per tile; one +// rotating/scaling layer). +class psuedo_vram { + public: + private: + std::unordered_map m_vram; + static const uint32_t REAL_VRAM_SIZE = 0x8000; +}; + +} // namespace gfx +} // namespace app +} // namespace yaze + +#endif \ No newline at end of file