code wiki / (root) / nx_emu_x86_real16_test.nx

nx_emu_x86_real16_test.nx

buildroot/runtime/nx_emu_x86_real16_test.nx

6075 B79 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/prooftopic emu
docsdependenciesstructsconstsfunctions

about

nx_emu_x86_real16_test.nx -- x86 ladder R9 rung-3: REALLY BOOT THE REAL IMAGE on the sovereign emu. Up to now the emu ran 64-bit code and the real nishi_boot.img was only structurally checked -- never EXECUTED. A real PC boots by loading sector 0 at linear 0x7C00 and running its 16-bit real-mode code through BIOS INT 10h. This adds a 16-bit real-mode interpreter + a BIOS INT 10h (AH=0x0E teletype) model, LOADS the real on-disk nishi_boot.img into emu memory at 0x7C00, sets IP=0x7C00, and EXECUTES the actual boot opcodes (BE mov si / AC lodsb / 08C0 or al,al / 74 jz / B4 mov ah / CD10 int10 / EB jmp / F4 hlt) until HALT, collecting the teletype output. This closes the "emu does not model BIOS" gap: our real artifact now genuinely boots + prints its banner on our own machine model. KAT: the console output == "NISHIOS x86 boots\r\n" AND the cpu halted cleanly. HONEST SCOPE: this is the FIRST boot rung -- it executes the real MBR. INT 13h disk-read (load more sectors) -> stage2 -> a long-mode kernel -> GDT/IDT/MM/scheduler/syscalls/userspace are the rungs above (the real-OS ladder). No persistent-hardware writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_emu_x86_real16_test.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 r16_puts sys_write sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sys_exit emu_x86_real16 r16_num sys_mmap ↻ sys_write ↻ sys_write ↻ r16_beq

structs

none

consts

none

functions

16func r16_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 calls 1: sys_write
17func r16_num(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
18func r16_beq(a: *u8, b: *u8, n: i64) -> i64 { var i: i64=0; while i<n { if a[i]!=b[i] { return 0 } i=i+1 } return 1 }
called by 1: main
24func emu_x86_real16(mem: *u8, entry: i64, console: *u8, clen: *i64) -> i64
called by 1: main
47func main() -> i64