#include #include #include "debug.hpp" extern "C" { #include "boxed_dot.h" } const struct { size_t w = 240; size_t h = 160; } mode3; const struct { size_t w = 32; size_t h = 32; } boxed_dot; int main(void) { debug::open(); // Mode 3-5 are bitmap modes. // 3: 240x160 @ 16bpp N page-flip // 4: 240x160 @ 8bpp Y page-flip // 5: 160x128 @ 16bpp Y page-flip // // BG2 is the only available background in bitmap modes. REG_DISPCNT = DCNT_MODE3 | DCNT_BG2; debug::puts("Hello World!"); // Write gradient from black -> RGB in first three lines. // Each color is displayed on a separate line. // for (size_t i = 0; i < 32; ++i) { // vid_mem[i] = i; // vid_mem[mode3.w + i] = i << 5; // vid_mem[2 * mode3.w + i] = i << 10; // } // Write bitmap image into bitmap, displayed in top left corner. // Image is 16bpp, stored as uint16_t. for (size_t y = 0; y < boxed_dot.h; ++y) { for (size_t x = 0; x < boxed_dot.w; ++x) { vid_mem[y * mode3.w + x] = boxed_dotBitmap[y * boxed_dot.w + x]; } } while (true) { // Busy-loop VSync, should be replaced with an interrupt. vid_vsync(); } debug::close(); return 0; }