aboutsummaryrefslogtreecommitdiff
path: root/examples/fibonacci.hdasm
diff options
context:
space:
mode:
Diffstat (limited to 'examples/fibonacci.hdasm')
-rw-r--r--examples/fibonacci.hdasm8
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/fibonacci.hdasm b/examples/fibonacci.hdasm
index 58f71fe..95a59c8 100644
--- a/examples/fibonacci.hdasm
+++ b/examples/fibonacci.hdasm
@@ -1,3 +1,5 @@
+[entry: main]
+
const SYS_WRITE = 1
const SYS_EXIT = 60
@@ -41,7 +43,7 @@ proc main
{
r12 = 0
r13 = 1
- rcx = 10
+ r15 = 10 // syscall clobbers rcx/r11, so keep the counter in r15
loop:
print_number(r12)
@@ -50,8 +52,8 @@ loop:
r12 = r13
r13 += rax
- rcx -= 1
- if rcx != 0
+ r15 -= 1
+ if r15 != 0
goto loop
rax = SYS_EXIT