code wiki / (root) / nx_dungeon_native.nx

nx_dungeon_native.nx

buildroot/runtime/nx_dungeon_native.nx

13997 B442 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_dungeon_native.nx -- PLAYABLE native terminal dungeon-crawler ALPHA. Built by Nishi's OWN toolchain to a NATIVE binary (nx_cc -> nxasm_x86, no gcc, no WebAssembly, no browser, no borrowed VM). Runs natively on the x86 host; the only OS surface used is the Nishi syscall layer (write/read/ioctl/mmap). The interactive surface is the TERMINAL (ANSI truecolor render to stdout + single-key input from stdin via termios raw mode) -- the most portable display/input, so the SAME engine retargets a framebuffer/UART driver on the operator's own hardware later ("hardware up = prep to run on mine"). HONEST AUTHORSHIP (operator law: don't pass tutor work off as team work): - The COMBAT state machine g_dungenc_step is the TEAM's emitter-authored FSM: the exact transition table nx_auto_builder emitted into _pe_dungenc.nx from the data-only spec build_dungenc.spec. The game runs the Nishi-authored game system. - World gen, terminal render, input loop = TUTOR-authored (Claude) game code. NOT emitter output. The named rung to make the WHOLE game emitter-authored from a spec is X-GAME-GEN-001. This alpha is the playable proof, not that claim. LAWS honored: <=6 args/func, flat ifs, no &&/||, integer-only, additive, <21 same-fn call sites per function (nxasm rc=6 landmine). license_tier: ORIGINAL (combat FSM lineage: _pe_dungenc, emitter-authored)

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_dungeon_native.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap term_raw_on sys_ioctl gi_init g_build_level g_cell_set g_rng g_place g_rng ↻ g_cell_get g_cell_set ↻ sys_now_ms sys_mmap ↻ sys_clock_gettime_mono render sys_mmap ↻ bput_clear bputc bput render_hud bput ↻ bputn bputc ↻ sys_mmap ↻ bputc ↻ render_combat bputc ↻ bput ↻ render_bar bputc ↻ bput_fg bputc ↻ bput ↻ bputn ↻ bput_reset bputc ↻ bput ↻ bputn ↻ render_grid

structs

none

consts

23const K_MAGIC_1103515245: i64 = 1103515245
24const K_MAGIC_12345: i64 = 12345
25const K_MAGIC_32767: i64 = 32767
26const K_MAGIC_4096: i64 = 4096
27const K_MAGIC_16384: i64 = 16384

functions

33func g_rng(st: *i64) -> i64
40func g_cell_get(st: *i64, x: i64, y: i64) -> i64
49func g_cell_set(st: *i64, x: i64, y: i64, v: i64) -> i64
55func g_place(st: *i64, kind: i64, n: i64) -> i64
74func g_build_level(st: *i64) -> i64
115func g_dungenc_step(s: i64, e: i64) -> i64
126func gi_init(st: *i64, seed: i64) -> i64
called by 2: gi_inputmain calls 1: g_build_level
139func gi_next(st: *i64) -> i64
called by 1: gi_input calls 1: g_build_level
148func g_try_move(st: *i64, dx: i64, dy: i64) -> i64
169func g_attack(st: *i64) -> i64
196func g_flee(st: *i64) -> i64
called by 1: gi_input calls 1: g_dungenc_step
207func gi_input(st: *i64, key: i64) -> i64
234func bputc(buf: *u8, off: *i64, c: i64) -> i64
239func bput(buf: *u8, off: *i64, s: *u8) -> i64
248func bputn(buf: *u8, off: *i64, v: i64) -> i64
259func bput_bg(buf: *u8, off: *i64, r: i64, g: i64, b: i64) -> i64
called by 1: draw_cell calls 3: bputcbputbputn
267func bput_fg(buf: *u8, off: *i64, r: i64, g: i64, b: i64) -> i64
called by 2: draw_cellrender_bar calls 3: bputcbputbputn
275func bput_reset(buf: *u8, off: *i64) -> i64
278func bput_clear(buf: *u8, off: *i64) -> i64
called by 2: rendermain calls 2: bputcbput
285func draw_cell(buf: *u8, off: *i64, d: i64) -> i64
297func render_hud(buf: *u8, off: *i64, st: *i64) -> i64
called by 1: render calls 3: bputbputnbputc
306func render_grid(buf: *u8, off: *i64, st: *i64) -> i64
330func render_bar(buf: *u8, off: *i64, val: i64, max: i64, r: i64, g: i64) -> i64
346func render_combat(buf: *u8, off: *i64, st: *i64) -> i64
called by 1: render calls 3: bputcbputrender_bar
358func render_foot(buf: *u8, off: *i64, st: *i64) -> i64
called by 1: render calls 2: bputcbput
369func render(buf: *u8, st: *i64) -> i64
380func map_key(c: i64) -> i64
called by 1: main
394func term_raw_on(orig: *u8, raw: *u8) -> i64
called by 1: main calls 1: sys_ioctl
408func term_raw_off(orig: *u8) -> i64
called by 1: main calls 1: sys_ioctl
413func main() -> i64