First draft for LookUpColor8
This commit is contained in:
parent
003b20e2e2
commit
3651c4c405
|
@ -153,6 +153,30 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct LookUpColor8 {
|
||||||
|
static constexpr BitRange LUPosition[] = {
|
||||||
|
BitRange::from_to(0, 7),
|
||||||
|
BitRange::from_to(8, 15)
|
||||||
|
};
|
||||||
|
uint8_t lu_id[2];
|
||||||
|
|
||||||
|
static constexpr LookUpColor8 from_ids(uint8_t px0, uint8_t px1) {
|
||||||
|
return {{px0, px1}};
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr uint8_t get_lu_id(size_t at) const {
|
||||||
|
return this->lu_id[at];
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr void set_lu_id(uint8_t new_lu_id, size_t at) {
|
||||||
|
this->lu_id[at] = new_lu_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t force_read() const {
|
||||||
|
return *const_cast<const volatile uint16_t*>(reinterpret_cast<const uint16_t*>(this->lu_id));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct Position : public internal::XYMovement<Position<T>, T> {
|
struct Position : public internal::XYMovement<Position<T>, T> {
|
||||||
T x;
|
T x;
|
||||||
|
|
|
@ -32,10 +32,9 @@ namespace JabyEngine {
|
||||||
const CLUT clut {
|
const CLUT clut {
|
||||||
.cmd = CPU2VRAM::create(AreaU16::create(dst_cord, GPU::SizeU16::create(16, 1))),
|
.cmd = CPU2VRAM::create(AreaU16::create(dst_cord, GPU::SizeU16::create(16, 1))),
|
||||||
.data = {
|
.data = {
|
||||||
Color::Blue(), Color::White(),
|
Color::Grey(), Color::White(),
|
||||||
Color::Blue(), Color::White(), Color::Blue(), Color::White(), Color::Blue(), Color::White(),
|
Color::Black(), Color::Black(), Color::Black(), Color::Black(), Color::Black(), Color::Black(), Color::Black(),
|
||||||
Color::Blue(), Color::White(),
|
Color::Black(), Color::Black(), Color::Black(), Color::Black(), Color::Black(), Color::Black(), Color::Black(),
|
||||||
Color::Blue(), Color::White(), Color::Blue(), Color::White(), Color::Blue(), Color::White(),
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,6 +92,23 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
asm("# Planschi1");
|
||||||
|
auto test = LookUpColor8::from_ids(0xAA, 0xBB);
|
||||||
|
test.force_read();
|
||||||
|
asm("# Planschi2");
|
||||||
|
test.set_lu_id(0xCC, 0);
|
||||||
|
test.set_lu_id(0xDD, 1);
|
||||||
|
test.force_read();
|
||||||
|
asm("# Planschi3");
|
||||||
|
test.set_lu_id(*reinterpret_cast<uint8_t*>(0xAA), 0);
|
||||||
|
test.set_lu_id(*reinterpret_cast<uint8_t*>(0xDD), 1);
|
||||||
|
test.force_read();
|
||||||
|
asm("# Planschi4");
|
||||||
|
test.set_lu_id(*reinterpret_cast<uint8_t*>(0xAA), *reinterpret_cast<uint8_t*>(0xAE));
|
||||||
|
test.set_lu_id(*reinterpret_cast<uint8_t*>(0xDD), *reinterpret_cast<uint8_t*>(0xDE));
|
||||||
|
test.force_read();
|
||||||
|
asm("# Planschi5");
|
||||||
|
|
||||||
GPU_IO::GP1.write(GPU_IO::Command::Reset());
|
GPU_IO::GP1.write(GPU_IO::Command::Reset());
|
||||||
configurate_display();
|
configurate_display();
|
||||||
::JabyEngine::GPU::internal::Display::exchange_buffer_and_display();
|
::JabyEngine::GPU::internal::Display::exchange_buffer_and_display();
|
||||||
|
|
Loading…
Reference in New Issue