Remove the ComplexBitMap

This commit is contained in:
2023-03-22 20:46:08 +01:00
parent 550d657478
commit 94c078dc9f
13 changed files with 307 additions and 489 deletions

View File

@@ -53,12 +53,12 @@ namespace JabyEngine {
PAL = 1,
};
static constexpr auto HorizontalResolution368 = IOBitSet(6);
static constexpr auto VerticalInterlace = IOBitSet(5);
static constexpr auto DisplayAreaColorDepth = IOValueSet::from_to(4, 4);
static constexpr auto VideoMode = IOValueSet::from_to(3, 3);
static constexpr auto VerticalResolution = IOValueSet::from_to(2, 2);
static constexpr auto HorizontalResolution = IOValueSet::from_to(0, 1);
static constexpr auto HorizontalResolution368 = Bit(6);
static constexpr auto VerticalInterlace = Bit(5);
static constexpr auto DisplayAreaColorDepth = BitRange::from_to(4, 4);
static constexpr auto VideoMode = BitRange::from_to(3, 3);
static constexpr auto VerticalResolution = BitRange::from_to(2, 2);
static constexpr auto HorizontalResolution = BitRange::from_to(0, 1);
static constexpr Self PAL() {
return Self::from(
@@ -86,12 +86,12 @@ namespace JabyEngine {
);
struct Command {
struct Command {
struct Helper {
static constexpr GP0_t DrawAreaTemplate(uint8_t code, uint16_t x, uint16_t y) {
constexpr auto Command = IOValueSet::from_to(24, 31);
constexpr auto Y = IOValueSet::from_to(10, 18);
constexpr auto X = IOValueSet::from_to(0, 9);
constexpr auto Command = BitRange::from_to(24, 31);
constexpr auto Y = BitRange::from_to(10, 18);
constexpr auto X = BitRange::from_to(0, 9);
return GP0_t::from(Command.with(code), Y.with(y), X.with(x));
}
@@ -142,24 +142,24 @@ namespace JabyEngine {
}
static constexpr GP1_t 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);
constexpr auto X = BitRange::from_to(0, 9);
constexpr auto Y = BitRange::from_to(10, 18);
return {Helper::construct_cmd(0x05, ComplexBitMap<uint32_t>::with(X.with(x), Y.with(y)).raw)};
return {Helper::construct_cmd(0x05, X.as_value(x) | Y.as_value(y))};
}
static constexpr GP1_t 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);
constexpr auto X1 = BitRange::from_to(0, 11);
constexpr auto X2 = BitRange::from_to(12, 23);
return {Helper::construct_cmd(0x06, ComplexBitMap<uint32_t>::with(X1.with(x1), X2.with(x2)).raw)};
return {Helper::construct_cmd(0x06, X1.as_value(x1) | X2.as_value(x2))};
}
static constexpr GP1_t VerticalDisplayRange(uint32_t y1, uint32_t y2) {
constexpr auto Y1 = BitRange<uint32_t>::from_to(0, 9);
constexpr auto Y2 = BitRange<uint32_t>::from_to(10, 19);
constexpr auto Y1 = BitRange::from_to(0, 9);
constexpr auto Y2 = BitRange::from_to(10, 19);
return {Helper::construct_cmd(0x07, ComplexBitMap<uint32_t>::with(Y1.with(y1), Y2.with(y2)).raw)};
return {Helper::construct_cmd(0x07, Y1.as_value(y1) | Y2.as_value(y2))};
}
static constexpr GP1_t DisplayMode(DisplayMode_t mode) {
@@ -168,32 +168,32 @@ namespace JabyEngine {
};
__declare_io_type(GPUSTAT, uint32_t,
static constexpr auto DrawingOddLinesInterlaced = IOBitSet(31);
static constexpr auto DMADirectionValue = IOValueSet::from_to(29, 30);
static constexpr auto DMAReady = IOBitSet(28);
static constexpr auto VRAMtoCPUtransferReay = IOBitSet(27);
static constexpr auto GP0ReadyForCMD = IOBitSet(26);
static constexpr auto FifoNotFull = IOBitSet(25); // Only for Fifo
static constexpr auto InterruptRequest = IOBitSet(24);
static constexpr auto DisplayDisabled = IOBitSet(23);
static constexpr auto VerticalInterlaceOn = IOBitSet(22);
static constexpr auto DisplayAreaColorDepth = IOValueSet::from_to(21, 21);
static constexpr auto VideoModePal = IOBitSet(20);
static constexpr auto VerticalResolutionValue = IOValueSet::from_to(19, 19);
static constexpr auto HorizontalResolutionValue = IOValueSet::from_to(17, 18);
static constexpr auto HorizontalResolution368 = IOBitSet(16);
static constexpr auto TexturesDisabled = IOBitSet(15);
static constexpr auto NotDrawingMaskedPixels = IOBitSet(12);
static constexpr auto MaskBitSetDuringDrawEnabled = IOBitSet(11);
static constexpr auto DrawingToDisplayAreadAllowed = IOBitSet(10);
static constexpr auto DitherEnabled = IOBitSet(9);
static constexpr auto TexturePageColorValue = IOValueSet::from_to(7, 8);
static constexpr auto SemiTransparencyValue = IOValueSet::from_to(5, 6);
static constexpr auto TexturePageY = IOValueSet::from_to(4, 4); // N*256
static constexpr auto TexturePageX = IOValueSet::from_to(0, 3); // N*64
static constexpr auto DrawingOddLinesInterlaced = Bit(31);
static constexpr auto DMADirectionValue = BitRange::from_to(29, 30);
static constexpr auto DMAReady = Bit(28);
static constexpr auto VRAMtoCPUtransferReay = Bit(27);
static constexpr auto GP0ReadyForCMD = Bit(26);
static constexpr auto FifoNotFull = Bit(25); // Only for Fifo
static constexpr auto InterruptRequest = Bit(24);
static constexpr auto DisplayDisabled = Bit(23);
static constexpr auto VerticalInterlaceOn = Bit(22);
static constexpr auto DisplayAreaColorDepth = BitRange::from_to(21, 21);
static constexpr auto VideoModePal = Bit(20);
static constexpr auto VerticalResolutionValue = BitRange::from_to(19, 19);
static constexpr auto HorizontalResolutionValue = BitRange::from_to(17, 18);
static constexpr auto HorizontalResolution368 = Bit(16);
static constexpr auto TexturesDisabled = Bit(15);
static constexpr auto NotDrawingMaskedPixels = Bit(12);
static constexpr auto MaskBitSetDuringDrawEnabled = Bit(11);
static constexpr auto DrawingToDisplayAreadAllowed = Bit(10);
static constexpr auto DitherEnabled = Bit(9);
static constexpr auto TexturePageColorValue = BitRange::from_to(7, 8);
static constexpr auto SemiTransparencyValue = BitRange::from_to(5, 6);
static constexpr auto TexturePageY = BitRange::from_to(4, 4); // N*256
static constexpr auto TexturePageX = BitRange::from_to(0, 3); // N*64
static constexpr auto VerticalResolution480 = IOBitSet(19);
static constexpr auto TexturePageY256 = IOBitSet(4);
static constexpr auto VerticalResolution480 = Bit(19);
static constexpr auto TexturePageY256 = Bit(4);
);
typedef volatile uint32_t GPUREAD_v;