# INSTRUCTION SYNTAX # instr OR instr # or instr # or instr # no 4 src instructions built in or pseudo instructions, but functions can have >= 4 args # Ignore everything between '#' and '\n' .data string hello "Hello, World!\n" .code start: loadint 5, x0 loadfloat 5.0, f0 # cast integer register to float (use a library?) cast_f32_i32 x0, f1 f32add x0, f0 shiftleft x0, 1 beq _success x0, 0 _success: extern print # set args loadaddr success_string, a0 # stdout = 0 (fd) loadval 0, a1 # basically saveaddr this; jumpaddr print call print _hello: # stream hello world to stdout extern print loadaddr hello, a0 loadval 0, a1 call print _exit: # to 'exit', one must end program execution and tell kernel to close the process and cleanup the resources. Kernel does that anyway, e.g. if SIGKILL was sent # exit syscall = 4 loadval 4, a0 # exit value, 0 success, 1 failure loadval 0, a1 syscall # castf32i32, a pseudo instruction linked as a library in phantasm .data string success_string "Success!\n"