Load BIOS font

This commit is contained in:
2023-12-18 16:12:13 -05:00
parent 3996680e7e
commit 6568bfcd7d
2 changed files with 65 additions and 17 deletions

View File

@@ -131,23 +131,42 @@ namespace JabyEngine {
};
// base: 0x8200
// { 0 - 9 }
static const auto Numbers = RangeChar{{0x50, 15}, 10};
// { A - Z }
static const auto UpperCaseLetter = RangeChar{{0x60, 32}, 26};
// { a - z }
static const auto LowerCaseLetter = RangeChar{{0x81, 64}, 26};
static const RangeChar AlphaNumeric[] = {
// { 0 - 9 }
{{0x50, 15}, 10},
// { A - Z }
{{0x60, 32}, 26},
// { a - z }
{{0x81, 64}, 26}
};
void load(const PositionU16& start_pos) {
static const auto get_dst_pos = [](const PositionU16& pos, uint16_t tile_id) {
return pos.add(tile_id_for16<PositionU16>(tile_id));
};
void load() {
// Linkd create here
FontBuffer font_buffer;
const auto load_special_chars = [&font_buffer]<size_t Size>(const PositionU16& pos, const SpecialChar(&special_chars)[Size]) {
for(const auto& special_char : special_chars) {
font_buffer.load_to(get_dst_pos(pos, special_char.tile_id), SysCall::Krom2RawAdd(0x8100 | special_char.base_offset));
}
};
const auto load_alpha_num = [&font_buffer]<size_t Size>(const PositionU16& pos, const RangeChar(&range_char)[Size]) {
for(const auto& range : range_char) {
const auto end_tile = range.start_char.tile_id + range.length;
auto sjis_code = 0x8200 | range.start_char.base_offset;
for(uint16_t tile_id = range.start_char.tile_id; tile_id < end_tile; tile_id++,sjis_code++) {
font_buffer.load_to(get_dst_pos(pos, tile_id), SysCall::Krom2RawAdd(sjis_code));
}
}
};
font_buffer.setup();
GPU::internal::DMA::Receive::prepare();
for(size_t n = 0; n < 5; n++) {
font_buffer.load_to(PositionU16::create(16*n, 0), SysCall::Krom2RawAdd(0x8200 | (UpperCaseLetter.start_char.base_offset + n)));
}
load_special_chars(start_pos, Specials);
load_alpha_num(start_pos, AlphaNumeric);
font_buffer.flush();
}
}
@@ -186,7 +205,7 @@ namespace JabyEngine {
auto state = FileProcessor::create(&__boot_loader_end, SimpleTIM(32, 0, 0, 0));
state.process(bytes_ready);
SJIS::load();
SJIS::load(PositionU16::create(0, 0));
// Duplicate DisplayBuffer content
::JabyEngine::GPU::internal::copy_vram_to_vram({PositionU16::create(0, Display::Height), SizeU16::create(Display::Width, Display::Height)}, PositionU16::create(0, 0));