code wiki / (root) / nx_nishios_fb_x86.nx

nx_nishios_fb_x86.nx

buildroot/runtime/nx_nishios_fb_x86.nx

10125 B128 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tooltopic nishios
docsdependenciesstructsconstsfunctions

about

nx_nishios_fb_x86.nx -- NishiOS GUI rung-7: the kernel draws the framebuffer with REAL x86 EXECUTION. Closes the seam I kept flagging: until now the desktop was drawn by nx_fb (a NishiLang driver) called AFTER boot. Here the booted kernel's draw is REAL x86 INSTRUCTIONS executed on the sovereign emu: an authored fill loop (mov-imm / store [rax],rcx / add / cmp / jne / syscall) writes a computed value into every framebuffer word. The emu runs it; afterward we read the framebuffer straight out of the emu's memory -- the pixels were written by x86 the CPU model executed, not by a NishiLang call. Then export to BMP via nx_fb (now ONLY the encoder, not the renderer). KAT: the framebuffer holds EXACTLY what the x86 loop computed (mem[fb+8*w] low byte == w&0xFF) at the start, middle and END of the loop (proving it ran to completion), clean exit, BMP exported. HONEST SCOPE: the loop fills a computed ramp (proves per-pixel x86 writes); richer desktop chrome drawn purely in x86 (rects/text via x86) is the continuation. No hw writes (Rule 26). expect_exit: 0 tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_fb.nx nx_itoa_lib.nx nx_nishios_fb_x86.nx

imports: nx_fb.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

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

main fx_puts fx_b fx_i32 ek_emu ek_i32 ek_st64 ek_ld64 fx_num nxi_out nxi_fd sys_mmap ccz_cat_num sys_write sys_munmap fb_bmp_save sys_mmap ↻ fb_p32 fb_p16 sys_openat_wr sys_write ↻ sys_close sys_openat_wr ↻

structs

none

consts

14const K_MAGIC_4096: i64 = 4096
15const K_MAGIC_18432: i64 = 18432
16const K_MAGIC_2304: i64 = 2304
17const K_MAGIC_32768: i64 = 32768

functions

21func ek_i32(code: *u8, off: i64) -> i64 { var v: i64=(code[off] as i64)|((code[off+1] as i64)<<8)|((code[off+2] as i64)<<16)|((code[off+3] as i64)<<24); if (v & 0x80000000)!=0 { v=v-(1<<32) } return v }
called by 1: ek_emu
22func ek_st64(mem: *u8, addr: i64, v: i64) -> i64 { var i: i64=0; while i<8 { mem[addr+i]=((v>>(i*8))&0xff) as u8; i=i+1 } return 0 }
called by 1: ek_emu
23func ek_ld64(mem: *u8, addr: i64) -> i64 { var v: i64=0; var i: i64=0; while i<8 { v=v|((mem[addr+i] as i64)<<(i*8)); i=i+1 } return v }
called by 1: ek_emu
24func ek_emu(code: *u8, len: i64, mem: *u8) -> i64
called by 1: main calls 3: ek_i32ek_st64ek_ld64
61func fx_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
66func fx_num(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
67func fx_b(c: *u8, o: i64, b: i64) -> i64 { c[o]=(b & 0xff) as u8; return o+1 }
called by 1: main
68func fx_i32(c: *u8, o: i64, v: i64) -> i64 { c[o]=(v&0xff) as u8; c[o+1]=((v>>8)&0xff) as u8; c[o+2]=((v>>16)&0xff) as u8; c[o+3]=((v>>24)&0xff) as u8; return o+4 }
called by 1: main
70func main() -> i64