Skip to content

Instantly share code, notes, and snippets.

@hikilaka
Last active August 29, 2015 14:25
Show Gist options
  • Save hikilaka/2924696baff5d157f1aa to your computer and use it in GitHub Desktop.
Save hikilaka/2924696baff5d157f1aa to your computer and use it in GitHub Desktop.
.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