nx_nishios_kbd.nx
buildroot/runtime/nx_nishios_kbd.nx
about
nx_nishios_kbd.nx -- NishiOS GUI rung-5: LIVE KEYBOARD INPUT + a real shell line editor.
Turns the terminal from a `cat` into something you TYPE into. Models the PS/2 keyboard path a kernel
actually walks: read scancodes from the controller (port 0x60), translate set-1 make codes -> ASCII
via a keymap, handle BACKSPACE line-editing, echo, and on ENTER dispatch a shell builtin. The demo
types 'v','e','e',<backspace>,'r',<enter> -> the line editor yields "ver" (the stray 'e' erased), the
shell runs it -> "NishiOS 0.1 sovereign", and the terminal renders prompt+command+output.
KAT: the line editor produced "ver" (backspace worked), the shell dispatched the right output, both the
command line and the output render, and the BMP exports.
HONEST SEAM: the scancode SOURCE is scripted (no live PS/2 controller modeled on the emu -- that IRQ1
wiring is the hardware rung); the driver LOGIC (port read, set-1 keymap, line edit, echo, dispatch) is
real. No hw writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_fb.nxnx_itoa_lib.nxnx_font8x8.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
| 15 | const K_MAGIC_192054: i64 = 192054 |
functions
| 17 | func kb_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } called by 1: main |
| 22 | func kb_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 23 | func kb_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: kb_streq |
| 24 | func kb_streq(a: *u8, alen: i64, b: *u8) -> i64 { let bl: i64=kb_slen(b); if alen!=bl { return 0 } var i: i64=0; while i<alen { if a[i]!=b[i] { return 0 } i=i+1 } return 1 } |
| 25 | func kb_scopy(dst: *u8, doff: i64, src: *u8) -> i64 { var i: i64=0; while src[i]!=(0 as u8) { dst[doff+i]=src[i]; i=i+1 } return doff+i } called by 1: run_cmd |
| 28 | func kt_char(fb: *u8, W: i64, H: i64, table: *u8, x: i64, y: i64, ch: i64, r: i64, g: i64, b: i64) -> i64 |
| 36 | func kt_str(fb: *u8, W: i64, H: i64, table: *u8, x: i64, y: i64, s: *u8, r: i64, g: i64, b: i64) -> i64 |
| 41 | func kt_count(fb: *u8, W: i64, x0: i64, y0: i64, x1: i64, y1: i64) -> i64 called by 1: main |
| 48 | func build_keymap(km: *u8) -> i64 called by 1: main |
| 59 | func run_cmd(line: *u8, linelen: i64, out: *u8) -> i64 |
| 70 | func main() -> i64 |