include "../include/microw8-api.cwa" global mut mode: i32 = 0; export fn upd() { cls(0); if isButtonTriggered(BUTTON_A) { mode = !mode; } setTextColor(15); printString(mode * USER_MEM); let y: i32; loop y { line(0 as f32, (y * 9 + 39) as f32, (14+16*9) as f32, (y * 9 + 39) as f32, 1); line((y * 9 + 15) as f32, 24 as f32, (y * 9 + 15) as f32, (38+16*9) as f32, 1); setTextColor(15); setCursorPosition(y * 9 + 16, 24); let lazy hexChar = select(y < 10, y + 48, y + 87); printChar(hexChar); setCursorPosition(0, y * 9 + 24+16); printChar(hexChar); let x = 0; loop x { setCursorPosition(x * 9 + 16, y * 9 + 24+16); setTextColor(select(mode, x + y * 16, -9)); if y >= 2 | mode { printChar(select(mode, 0xa4, x + y * 16)); } branch_if (x := x + 1) < 16: x; } branch_if (y := y + 1) < 16: y; } } data 0 { "Default font: (press " i8(0xcc) " for palette)" i8(5, 0) } data USER_MEM { "Default palette: (press " i8(0xcc) " for font)" i8(5, 0) }