code wiki / _hdl_build / _pe_kw_crc_test.nx

_pe_kw_crc_test.nx source

↩ module page · 23 lines · 688 B

1// AUTHORED BY THE NISHI BUILDER (pattern: STRUCT_WALK v2 test) -- KATs computed from the table at emit time 2import "_pe_kw_crc.nx" 3import "nx_syscalls.nx" 4func main() -> i64 { 5 let b: *u8 = sys_mmap(512) 6 b[0] = 97 as u8 7 b[1] = 98 as u8 8 b[2] = 99 as u8 9 b[3] = 0 as u8 10 b[4] = 167 as u8 11 b[5] = 93 as u8 12 b[6] = 104 as u8 13 b[7] = 80 as u8 14 let out: *i64 = sys_mmap(32) as *i64 15 if _pe_kw_crc_locate(b, 8, out) == 0 { 16 if out[0] == 0 { 17 if out[1] == 4 { 18 if _pe_kw_crc_locate(b, 3, out) == 0 - 1 { 19 b[0] = (((b[0] & 0xff) + 1) & 0xff) as u8 20 if _pe_kw_crc_locate(b, 8, out) == 0 - 1 { sys_exit(0) } } } } } 21 sys_exit(1) 22 return 1 23}