Last active
August 29, 2015 14:25
-
-
Save hikilaka/2924696baff5d157f1aa 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
.text | |
.global main | |
; r0 = accumulator | |
; r1 = first | |
; r2 = second | |
; r3 = step | |
main: | |
mov r1, #0 | |
mov r2, #1 | |
mov r3, #0 | |
b check | |
loop: | |
cmp r3, #1 | |
blt lt_one | |
add r0, r1, r2 ; accumulator = first + second | |
mov r1, r2 | |
mov r2, r0 | |
b increment | |
lt_one: | |
mov r0, r3 ; accumulator = step | |
increment: | |
add r3, #1 ; step += 1 | |
check: | |
cmp r3, #10 ; 10 = N in f(N) | |
blt loop | |
bx lr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment