Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Courses
csci206_lecture_examples
Commits
bae076c1
Commit
bae076c1
authored
Feb 26, 2014
by
Alan Marchiori
Browse files
add
parent
68c68fe4
Changes
1
Show whitespace changes
Inline
Side-by-side
section01/Lec15/fact_inclass.s
0 → 100644
View file @
bae076c1
.
text
li
$a0
,
10
jal
fact
move
$s0
,
$v0
li
$v0
,
10
syscall
fact
:
addi
$sp
,
$sp
,
-
12
#
Allocate
space
for
return
,
arg
,
result
sw
$ra
,
0
(
$sp
)
sw
$a0
,
4
(
$sp
)
li
$t0
,
1
bge
$a0
,
$t0
,
ELSE
#
If
arg
>=
1
sw
$t0
,
8
(
$sp
)
j
END
ELSE
:
addi
$a0
,
$a0
,
-
1
#
n
-
1
jal
fact
lw
$a0
,
4
(
$sp
)
#
Load
arg
mul
$t0
,
$a0
,
$v0
#
t0
=
arg
*
returnValue
sw
$t0
,
8
(
$sp
)
#
result
=
t0
END
:
lw
$v0
,
8
(
$sp
)
#
Set
return
register
=
return
lw
$ra
,
0
(
$sp
)
#
Load
return
address
addi
$sp
,
$sp
,
12
#
Deallocate
stack
jr
$ra
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment