diff --git a/include/PSX/System/IOPorts/GPU_IO.hpp b/include/PSX/System/IOPorts/GPU_IO.hpp index 9330a5cc..988a0f3c 100644 --- a/include/PSX/System/IOPorts/GPU_IO.hpp +++ b/include/PSX/System/IOPorts/GPU_IO.hpp @@ -90,6 +90,13 @@ namespace GPU { return ComplexBitMap{construct_cmd(0x04, static_cast(dir))}; } + static constexpr GP1 DisplayArea(uint16_t x, uint16_t y) { + constexpr auto X = BitRange::from_to(0, 9); + constexpr auto Y = BitRange::from_to(10, 18); + + return ComplexBitMap{construct_cmd(0x05, ComplexBitMap::with(X.with(x), Y.with(y)).raw)}; + } + static constexpr GP1 HorizontalDisplayRange(uint32_t x1, uint32_t x2) { constexpr auto X1 = BitRange::from_to(0, 11); constexpr auto X2 = BitRange::from_to(12, 23); diff --git a/src/Library/include/GPU/GPU.hpp b/src/Library/include/GPU/GPU.hpp index b010005b..85cf0bbd 100644 --- a/src/Library/include/GPU/GPU.hpp +++ b/src/Library/include/GPU/GPU.hpp @@ -45,12 +45,12 @@ namespace GPU { static constexpr uint16_t FirstVisiblePixelV = 0xA3; GP1.write(Command::GP1::DisplayMode(Mode::PAL())); - GPU::Screen::set_offset(FirstVisiblePixelH, FirstVisiblePixelV); + GPU::Screen::set_offset(78, 43); #else static constexpr uint16_t FirstVisiblePixelV = 0x88; GP1.write(Command::GP1::DisplayMode(Mode::NTSC())); - GPU::Screen::set_offset(FirstVisiblePixelH, FirstVisiblePixelV); + GPU::Screen::set_offset(78, 45); #endif } } diff --git a/src/Library/src/BootLoader/gpu_boot.cpp b/src/Library/src/BootLoader/gpu_boot.cpp index 3cfe70d6..15bca7ce 100644 --- a/src/Library/src/BootLoader/gpu_boot.cpp +++ b/src/Library/src/BootLoader/gpu_boot.cpp @@ -9,7 +9,7 @@ namespace GPU { Display::disable(); // Upload SplashScreen picture - auto state = FileProcessor::create(reinterpret_cast(SplashScreen), SimpleTIM(93, 0, 0, 0)); + auto state = FileProcessor::create(reinterpret_cast(SplashScreen), SimpleTIM(0, 0, 0, 0)); while(state.process((sizeof(SplashScreen)/sizeof(uint32_t)))); Display::enable(); @@ -18,7 +18,8 @@ namespace GPU { void setup() { GP1.write(Command::GP1::Reset()); Screen::configurate(); - + quick_fill_fast(Color24::Black(), PositionU16(0, 0), SizeU16(640, 480)); + GP1.write(Command::GP1::DisplayArea(0, 0)); } } \ No newline at end of file diff --git a/src/Library/src/GPU/GPU.cpp b/src/Library/src/GPU/GPU.cpp index 2ee8d735..bc2e363f 100644 --- a/src/Library/src/GPU/GPU.cpp +++ b/src/Library/src/GPU/GPU.cpp @@ -8,9 +8,16 @@ namespace GPU { static constexpr uint16_t ScanlinesV = 240; #endif //JABYENGINE_PAL +#ifndef USE_NO$PSX + void set_offset(uint16_t x, uint16_t y) { + GP1.write(Command::GP1::HorizontalDisplayRange((x << 3), (x + Display::Width) << 3)); + GP1.write(Command::GP1::VerticalDisplayRange(y, y + Display::Height)); + } +#else void set_offset(uint16_t x, uint16_t y) { GP1.write(Command::GP1::HorizontalDisplayRange(x, (x + Display::Width*8))); GP1.write(Command::GP1::VerticalDisplayRange(y - (ScanlinesV/2), y + (ScanlinesV/2))); } +#endif //USE_NO$PSX } } \ No newline at end of file