aboutsummaryrefslogtreecommitdiff
path: root/pu2/code.i2
diff options
context:
space:
mode:
authorGravatar moon <moon@coffin.ir> 2025-08-22 19:09:46 +0330
committerGravatar moon <moon@coffin.ir> 2025-08-22 19:09:46 +0330
commit1e7e5ee85963aee23b71fa59cd622a06f27e1a6e (patch)
tree87d527b9436b99c3498e615c3ce7350962a7ba8c /pu2/code.i2
parentadded jmp, jnz and jz (diff)
if statements are now supported!
Diffstat (limited to 'pu2/code.i2')
-rw-r--r--pu2/code.i219
1 files changed, 13 insertions, 6 deletions
diff --git a/pu2/code.i2 b/pu2/code.i2
index c42cdd5..06d1c54 100644
--- a/pu2/code.i2
+++ b/pu2/code.i2
@@ -1,3 +1,11 @@
+/*
+
+ testing grounds for the ir2 assembler
+ i still don't know whether it's a compiler, an IR emitter, or an assembler
+ hmmm...
+
+*/
+
macro puts(2) {
@1 = 0; // write
@2 = /1/; // ptr
@@ -13,13 +21,12 @@ macro putchar(1) {
system();
}
-@10 = 1;
+@10 = 0;
-jz(@10, continue); // conditional jump!
-
-puts(["hi"], [2]);
-
-continue:
+// if statement!!
+if (@10) {
+ puts(["hi"], [2]);
+}
putchar([10]);
puts([" hello world"], [15]);