Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .cpu cortex-a72
- .fpu neon-fp-armv8
- .data
- input: .asciz "Please enter the Fibonacci number: "
- recur: .asciz "%d"
- output: .asciz "%d is the number in the sequence."
- .text
- .align 2
- .global main
- .type main, %function
- main:
- push {fp, lr}
- add fp, sp, #4
- mov r5, #1 @ these registers and r1 will be used to
- mov r6, #0 @ calculate the fibonacci sum
- ldr r0, =input @read Fibonacci no.
- bl printf
- ldr r0, =recur
- sub sp, sp, #4
- mov r1, sp
- bl scanf
- ldr r7, [sp]
- loop:
- add r0, r5, r6
- mov r6, r5
- mov r5, r0
- sub r7, r0, #1
- cmp r7, #1
- ble end
- b loop
- end:
- ldr r0, =output
- mov r1, r7
- bl printf
- sub sp, fp, #4
- pop {fp, pc}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement