Cleanup GPU code more
This commit is contained in:
parent
dfe084f611
commit
9d46658e0f
|
@ -21,6 +21,8 @@ namespace JabyEngine {
|
||||||
static constexpr size_t Height = 240;
|
static constexpr size_t Height = 240;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static uint8_t current_id;
|
||||||
|
|
||||||
static void enable() {
|
static void enable() {
|
||||||
GPU_IO::GP1 = GPU_IO::Command::SetDisplayState(GPU_IO::DisplayState::On);
|
GPU_IO::GP1 = GPU_IO::Command::SetDisplayState(GPU_IO::DisplayState::On);
|
||||||
}
|
}
|
||||||
|
@ -28,10 +30,6 @@ namespace JabyEngine {
|
||||||
static void disable() {
|
static void disable() {
|
||||||
GPU_IO::GP1 = GPU_IO::Command::SetDisplayState(GPU_IO::DisplayState::Off);
|
GPU_IO::GP1 = GPU_IO::Command::SetDisplayState(GPU_IO::DisplayState::Off);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
struct Screen {
|
|
||||||
static uint8_t CurrentDisplayAreaID;
|
|
||||||
|
|
||||||
static void set_offset(uint16_t x, uint16_t y);
|
static void set_offset(uint16_t x, uint16_t y);
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,22 +7,19 @@
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
struct Screen {
|
struct Display {
|
||||||
static void configurate() {
|
typedef ::JabyEngine::GPU::Display PublicDisplay;
|
||||||
static constexpr uint16_t FirstVisiblePixelH = 0x260;
|
|
||||||
|
|
||||||
#ifdef JABYENGINE_PAL
|
static constexpr auto Width = PublicDisplay::Width;
|
||||||
static constexpr uint16_t FirstVisiblePixelV = 0xA3;
|
static constexpr auto Height = PublicDisplay::Height;
|
||||||
|
|
||||||
GPU_IO::GP1 = GPU_IO::Command::DisplayMode(GPU_IO::DisplayMode_t::PAL());
|
#ifdef JABYENGINE_PAL
|
||||||
GPU::Screen::set_offset(0, 0);
|
static constexpr auto DisplayMode = GPU_IO::DisplayMode_t::PAL();
|
||||||
#else
|
static constexpr uint16_t ScanlinesV = 288;
|
||||||
static constexpr uint16_t FirstVisiblePixelV = 0x88;
|
#else
|
||||||
|
static constexpr auto DisplayMode = GPU_IO::DisplayMode_t::NTSC();
|
||||||
GPU_IO::GP1 = GPU_IO::Command::DisplayMode(GPU_IO::DisplayMode_t::NTSC());
|
static constexpr uint16_t ScanlinesV = 240;
|
||||||
GPU::Screen::set_offset(0, 5); //< Random values
|
#endif //JABYENGINE_PAL
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static void exchange_buffer_and_display();
|
static void exchange_buffer_and_display();
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,6 +16,12 @@ namespace JabyEngine {
|
||||||
namespace boot {
|
namespace boot {
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
using namespace JabyEngine::GPU;
|
using namespace JabyEngine::GPU;
|
||||||
|
|
||||||
|
static void configurate_display() {
|
||||||
|
// Ideal I hope that an offset of 0,0 will produce a well enough centered picture for every TV
|
||||||
|
GPU_IO::GP1 = GPU_IO::Command::DisplayMode(internal::Display::DisplayMode);
|
||||||
|
GPU::Display::set_offset(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static size_t decompress_logo() {
|
static size_t decompress_logo() {
|
||||||
LZ4Decompressor lz4_decomp(reinterpret_cast<uint8_t*>(&__boot_loader_end));
|
LZ4Decompressor lz4_decomp(reinterpret_cast<uint8_t*>(&__boot_loader_end));
|
||||||
|
@ -50,8 +56,8 @@ namespace JabyEngine {
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
GPU_IO::GP1 = GPU_IO::Command::Reset();
|
GPU_IO::GP1 = GPU_IO::Command::Reset();
|
||||||
internal::Screen::configurate();
|
configurate_display();
|
||||||
internal::Screen::exchange_buffer_and_display();
|
internal::Display::exchange_buffer_and_display();
|
||||||
|
|
||||||
GPU::internal::wait_ready_for_CMD();
|
GPU::internal::wait_ready_for_CMD();
|
||||||
GPU::internal::quick_fill_fast(Color24::Black(), PositionU16(32, 0), SizeU16(Display::Width, Display::Height));
|
GPU::internal::quick_fill_fast(Color24::Black(), PositionU16(32, 0), SizeU16(Display::Width, Display::Height));
|
||||||
|
|
|
@ -2,26 +2,18 @@
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
uint8_t Screen :: CurrentDisplayAreaID = 1; //< Setup will call exchange and set it to 0
|
uint8_t Display :: current_id = 1; //< Setup will call exchange and set it to 0
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
typedef ::JabyEngine::GPU::Screen PublicScreenClass;
|
void Display :: exchange_buffer_and_display() {
|
||||||
|
GPU::internal::set_draw_area(0, (PublicDisplay::Height*PublicDisplay::current_id));
|
||||||
#ifdef JABYENGINE_PAL
|
PublicDisplay::current_id ^= 1;
|
||||||
static constexpr uint16_t ScanlinesV = 288;
|
GPU_IO::GP1 = GPU_IO::Command::DisplayArea(0, (PublicDisplay::Height*PublicDisplay::current_id));
|
||||||
#else
|
|
||||||
static constexpr uint16_t ScanlinesV = 240;
|
|
||||||
#endif //JABYENGINE_PAL
|
|
||||||
|
|
||||||
void Screen :: exchange_buffer_and_display() {
|
|
||||||
GPU::internal::set_draw_area(0, (Display::Height*PublicScreenClass::CurrentDisplayAreaID));
|
|
||||||
PublicScreenClass::CurrentDisplayAreaID ^= 1;
|
|
||||||
GPU_IO::GP1 = GPU_IO::Command::DisplayArea(0, (Display::Height*PublicScreenClass::CurrentDisplayAreaID));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_NO$PSX
|
#ifndef USE_NO$PSX
|
||||||
void Screen :: set_offset(uint16_t x, uint16_t y) {
|
void Display :: set_offset(uint16_t x, uint16_t y) {
|
||||||
x += 78;
|
x += 78;
|
||||||
y += 43;
|
y += 43;
|
||||||
|
|
||||||
|
@ -35,5 +27,4 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
#endif //USE_NO$PSX
|
#endif //USE_NO$PSX
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue