nx_emu_x86_real16_test.nx
buildroot/runtime/nx_emu_x86_real16_test.nx
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
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
| none |
functions
| 16 | func 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 } |
| 17 | func 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 } |
| 18 | func 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 |
| 24 | func emu_x86_real16(mem: *u8, entry: i64, console: *u8, clen: *i64) -> i64 called by 1: main |
| 47 | func main() -> i64 |