-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfibonacci.disasm
65 lines (65 loc) · 937 Bytes
/
fibonacci.disasm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
strings
string10 Hello! Which Fibonacci number are you interested in?
string24 Great choice! The number is
string32 Thank you!
.
labels
.
functions
function38
strings
.
labels
label40
.
functions
.
commands
pop
move res reg1
pop
move res reg2
push reg1
equal reg2 0
if res label40
equal reg2 1
if res label40
push reg2
subtract reg2 1
push res
pushaddr
call function38
pop
move res reg3
pop
subtract res 2
push reg3
push res
pushaddr
call function38
pop
move res reg4
pop
add reg4 res
move res reg5
pop
push reg5
return
label label40
pop
push reg2
return
.
.
commands
str string10
read
push res
pushaddr
call function38
pop
str string24
print res
str string32
exit
.