36 lines
1.3 KiB
C++
36 lines
1.3 KiB
C++
#include "../include/GPU/GPU.hpp"
|
|
|
|
namespace GPU {
|
|
namespace Screen {
|
|
uint8_t CurrentDisplayAreaID = 1; //< Setup will call exchange and set it to 0
|
|
|
|
namespace Range {
|
|
#ifdef JABYENGINE_PAL
|
|
static constexpr uint16_t ScanlinesV = 288;
|
|
#else
|
|
static constexpr uint16_t ScanlinesV = 240;
|
|
#endif //JABYENGINE_PAL
|
|
|
|
#ifndef USE_NO$PSX
|
|
void set_offset(uint16_t x, uint16_t y) {
|
|
x += 78;
|
|
y += 43;
|
|
|
|
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
|
|
}
|
|
|
|
void exchange_buffer_and_display() {
|
|
GPU::set_draw_area(0, (Display::Height*CurrentDisplayAreaID));
|
|
CurrentDisplayAreaID ^= 1;
|
|
GP1.write(Command::GP1::DisplayArea(0, (Display::Height*CurrentDisplayAreaID)));
|
|
}
|
|
}
|
|
} |