Setup DisplayArea

This commit is contained in:
Jaby 2022-10-03 16:23:35 +02:00
parent 3ee0ba72b2
commit 051ae637f1
4 changed files with 19 additions and 4 deletions

View File

@ -90,6 +90,13 @@ namespace GPU {
return ComplexBitMap{construct_cmd(0x04, static_cast<uint32_t>(dir))};
}
static constexpr GP1 DisplayArea(uint16_t x, uint16_t y) {
constexpr auto X = BitRange<uint32_t>::from_to(0, 9);
constexpr auto Y = BitRange<uint32_t>::from_to(10, 18);
return ComplexBitMap{construct_cmd(0x05, ComplexBitMap<uint32_t>::with(X.with(x), Y.with(y)).raw)};
}
static constexpr GP1 HorizontalDisplayRange(uint32_t x1, uint32_t x2) {
constexpr auto X1 = BitRange<uint32_t>::from_to(0, 11);
constexpr auto X2 = BitRange<uint32_t>::from_to(12, 23);

View File

@ -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
}
}

View File

@ -9,7 +9,7 @@ namespace GPU {
Display::disable();
// Upload SplashScreen picture
auto state = FileProcessor::create(reinterpret_cast<const uint32_t*>(SplashScreen), SimpleTIM(93, 0, 0, 0));
auto state = FileProcessor::create(reinterpret_cast<const uint32_t*>(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));
}
}

View File

@ -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
}
}