Support BIOS Font

This commit is contained in:
Jaby
2024-01-02 15:42:57 -06:00
parent 1b6ac8e280
commit 9de1da161d
7 changed files with 68 additions and 46 deletions

View File

@@ -7,17 +7,25 @@ namespace JabyEngine {
struct FontBuffer {
// A line of 16 Pixel
struct Line {
Color pixel[BIOS_Font::Size.width];
LookUpColor4 pixel[BIOS_Font::Size.width/4];
void load(uint16_t bit_pattern) {
static constexpr auto BitsPerRound = 4;
size_t px_idx = 0;
for(uint16_t shift = 1 << 15; shift; shift = shift >> 1) {
this->pixel[px_idx++] = bit_pattern & shift ? Color::from_rgb(0xFF, 0xFF, 0xFF) : Color::from_rgb(0x0, 0x0, 0x0);
for(uint16_t shift = 1 << 15; shift; shift = shift >> BitsPerRound) {
uint8_t lu_ids[BitsPerRound];
for(size_t n = 0; n < BitsPerRound; n++) {
lu_ids[n] = (bit_pattern & (shift >> n)) ? 1 : 0;
}
this->pixel[px_idx++] = LookUpColor4::create(lu_ids);
}
}
static PositionU16 vram_offset(uint16_t tile_id) {
return tile_id_for16<PositionU16>(tile_id);
return tile_id_for16<PositionU16>(tile_id, SizeU16::create(4, 16));
}
};
@@ -47,7 +55,7 @@ namespace JabyEngine {
void setup() {
for(auto& letter : this->letter_buffer) {
letter->setup(SizeU16::create(16, 16));
letter->setup(SizeU16::create(16/4, 16));
letter.set_link_identitiy();
}
this->free_idx = 0;

View File

@@ -32,7 +32,7 @@ namespace JabyEngine {
const CLUT clut {
.cmd = CPU2VRAM::create(AreaU16::create(dst_cord, GPU::SizeU16::create(16, 1))),
.data = {
Color::Grey(), Color::White(),
Color::Black(), Color::Grey(),
Color::Black(), Color::Black(), Color::Black(), Color::Black(), Color::Black(), Color::Black(), Color::Black(),
Color::Black(), Color::Black(), Color::Black(), Color::Black(), Color::Black(), Color::Black(), Color::Black(),
}
@@ -92,14 +92,6 @@ namespace JabyEngine {
}
void setup() {
asm("# Planschi1");
auto value = LookUpColor4::from_id(0xA, 0xB, 0xC, 0xF);
for(size_t n = 0; n < 4; n++) {
printf(">>> %i\n", value.get_lu_id(n));
}
asm("# Planschi2");
GPU_IO::GP1.write(GPU_IO::Command::Reset());
configurate_display();
::JabyEngine::GPU::internal::Display::exchange_buffer_and_display();