From 9d2b8d902da4c3b61d4cb2eef3b7479de9674bc1 Mon Sep 17 00:00:00 2001 From: Jaby Blubb Date: Sat, 16 Dec 2023 23:31:09 +0100 Subject: [PATCH] Send char by char --- src/Library/src/BootLoader/gpu_boot.cpp | 35 +++++++++++-------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/Library/src/BootLoader/gpu_boot.cpp b/src/Library/src/BootLoader/gpu_boot.cpp index 4b1842fd..cca4a3de 100644 --- a/src/Library/src/BootLoader/gpu_boot.cpp +++ b/src/Library/src/BootLoader/gpu_boot.cpp @@ -54,16 +54,10 @@ namespace JabyEngine { } }; - struct Row { - Line character[AmountOfChars]; - }; - - Row rows[FontSize.height]; + Line lines[FontSize.height]; - void load_char(int32_t chr_idx, const uint16_t* bit_map) { - for(auto& cur_row : this->rows) { - auto& cur_line = cur_row.character[chr_idx]; - + void load_char(const uint16_t* bit_map) { + for(auto& cur_line : this->lines) { cur_line.load(__builtin_bswap16(*bit_map++)); } } @@ -100,20 +94,23 @@ namespace JabyEngine { static const auto LowerCaseLetter = RangeChar{{0x81, 64}, 26}; void load() { - FontBuffer buffer; - - for(size_t n = 0; n < 4; n++) { - buffer.load_char(n, SysCall::Krom2RawAdd(0x8200 | (UpperCaseLetter.start_char.base_offset + n))); - } + FontBuffer buffer[2]; GPU::internal::DMA::Receive::prepare(); - GPU::internal::DMA::Receive::set_dst(PositionU16::create(0, 0), SizeU16::create(16*4, 16)); - GPU::internal::DMA::Receive::set_src(reinterpret_cast(&buffer.rows)); - printf("Sending...\n"); - GPU::internal::DMA::Receive::start(sizeof(buffer)/4/16); + for(size_t n = 0; n < 4; n++) { + auto& cur_buffer = buffer[n&0x1]; + const auto vram_pos = PositionU16::create(16*n, 0); + + cur_buffer.load_char(SysCall::Krom2RawAdd(0x8200 | (UpperCaseLetter.start_char.base_offset + n))); + + GPU::internal::DMA::wait(); + GPU::internal::DMA::Receive::set_dst(vram_pos, SizeU16::create(16, 16)); + GPU::internal::DMA::Receive::set_src(reinterpret_cast(&cur_buffer.lines)); + GPU::internal::DMA::Receive::start(sizeof(FontBuffer)/4/16); + } + GPU::internal::DMA::wait(); GPU::internal::DMA::end(); - printf("Done!\n"); } }