code wiki / (root) / smoke_asm_d7.nx

smoke_asm_d7.nx source

↩ module page · 10 lines · 374 B

1// Pure string-literal sanity check. Same string as test22. 2// Returns the strlen() of the literal. Expected: 68. 3import "syscalls.nx" 4 5func main() -> i64 { 6 let s: *u8 = ".text\n.globl main\nmain:\naddi sp, sp, -16\nsd ra, 8(sp)\nli a0, 30\nret\n" 7 var sl: i64 = 0 8 while s[sl] != 0 { sl = sl + 1 } 9 return __syscall(93, sl & 0xFF, 0, 0, 0, 0, 0) 10}