extern unsigned int _binary_DSC09311_256_data_pal_start; extern unsigned int _binary_DSC09311_256_data_pal_end; extern unsigned int _binary_DSC09311_256_data_pal_size; extern unsigned int _binary_DSC09311_256_data_start; extern unsigned int _binary_DSC09311_256_data_end; extern unsigned int _binary_DSC09311_256_data_size; #include "io_reg.h" #include "vram.h" #include "register_values.h" #include "copy.h" #include "nib.h" #include "type.h" #include "oam.h" void _start(void) { int height = 240; int width = 160; u8 * pal = (u8*)&_binary_DSC09311_256_data_pal_start; u16 * _pram = (u16 *)&pram.bg[0][0]; for (int color = 0; color < 256; color++) { int r = pal[color * 3 + 0] >> 3; int g = pal[color * 3 + 1] >> 3; int b = pal[color * 3 + 2] >> 3; _pram[color] = PRAM_RGB15(r, g, b); } u32 _vram; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { u8 index = ((u8 *)(&_binary_DSC09311_256_data_start))[y * width + x]; switch (x & 0x3) { case 0: _vram = index; break; case 1: _vram |= index << 8; break; case 2: _vram |= index << 16; break; case 3: _vram |= index << 24; *((u32 *)(0x6000000 + (y * width + x))) = _vram; break; } } } while ((io_reg.VCOUNT & 0xff) < 161); io_reg.DISPCNT = ( DISPCNT__BG2 | DISPCNT__BG_MODE_4 | DISPCNT__FRAMEBUFFER(0) ); while (1) { io_reg.HALTCNT = 0; }; }