print.ll (946B)
1 |0x0 @stdin |0x1 @stdout |0x2 @stderr (define stdin, stdout and error) 2 |0x50 @str "hello b32 "world b10 b0 (define the string to print, the b32, b10, and b0 are ascii for ' ', '\n' and '\0') 3 4 |0x100 @print (define a print function) 5 dupi (duplicate the input address, so it stays on the stack for the next call) 6 loadb dupb b2i #0 equ (load the byte at the input address, duplicate it, check if its '\0') 7 &end jnz (jump if it was 0) 8 &stdout storeb (print the char) 9 #1 add (add 1 to the address) 10 &print jmp (repeat) 11 12 @end 13 delb (stack cleanup) 14 deli 15 ret (return) 16 17 |0x1000 18 &str &print call (call the function print with the address of str as an arg) 19 &str &print call (call the function print with the address of str as an arg) 20 halt (end the program) 21 22 23 (This program works by having a 0 at the end of a string, it prints the string 1 char at a time, and if it finds a 0 it stops)