Setup DisplayArea
This commit is contained in:
parent
69a84952ba
commit
1e329bb691
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue