code wiki / (root) / nx_x86_modrm_gate.nx

nx_x86_modrm_gate.nx

buildroot/runtime/nx_x86_modrm_gate.nx

4636 B76 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic x86
docsdependenciesstructsconstsfunctions

about

nx_x86_modrm_gate.nx -- R1.0b: ModR/M + memory operands. Program round-trips a value through memory via [disp16] and [BX], does a memory-operand ADD, and a register-direct ModR/M MOV; checks both registers and the actual memory contents. Proves the 16-bit addressing core that real DOS programs depend on. B8 34 12 MOV AX,0x1234 89 06 00 02 MOV [0x200],AX (mod00 rm6 disp16 store) 8B 1E 00 02 MOV BX,[0x200] (mod00 rm6 disp16 load) -> BX=0x1234 03 1E 00 02 ADD BX,[0x200] (memory-operand add) -> BX=0x2468 89 1E 02 02 MOV [0x202],BX -> mem[0x202]=0x2468 89 D9 MOV CX,BX (mod11 register-direct) -> CX=0x2468 BB 00 03 MOV BX,0x300 89 07 MOV [BX],AX (mod00 rm7 [BX] store) -> mem[0x300]=0x1234 8B 17 MOV DX,[BX] (mod00 rm7 [BX] load) -> DX=0x1234 F4 HLT

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_x86.nx nx_gate_verdict.nx nx_x86_modrm_gate.nx

imports: nx_syscalls.nxnx_x86.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main g_puts sys_write sys_mmap x86_reset x86_load x86_run x86_step x86_setzsf x86_modrm x86_rm_set x86_wr16 x86_rm_get x86_rd16 x86_set_r8 x86_dos_int21 x86_fs_nameeq g_check g_puts ↻ x86_reg x86_peek16 x86_rd16 ↻ g_pn sys_mmap ↻ sys_write ↻ gv_ctr sys_mmap ↻ gv_verdict gv_puts sys_write ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_journal sys_openat_append sys_mmap ↻ gv_catn sys_mmap ↻ sys_munmap ↻

structs

none

consts

none

functions

18func g_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 2: g_checkmain calls 1: sys_write
19func g_pn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
33func g_check(name: *u8, cond: i64) -> i64
called by 1: main calls 1: g_puts
39func main() -> i64