Start configurating GPU

This commit is contained in:
Jaby
2022-10-02 17:32:23 +02:00
parent e5943cb3d2
commit 63df4e8ad8
7 changed files with 58 additions and 18 deletions

View File

@@ -5,6 +5,29 @@
#include <PSX/System/IOPorts/GPU_IO.hpp>
namespace GPU {
struct DisplayMode {
enum struct TVEncoding {
NTSC = 0,
PAL = 1,
};
static constexpr auto HorizontalResolution368 = Bit<uint32_t>(6);
static constexpr auto VerticalInterlace = Bit<uint32_t>(5);
static constexpr auto DisplayAreaColorDepth = BitRange<GPU::DisplayAreaColorDepth>::from_to(4, 4);
static constexpr auto VideoMode = BitRange<TVEncoding>::from_to(3, 3);
static constexpr auto VerticalResolution = BitRange<GPU::VerticalResolution>::from_to(2, 2);
static constexpr auto HorizontalResolution = BitRange<GPU::HorizontalResolution>::from_to(0, 1);
static constexpr uint32_t PAL() {
return ComplexBitMap<uint32_t>::with(
DisplayMode::HorizontalResolution.with(GPU::HorizontalResolution::$320),
DisplayMode::VerticalResolution.with(GPU::VerticalResolution::$240),
DisplayMode::VideoMode.with(TVEncoding::PAL),
DisplayMode::DisplayAreaColorDepth.with(GPU::DisplayAreaColorDepth::$15bit)
).raw;
}
};
static void quick_fill_fast(const Color24& color, const PositionU16& pos, const SizeU16& size) {
GP0.write(Command::GP0::QuickFill(color));
GP0.write(Command::GP0::TopLeftPosition(pos.x, pos.y));