Integrate all the progress into master #6

Merged
jaby merged 595 commits from ToolBox into main 2025-01-01 13:17:44 +00:00
4 changed files with 28 additions and 36 deletions
Showing only changes of commit bd6891b371 - Show all commits

View File

@ -21,6 +21,8 @@ namespace JabyEngine {
static constexpr size_t Height = 240;
#endif
static uint8_t current_id;
static void enable() {
GPU_IO::GP1 = GPU_IO::Command::SetDisplayState(GPU_IO::DisplayState::On);
}
@ -28,10 +30,6 @@ namespace JabyEngine {
static void disable() {
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);
};

View File

@ -7,22 +7,19 @@
namespace JabyEngine {
namespace GPU {
namespace internal {
struct Screen {
static void configurate() {
static constexpr uint16_t FirstVisiblePixelH = 0x260;
struct Display {
typedef ::JabyEngine::GPU::Display PublicDisplay;
#ifdef JABYENGINE_PAL
static constexpr uint16_t FirstVisiblePixelV = 0xA3;
GPU_IO::GP1 = GPU_IO::Command::DisplayMode(GPU_IO::DisplayMode_t::PAL());
GPU::Screen::set_offset(0, 0);
#else
static constexpr uint16_t FirstVisiblePixelV = 0x88;
GPU_IO::GP1 = GPU_IO::Command::DisplayMode(GPU_IO::DisplayMode_t::NTSC());
GPU::Screen::set_offset(0, 5); //< Random values
#endif
}
static constexpr auto Width = PublicDisplay::Width;
static constexpr auto Height = PublicDisplay::Height;
#ifdef JABYENGINE_PAL
static constexpr auto DisplayMode = GPU_IO::DisplayMode_t::PAL();
static constexpr uint16_t ScanlinesV = 288;
#else
static constexpr auto DisplayMode = GPU_IO::DisplayMode_t::NTSC();
static constexpr uint16_t ScanlinesV = 240;
#endif //JABYENGINE_PAL
static void exchange_buffer_and_display();
};

View File

@ -16,6 +16,12 @@ namespace JabyEngine {
namespace boot {
namespace 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() {
LZ4Decompressor lz4_decomp(reinterpret_cast<uint8_t*>(&__boot_loader_end));
@ -50,8 +56,8 @@ namespace JabyEngine {
void setup() {
GPU_IO::GP1 = GPU_IO::Command::Reset();
internal::Screen::configurate();
internal::Screen::exchange_buffer_and_display();
configurate_display();
internal::Display::exchange_buffer_and_display();
GPU::internal::wait_ready_for_CMD();
GPU::internal::quick_fill_fast(Color24::Black(), PositionU16(32, 0), SizeU16(Display::Width, Display::Height));

View File

@ -2,26 +2,18 @@
namespace JabyEngine {
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 {
typedef ::JabyEngine::GPU::Screen PublicScreenClass;
#ifdef JABYENGINE_PAL
static constexpr uint16_t ScanlinesV = 288;
#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));
void Display :: exchange_buffer_and_display() {
GPU::internal::set_draw_area(0, (PublicDisplay::Height*PublicDisplay::current_id));
PublicDisplay::current_id ^= 1;
GPU_IO::GP1 = GPU_IO::Command::DisplayArea(0, (PublicDisplay::Height*PublicDisplay::current_id));
}
}
#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;
y += 43;
@ -35,5 +27,4 @@ namespace JabyEngine {
}
#endif //USE_NO$PSX
}
}