Setup Display to standard resolution instead of high res

This commit is contained in:
Jaby
2022-10-04 21:54:40 +02:00
parent 051ae637f1
commit ec4bdac5ec
5 changed files with 60 additions and 20 deletions

View File

@@ -30,7 +30,11 @@ namespace GPU {
}
namespace Screen {
void set_offset(uint16_t x, uint16_t y);
extern uint8_t CurrentDisplayAreaID;
namespace Range {
void set_offset(uint16_t x, uint16_t y);
}
}
}

View File

@@ -58,6 +58,22 @@ namespace GPU {
return ComplexBitMap{(0b101u << 29)};
}
static constexpr GP0 DrawAreaTemplate(uint8_t code, uint16_t x, uint16_t y) {
constexpr auto Command = BitRange<uint32_t>::from_to(24, 31);
constexpr auto Y = BitRange<uint32_t>::from_to(10, 18);
constexpr auto X = BitRange<uint32_t>::from_to(0, 9);
return ComplexBitMap<uint32_t>::with(Command.with(code), Y.with(y), X.with(x));
}
static constexpr GP0 DrawAreaTopLeft(uint16_t x, uint16_t y) {
return DrawAreaTemplate(0xE3, x, y);
}
static constexpr GP0 DrawAreaBottomRight(uint16_t x, uint16_t y) {
return DrawAreaTemplate(0xE4, x, y);
}
static constexpr GP0 TopLeftPosition(uint16_t x, uint16_t y) {
return ComplexBitMap{static_cast<uint32_t>((y << 16u) | x)};
}