nx_dungeon_native.nx
buildroot/runtime/nx_dungeon_native.nx
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
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
structs
| none |
consts
| 23 | const K_MAGIC_1103515245: i64 = 1103515245 |
| 24 | const K_MAGIC_12345: i64 = 12345 |
| 25 | const K_MAGIC_32767: i64 = 32767 |
| 26 | const K_MAGIC_4096: i64 = 4096 |
| 27 | const K_MAGIC_16384: i64 = 16384 |
functions
| 33 | func g_rng(st: *i64) -> i64 |
| 40 | func g_cell_get(st: *i64, x: i64, y: i64) -> i64 |
| 49 | func g_cell_set(st: *i64, x: i64, y: i64, v: i64) -> i64 |
| 55 | func g_place(st: *i64, kind: i64, n: i64) -> i64 |
| 74 | func g_build_level(st: *i64) -> i64 |
| 115 | func g_dungenc_step(s: i64, e: i64) -> i64 |
| 126 | func gi_init(st: *i64, seed: i64) -> i64 |
| 139 | func gi_next(st: *i64) -> i64 |
| 148 | func g_try_move(st: *i64, dx: i64, dy: i64) -> i64 |
| 169 | func g_attack(st: *i64) -> i64 |
| 196 | func g_flee(st: *i64) -> i64 |
| 207 | func gi_input(st: *i64, key: i64) -> i64 |
| 234 | func bputc(buf: *u8, off: *i64, c: i64) -> i64 |
| 239 | func bput(buf: *u8, off: *i64, s: *u8) -> i64 |
| 248 | func bputn(buf: *u8, off: *i64, v: i64) -> i64 |
| 259 | func bput_bg(buf: *u8, off: *i64, r: i64, g: i64, b: i64) -> i64 |
| 267 | func bput_fg(buf: *u8, off: *i64, r: i64, g: i64, b: i64) -> i64 |
| 275 | func bput_reset(buf: *u8, off: *i64) -> i64 |
| 278 | func bput_clear(buf: *u8, off: *i64) -> i64 |
| 285 | func draw_cell(buf: *u8, off: *i64, d: i64) -> i64 |
| 297 | func render_hud(buf: *u8, off: *i64, st: *i64) -> i64 |
| 306 | func render_grid(buf: *u8, off: *i64, st: *i64) -> i64 |
| 330 | func render_bar(buf: *u8, off: *i64, val: i64, max: i64, r: i64, g: i64) -> i64 |
| 346 | func render_combat(buf: *u8, off: *i64, st: *i64) -> i64 |
| 358 | func render_foot(buf: *u8, off: *i64, st: *i64) -> i64 |
| 369 | func render(buf: *u8, st: *i64) -> i64 |
| 380 | func map_key(c: i64) -> i64 called by 1: main |
| 394 | func term_raw_on(orig: *u8, raw: *u8) -> i64 |
| 408 | func term_raw_off(orig: *u8) -> i64 |
| 413 | func main() -> i64 |