code wiki / _hdl_build / nx_wasm_emit2.nx
nx_wasm_emit2.nx
buildroot/runtime/_hdl_build/nx_wasm_emit2.nx
about
nx_wasm_emit2.nx -- G-WASM-001 milestone 2: emit a REAL function module byte-by-byte
(memory section + param + local + local.get/set + i64.const + i64.add + multi-export),
the encoding actual game code needs. Reuses leb128.nx. Verified byte-exact vs WABT used
ONCE as an alignment oracle, then WABT leaves the path. NO node/python/WABT in this organ.
Target module:
(module (memory (export "memory") 1)
(func (export "f") (param i64) (result i64) (local i64)
local.get 0 i64.const 5 i64.add local.set 1 local.get 1))
license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: leb128.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 12 | const K_MAGIC_1024: i64 = 1024 |
functions
| 14 | func w8(b: *u8, p: i64, v: i64) -> i64 { b[p] = v as u8; return p + 1 } |
| 15 | func wcopy(dst: *u8, dp: i64, src: *u8, n: i64) -> i64 |
| 20 | func emit_section(out: *u8, p: i64, id: i64, sc: *u8, sclen: i64) -> i64 |
| 27 | func main() -> i64 |