diff options
| Commit | ce0636266d416103c8827bd6cfa570ae89e19bfc (patch) | |
|---|---|---|
| Author | 2025-02-14 18:29:08 +0200 | |
| Committer | 2025-02-14 18:29:08 +0200 | |
| Files | 7de2bcb13dbfe7d34295786ca971c9ed4684d849 /examples | |
| tonkobali-ce0636266d416103c8827bd6cfa570ae89e19bfc.tar tonkobali-ce0636266d416103c8827bd6cfa570ae89e19bfc.tar.gz tonkobali-ce0636266d416103c8827bd6cfa570ae89e19bfc.zip | ||
| Parent | acbd7c4b6cb7917ab0033d2cb18df182d614a85a (diff) | |
chore: Move example to a directory
1 files changed, 21 insertions, 0 deletions
| -rw-r--r-- | examples/fib.s | 21 |
diff --git a/examples/fib.s b/examples/fib.s new file mode 100644 index 0000000..afc4b25 --- /dev/null +++ b/examples/fib.s @@ -0,0 +1,21 @@ +f0 = 0 +f1 = 1 +fN = 0 +n = 5 + +fib: + beq n, fib_result ; while n > 0 + + mov f0, fN ; fN = f0 + f1 + add f1, fN + mov f1, f0 ; f0 = f1 + mov fN, f1 ; f1 = fN + + dec n ; n-- + + jmp fib + +fib_result: + mov f0, %1000 ; return f0 + mov %0, f0 ; Reset f0 + mov %1, f1 ; Reset f1 |
