Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Franck Pommereau
/
bones
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Franck Pommereau
2015-03-24 12:00:18 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3ee712524997f8efc1087e870d0157164ff67978
3ee71252
1 parent
02622a06
added factorial asm example
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
0 deletions
asm/fact-iter.asm
asm/fact-rec.asm
asm/fact-iter.asm
0 → 100644
View file @
3ee7125
set
R0
5
push
R0
set
R1
@
fact
call
R1
pop
R0
halt
############
fact
:
set
R0
1
cp
SP
R9
dec
R9
dec
R9
load
R9
R1
set
R2
@
loop
set
R3
@
endloop
loop
:
jz
R1
R3
mul
R0
R1
dec
R1
jmp
R2
endloop
:
save
R0
R9
ret
asm/fact-rec.asm
0 → 100644
View file @
3ee7125
set
R0
5
push
R0
set
R8
@
fact
call
R8
pop
R0
halt
#############
fact
:
cp
SP
R9
dec
R9
dec
R9
load
R9
R0
set
R8
@
base
jz
R0
R8
recurse
:
dec
R0
push
R0
set
R8
@
fact
call
R8
pop
R1
cp
SP
R9
dec
R9
dec
R9
load
R9
R0
mul
R0
R1
set
R8
@
return
jmp
R8
base
:
set
R0
1
return
:
save
R0
R9
ret
Please
register
or
login
to post a comment