code wiki / (root) / nx_smoke_asm_d1.nx

nx_smoke_asm_d1.nx source

↩ module page · 24 lines · 796 B

1// Diagnostic: which instructions actually got emitted in test22? 2// addi -> opcode lo byte = 0x13 3// sd -> 0x23 4// li -> 0x13 (also addi-shaped) 5// ret -> 0x67 6// 7// Return byte[0] of output. 8// nx_safety_envelope: 9// intended_use: AUTO_APPLIED -- primitive-specific tuning queued 10// sil_target: SIL1 11// evidence: [bulk_applied_2026-05-16, see-file-comment-for-detail] 12// verdict: NOT_YET_EVALUATED 13 14import "nx_syscalls.nx" 15import "nxasm_v2.nx" 16 17func main() -> i64 { 18 let s: *u8 = ".text\n.globl main\nmain:\naddi sp, sp, -16\nsd ra, 8(sp)\nli a0, 30\nret\n" 19 var sl: i64 = 0 20 while s[sl] != 0 { sl = sl + 1 } 21 let out: *u8 = alloc(64) 22 let n: i64 = assemble(s, sl, out, 64) 23 return __syscall(93, out[0] & 0xFF, 0, 0, 0, 0, 0) 24}