# Ballisti-K sample program # Russell Bornschlegel, 4/9/2001 # you can print arbitrary strings print Ballisti-K test program # a newline can be tedious load 13 throw 3 load 10 throw 2 printc printc # this is cheating, really print Hello World! <-- the easy way # so is this printl # real ballistik programmers do it this way load 72 # H throw 8 load 69 # E throw 7 load 76 # L throw 6 throw 6 # redundant throw load 79 # 0 throw 5 printc printc printc printc printc # but i have nothing to prove printl #swap two load 5 throw 5 load 10 throw 1 printn printl printn printl # some fibonaccis # cheat the first one print First 12 fibonaccis: printl print 1 printl load 10 # count of fibs to print throw 11 # throw to jz instruction load 1 # decrementor as well as fib[0] and fib[1] throw 11 # throw to sub instruction throw 1 # throw to accumulator throw 5 # throw to add instruction # fib loop printn # print fib[N] printl # one fib to a line pass # chamber = fib[N] throw 14 # throw fib[N] to add instruction _on next loop_ add # fib[N-1] lands; chamber holds fib[N+1] throw 8 # throw fib[N+1] to print instruction on next loop jz 7 # count lands, jump to end instruction pass # chamber holds count sub # 1 lands, chamber holds count-1 throw 10 # throw count to the jz instruction on the next loop pass # chamber holds 1 throw 10 # throw 1 to sub instruction on the next loop jump -13 # jump to print instruction end