From 05fd4b44e561c22645599be72196b4b0d5a1e8b8 Mon Sep 17 00:00:00 2001 From: Jaby Date: Fri, 15 Dec 2023 23:00:53 -0500 Subject: [PATCH] Prepare font transfer --- src/Library/src/BootLoader/gpu_boot.cpp | 66 ++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/src/Library/src/BootLoader/gpu_boot.cpp b/src/Library/src/BootLoader/gpu_boot.cpp index e0215836..65250187 100644 --- a/src/Library/src/BootLoader/gpu_boot.cpp +++ b/src/Library/src/BootLoader/gpu_boot.cpp @@ -12,6 +12,19 @@ #include "splash_image_ntsc_boot.hpp" #endif //JABYENGINE_PAL +// | ! | " | # | $ | % | & | ' | ( | ) | * | + | , | - | . | / | 0 | +// | 8149 | 8168 | 8194 | 8190 | 8193 | 8195 | 8166 | 8169 | 816A | 8196 | 817B | 8143 | 817C | 8144 | 815E | 8250 | +// | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? | @ | +// | 8251 | 8252 | 8253 | 8254 | 8255 | 8256 | 8257 | 8258 | 8259 | 8146 | 8147 | 8183 | 8181 | 8184 | 8148 | 8197 | +// | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | +// | 8260 | 8261 | 8262 | 8263 | 8264 | 8265 | 8266 | 8267 | 8268 | 8269 | 826A | 826B | 826C | 826D | 826E | 826F | +// | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ | ` | +// | 8270 | 8271 | 8272 | 8273 | 8274 | 8275 | 8276 | 8277 | 8278 | 8279 | 816D | 815F | 816E | 814F | 8151 | 814D | +// | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | +// | 8281 | 8282 | 8283 | 8284 | 8285 | 8286 | 8287 | 8288 | 8289 | 828A | 828B | 828C | 828D | 828E | 828F | 8290 | +// | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | | | +// | 8291 | 8292 | 8293 | 8294 | 8295 | 8296 | 8297 | 8298 | 8299 | 829A | 816F | 8162 | 8170 | 8160 | | | + extern "C" uint32_t __boot_loader_end; namespace JabyEngine { @@ -25,8 +38,57 @@ namespace JabyEngine { namespace GPU { using namespace JabyEngine::GPU; + namespace SJIS { + struct SpecialChar { + uint8_t base_offset; + uint8_t tile_id; + }; + + struct RangeChar { + SpecialChar start_char; + uint8_t length; + }; + + // base: 0x8100 + static const SpecialChar Specials[] = { // ToDo: Can we split this into 4 arrays? Would that help somehow? + // { ! } { " } { # } { $ } { % } { & } { ' } { ( } { ) } { * } { + } { , } { - } { . } { / } + {0x49, 0}, {0x68, 1}, {0x94, 2}, {0x90, 3}, {0x93, 4}, {0x95, 5}, {0x66, 6}, {0x69, 7}, {0x6A, 8}, {0x96, 9}, {0x7B, 10}, {0x43, 11}, {0x7C, 12}, {0x44, 13}, {0x5E, 14}, + // { : } { ; } { < } { = } { > } { ? } { @ } + {0x46, 25}, {0x47, 26}, {0x83, 27}, {0x81, 28}, {0x84, 29}, {0x48, 30}, {0x97, 31}, + // { [ } { \ } { ] } { ^ } { _ } { ` } + {0x6D, 58}, {0x5F, 59}, {0x6E, 60}, {0x4F, 61}, {0x51, 62}, {0x4D, 63}, + // { { } { | } { } } { ~ } + {0x6F, 90}, {0x62, 91}, {0x70, 92}, {0x60, 93} + }; + + // 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}; + + void load() { + alignas(uint32_t) Color test[16*16]; + + for(auto& color : test) { + color = Color::from_rgb(0, 0xFF, 0xFF); + } + + GPU::internal::DMA::Receive::prepare(); + GPU::internal::DMA::Receive::set_dst(PositionU16::create(0, 0), SizeU16::create(16, 16)); + GPU::internal::DMA::Receive::set_src(reinterpret_cast(test)); + printf("Sending...\n"); + GPU::internal::DMA::Receive::start(sizeof(test)/4/16); + GPU::internal::DMA::wait(); + GPU::internal::DMA::end(); + printf("Done!\n"); + } + } + static void configurate_display() { - // Ideal I hope that an offset of 0,0 will produce a well enough centered picture for every TV + // Ideal I hope that an offset of 0,0 will produce a well enough centered picture for every TV for now GPU_IO::GP1.write(GPU_IO::Command::DisplayMode(::JabyEngine::GPU::internal::Display::DisplayMode)); GPU::Display::set_offset(0, 0); } @@ -59,6 +121,8 @@ namespace JabyEngine { auto state = FileProcessor::create(&__boot_loader_end, SimpleTIM(32, 0, 0, 0)); state.process(bytes_ready); + SJIS::load(); + // 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));