summaryrefslogtreecommitdiff
path: root/factorial.was
diff options
context:
space:
mode:
authorJohnny Richard <johnny@johnnyrichard.com>2025-04-11 01:15:01 +0200
committerJohnny Richard <johnny@johnnyrichard.com>2025-04-14 23:11:22 +0200
commite7f69c8fbbbcbddde84933b2becd91e787d1ac63 (patch)
tree16cd17da17133494dd06aab614724e76b059d4ad /factorial.was
Intial commit
Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
Diffstat (limited to 'factorial.was')
-rw-r--r--factorial.was28
1 files changed, 28 insertions, 0 deletions
diff --git a/factorial.was b/factorial.was
new file mode 100644
index 0000000..a8cf222
--- /dev/null
+++ b/factorial.was
@@ -0,0 +1,28 @@
+ push 0
+ push 10
+ store
+ push 1
+ call 0
+ printi
+ jmp 2
+label0:
+ push 0
+ load
+ dup
+ push 0
+ swap
+ push 1
+ sub
+ store
+ mul
+ push 0
+ load
+ jz 1
+ call 0
+label1:
+ ret
+label2:
+ printi
+ push 10
+ printc
+ end