// SPDX-License-Identifier: MIT // Mosaic: a text BG (H 4, V 3) beside an unmosaicked one, an affine BG2 in mode 1, and // mosaicked OBJs, normal and affine (OBJ H 3, V 5), next to plain ones. #include "scene.h" int main(void) { DISPCNT = 0x0080; palette_fill(0, 256, 13); palette_fill(256, 256, 2); for (int t = 0; t < 32; t++) tile4(t * 32, t); for (int t = 0; t < 64; t++) tile8(0x8000 + t * 64, t); map_text(16, 1, 32, 3); map_text(17, 1, 32, 3); volatile u16 *m = VRAM16 + 20 * 0x400; for (int i = 0; i < 512; i++) m[i] = ((i * 3) % 64) | (((i * 3 + 9) % 64) << 8); BGCNT(0) = 0x40 | 16 << 8 | 1; BGCNT(1) = 17 << 8 | 3; BGCNT(2) = 0x2040 | 2 << 2 | 20 << 8 | 1 << 14 | 2; BGHOFS(0) = 3; BGVOFS(0) = 2; BGPA(2) = 200; BGPB(2) = 60; BGPC(2) = -60; BGPD(2) = 200; BGX(2) = 7 << 8; BGY(2) = 3 << 8; for (int t = 0; t < 256; t++) tile4(0x10000 + t * 32, t * 3); obj_clear(); obj_affine(0, 200, 50, -50, 200); obj_set(0, 13 | 0x1000, 21 | 2 << 14, 0); obj_set(1, 13, 61 | 2 << 14, 0); obj_set(2, 70 | 0x1000 | 0x0100 | 0x0200, 30 | 0 << 9 | 2 << 14, 32); obj_set(3, 70 | 0x0100 | 0x0200, 120 | 0 << 9 | 2 << 14, 32); obj_set(4, 50 | 0x1000 | 1 << 14, 170 | 2 << 14, 64); MOSAIC = 3 | 2 << 4 | 2 << 8 | 4 << 12; PAL16[0] = rgb(0, 0, 0); DISPCNT = 0x0001 | 0x0700 | 0x1000 | 0x0040; forever(); }