Last active
August 29, 2015 14:04
-
-
Save chiro/c5a6d3319da3c63d7fce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LDC 10 ; n | |
LDF 5 | |
AP 1 | |
DBUG | |
RTN | |
LD 0 0 ; entry point | |
LDC 1 | |
CGT | |
SEL 10 22 | |
RTN | |
LD 0 0 ;; n > 1 | |
LDC 2 | |
SUB | |
LDF 5 | |
AP 1 ;; call fib(n-2) | |
LD 0 0 | |
LDC 1 | |
SUB | |
LDF 5 | |
AP 1 ;; call fib(n-1) | |
ADD ;; calc fib(n-2) + fib(n-1) | |
JOIN | |
LDC 1 ;; if n <= 1 then return 1 | |
JOIN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment