(* A code procedure: machine code written as bytes, called like any other procedure. cpuid's vendor string, from leaf 0. *) module Cpu; import Out; import SYSTEM; (* cpuid leaf 0: puts the 12 bytes of the vendor in buf, rdi. *) proc vendor(buf: ^U8); code push rbx; mov r8, rdi; xor eax, eax; cpuid; mov [r8], ebx; mov [r8 + 4], edx; mov [r8 + 8], ecx; pop rbx; ret; end vendor; proc main*; var buf: [12]U8; i: INT; ok: BOOL; begin vendor(SYSTEM.ADR(buf[0])); ok := true; for i := 0 to 11 do if (buf[i] < ' ') or (buf[i] > '~') then ok := false; end; end; if ok then Out.str("vendor is printable\n"); end; end; end Cpu.