Test load ABCD
This commit is contained in:
parent
5408b3e94e
commit
f15b34f8b5
|
@ -39,6 +39,36 @@ namespace JabyEngine {
|
||||||
using namespace JabyEngine::GPU;
|
using namespace JabyEngine::GPU;
|
||||||
|
|
||||||
namespace SJIS {
|
namespace SJIS {
|
||||||
|
struct FontBuffer {
|
||||||
|
static constexpr auto FontSize = SizeU16::create(16, 16);
|
||||||
|
static constexpr auto AmountOfChars = 4;
|
||||||
|
|
||||||
|
struct Line {
|
||||||
|
Color pixel[FontSize.width];
|
||||||
|
|
||||||
|
void load(uint16_t bit_pattern) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Row {
|
||||||
|
Line character[AmountOfChars];
|
||||||
|
};
|
||||||
|
|
||||||
|
Row rows[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];
|
||||||
|
|
||||||
|
cur_line.load(__builtin_bswap16(*bit_map++));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct SpecialChar {
|
struct SpecialChar {
|
||||||
uint8_t base_offset;
|
uint8_t base_offset;
|
||||||
uint8_t tile_id;
|
uint8_t tile_id;
|
||||||
|
@ -70,17 +100,17 @@ namespace JabyEngine {
|
||||||
static const auto LowerCaseLetter = RangeChar{{0x81, 64}, 26};
|
static const auto LowerCaseLetter = RangeChar{{0x81, 64}, 26};
|
||||||
|
|
||||||
void load() {
|
void load() {
|
||||||
alignas(uint32_t) Color test[16*16];
|
FontBuffer buffer;
|
||||||
|
|
||||||
for(auto& color : test) {
|
for(size_t n = 0; n < 4; n++) {
|
||||||
color = Color::from_rgb(0, 0xFF, 0xFF);
|
buffer.load_char(n, SysCall::Krom2RawAdd(0x8200 | (UpperCaseLetter.start_char.base_offset + n)));
|
||||||
}
|
}
|
||||||
|
|
||||||
GPU::internal::DMA::Receive::prepare();
|
GPU::internal::DMA::Receive::prepare();
|
||||||
GPU::internal::DMA::Receive::set_dst(PositionU16::create(0, 0), SizeU16::create(16, 16));
|
GPU::internal::DMA::Receive::set_dst(PositionU16::create(0, 0), SizeU16::create(16*4, 16));
|
||||||
GPU::internal::DMA::Receive::set_src(reinterpret_cast<const uintptr_t>(test));
|
GPU::internal::DMA::Receive::set_src(reinterpret_cast<const uintptr_t>(&buffer.rows));
|
||||||
printf("Sending...\n");
|
printf("Sending...\n");
|
||||||
GPU::internal::DMA::Receive::start(sizeof(test)/4/16);
|
GPU::internal::DMA::Receive::start(sizeof(buffer)/4/16);
|
||||||
GPU::internal::DMA::wait();
|
GPU::internal::DMA::wait();
|
||||||
GPU::internal::DMA::end();
|
GPU::internal::DMA::end();
|
||||||
printf("Done!\n");
|
printf("Done!\n");
|
||||||
|
|
Loading…
Reference in New Issue