langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1,12 @@
push 0
push 1
0:
swap
dup
onum
push 10
ochr
copy 1
add
jump 0

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,29 @@
; Read n.
push 0
dup
inum
load
; Call fib(n), ouput the result and a newline, then exit.
call 0
onum
push 10
ochr
exit
0:
dup
push 2
sub
jn 1 ; Return if n < 2.
dup
push 1
sub
call 0 ; Call fib(n - 1).
swap ; Get n back into place.
push 2
sub
call 0 ; Call fib(n - 2).
add ; Leave the sum on the stack.
1:
ret