Add proper NTSC conversion values

This commit is contained in:
Jaby 2024-02-04 21:27:11 -05:00
parent 20e8e5d68c
commit 16cfcf42b2
3 changed files with 10 additions and 8 deletions

View File

@ -39,7 +39,7 @@ namespace JabyEngine {
GPU_IO::GP1.write(GPU_IO::Command::SetDisplayState(GPU_IO::DisplayState::Off)); GPU_IO::GP1.write(GPU_IO::Command::SetDisplayState(GPU_IO::DisplayState::Off));
} }
static void set_offset(uint16_t x, uint16_t y); static void set_offset(int16_t x, int16_t y);
}; };
static uint32_t update_id() { static uint32_t update_id() {

View File

@ -13,11 +13,13 @@ namespace JabyEngine {
static constexpr auto Height = PublicDisplay::Height; static constexpr auto Height = PublicDisplay::Height;
#ifdef JABYENGINE_PAL #ifdef JABYENGINE_PAL
static constexpr auto DisplayMode = GPU_IO::DisplayMode::PAL(); static constexpr auto DisplayMode = GPU_IO::DisplayMode::PAL();
static constexpr uint16_t ScanlinesV = 288; static constexpr uint16_t ScanlinesV = 288;
static constexpr auto DisplayRange = PositionI16::create(78, 35);
#else #else
static constexpr auto DisplayMode = GPU_IO::DisplayMode::NTSC(); static constexpr auto DisplayMode = GPU_IO::DisplayMode::NTSC();
static constexpr uint16_t ScanlinesV = 240; static constexpr uint16_t ScanlinesV = 240;
static constexpr auto DisplayRange = PositionI16::create(76, 16);
#endif //JABYENGINE_PAL #endif //JABYENGINE_PAL
static uint32_t exchange_buffer_and_display(); static uint32_t exchange_buffer_and_display();

View File

@ -73,9 +73,9 @@ namespace JabyEngine {
} }
} }
void Display :: set_offset(uint16_t x, uint16_t y) { void Display :: set_offset(int16_t x, int16_t y) {
x += 78; x += internal::Display::DisplayRange.x;
y += 35; y += internal::Display::DisplayRange.y;
GPU_IO::GP1.write(GPU_IO::Command::HorizontalDisplayRange((x << 3), (x + Display::Width) << 3)); GPU_IO::GP1.write(GPU_IO::Command::HorizontalDisplayRange((x << 3), (x + Display::Width) << 3));
GPU_IO::GP1.write(GPU_IO::Command::VerticalDisplayRange(y, y + Display::Height)); GPU_IO::GP1.write(GPU_IO::Command::VerticalDisplayRange(y, y + Display::Height));