aboutsummaryrefslogtreecommitdiff
path: root/examples/fibonacci.hdasm
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-31 00:19:10 +0200
committerhachem <im@hachem.wtf>2026-08-31 00:19:10 +0200
commit3e20038bbf7206e2270655418d7884ccfe91a4e4 (patch)
treedfc7bf806a00c1dbec6c889351c108702a0e9d40 /examples/fibonacci.hdasm
parent8eac30c13cfa4f47a8a0aa0772b96f0813fe33a5 (diff)
add directives and directive based entry points
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