// SPDX-License-Identifier: MIT // Mode 4, frame 1 shown: colour 0 is transparent and lets an OBJ behind the bitmap and the // backdrop show (GBATEK §LCD VRAM Bitmap BG Modes). #include "scene.h" int main(void) { DISPCNT = 0x0080; palette_fill(0, 256, 4); PAL16[0] = rgb(0, 20, 0); volatile u16 *f0 = VRAM16, *f1 = VRAM16 + 0x5000; for (int i = 0; i < 120 * 160; i++) { int x = (i % 120) * 2, y = i / 120; f0[i] = 0x0101; int a = ((x / 6) ^ (y / 6)) & 1 ? 0 : (x + y) & 255; int b = (((x + 1) / 6) ^ (y / 6)) & 1 ? 0 : (x + 1 + y) & 255; f1[i] = a | b << 8; } palette_fill(256, 256, 2); for (int t = 0; t < 64; t++) tile8(0x14000 + t * 64, t); obj_clear(); obj_set(0, 40 | 0x2000, 60 | 3 << 14, 512 | 3 << 10); BGCNT(2) = 1; BGPA(2) = 0x100; BGPD(2) = 0x100; DISPCNT = 0x0004 | 0x0010 | 0x0400 | 0x1000 | 0x0040; forever(); }