summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-06-10 16:27:33 +0200
committerkdx <kikoodx@paranoici.org>2023-06-10 16:27:33 +0200
commit11d4688d8bec78efc5aee1a668ea0ba8193e5ec2 (patch)
treea6b41ed5877ae5af25ccd9153683c73222723fe3 /samples
parent37d470da243a2165d28b8a807ce940cb27b2c321 (diff)
downloadgolem-11d4688d8bec78efc5aee1a668ea0ba8193e5ec2.tar.gz
helloworld broken
Diffstat (limited to 'samples')
-rw-r--r--samples/helloworld.golem39
1 files changed, 39 insertions, 0 deletions
diff --git a/samples/helloworld.golem b/samples/helloworld.golem
new file mode 100644
index 0000000..5ddde54
--- /dev/null
+++ b/samples/helloworld.golem
@@ -0,0 +1,39 @@
+global str[32];
+
+main() {
+ strappend('H');
+ strappend('e');
+ strappend('l');
+ strappend('l');
+ strappend('o');
+ strappend(' ');
+ strappend('W');
+ strappend('o');
+ strappend('r');
+ strappend('l');
+ strappend('d');
+ strappend('!');
+ strappend('\n');
+
+ print(str);
+}
+
+strappend(c) {
+ local s;
+ s = str;
+ loop {
+ if ([s] == 0)
+ break;
+ s = s + 1;
+ }
+ [s] = c;
+}
+
+print(s) {
+ loop {
+ if ([s] == 0)
+ break;
+ wrt [s];
+ s = s + 1;
+ }
+}