nx_wasm_arcade.nx
buildroot/runtime/nx_wasm_arcade.nx
about
nx_wasm_arcade.nx -- the CORRECTED sovereign browser game: BASE-RELATIVE integer arcade. The SAME code
runs native (base = a real mmap -> render a frame to PNG for eyeball verify) AND in the browser (base = 0
= our own sovereign WASM linear memory). NO float, NO JS logic, NO 3rd-party canvas drawing. Game logic
(move/collect) + integer rasterizer write a packed-RGB framebuffer at a FIXED linear-mem offset; the blit
shim only copies that framebuffer to the screen + forwards keys. nx_wasm.nx auto-exports every func +
the linear memory, so init()/tick(dir)/render()/ww()/hh()/fb_off() become the wasm interface. The HUD
score is drawn into our OWN framebuffer by the sovereign Nishi font (no JS/canvas draws text). license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_nishi_font_core.nx
imported by: nx_arcade_hud_gate.nxnx_wasm_arcade_gate.nx
structs
| none |
consts
| 9 | const W: i64 = 240 |
| 10 | const H: i64 = 192 |
| 11 | const CELL: i64 = 24 |
| 12 | const GW: i64 = 10 |
| 13 | const GH: i64 = 8 |
| 14 | const O_FB: i64 = 0 // framebuffer: W*H i64 (packed RGB), at linear-mem offset 0 |
| 15 | const O_GX: i64 = 368640 // W*H*8 |
| 16 | const O_GY: i64 = 368768 |
| 17 | const O_HX: i64 = 368896 |
| 18 | const O_HY: i64 = 369024 |
| 19 | const O_ST: i64 = 369152 // scalars: [0]=px [1]=py [2]=score [3]=ng [4]=nh |
| 20 | const O_MSK: i64 = 376832 // HUD glyph scratch mask (base-relative; no sys_mmap -> works in wasm) |
| 21 | const O_STR: i64 = 385024 // HUD score string scratch (decimal digits + reversal temp) |
functions
| 23 | func rgb(r: i64, g: i64, b: i64) -> i64 { return (r & 255) | ((g & 255) << 8) | ((b & 255) << 16) } |
| 25 | func fillr(base: i64, x0: i64, y0: i64, x1: i64, y1: i64, c: i64) -> i64 called by 1: render_impl |
| 38 | func init_impl(base: i64) -> i64 |
| 50 | func tick_impl(base: i64, dir: i64) -> i64 |
| 72 | func render_impl(base: i64) -> i64 |
| 114 | func init() -> i64 { return init_impl(0) } calls 1: init_impl |
| 115 | func tick(dir: i64) -> i64 { return tick_impl(0, dir) } calls 1: tick_impl |
| 116 | func render() -> i64 { return render_impl(0) } calls 1: render_impl |
| 117 | func score() -> i64 { let st: *i64 = (0 + O_ST) as *i64; return st[2] } |
| 118 | func fb_off() -> i64 { return O_FB } |
| 119 | func ww() -> i64 { return W } |
| 120 | func hh() -> i64 { return H } |