Skip to content
Snippets Groups Projects
Commit 6c1e8fe7 authored by iliya's avatar iliya
Browse files

started working on last exercise

parent 12d48aea
Branches
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@
.global funcexo1
.global funcexo2
.global funcexo3
.global funcexo4
/*****************************************************
......@@ -94,5 +95,58 @@ funcexo3:
bx lr
/*****************************************************
* function : exercice 4
* R0: n
* return value : value of fibonacci sequence for n
*****************************************************/
.thumb_func
funcexo4:
mov r1, r0
push {r0, r1, lr}
bl lhs_fact
lhs_fact:
pop {r0, r1, lr}
sub r0, #1
cmp r0, #1
bgt lhs_fact
bl rhs_fact
rhs_fact:
exit_ret:
pop {r0, r1, lr}
mov r0, #1
bx lr
fact:
push {r0, r1, lr}
sub r0, #1
cmp r0, #1
bgt rcall
sub r1, #2
cmp r1, #1
bgt rcall
add sp, #12
bx lr
rcall:
bl fact
pop {r0, r1, lr}
add r0, r1
bx lr
//.weak add_sat
.ltorg
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment