diff options
author | kdx <kikoodx@paranoici.org> | 2023-06-10 17:40:16 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-06-10 17:40:16 +0200 |
commit | 5e9f115e2d938a47a3d3db42188b837d4b57891a (patch) | |
tree | cf26c1ab4992b77961c10fce0e82fce0b057643b | |
parent | 11d4688d8bec78efc5aee1a668ea0ba8193e5ec2 (diff) | |
download | golem-5e9f115e2d938a47a3d3db42188b837d4b57891a.tar.gz |
that was kinda stupid
-rwxr-xr-x | run.sh | 2 | ||||
-rw-r--r-- | samples/helloworld.golem | 21 | ||||
-rw-r--r-- | src/main.c | 3 |
3 files changed, 15 insertions, 11 deletions
@@ -1,6 +1,6 @@ #!/bin/sh tup -q || exit 1 ./build/golem "$1" >build/tmp.orgaasm || exit 1 -orgaasm build/tmp.orgaasm build/tmp.rom || exit 1 +orgaasm build/tmp.orgaasm build/tmp.rom -v || exit 1 orgaemu build/tmp.rom #rm -f build/tmp.* diff --git a/samples/helloworld.golem b/samples/helloworld.golem index 5ddde54..6609a51 100644 --- a/samples/helloworld.golem +++ b/samples/helloworld.golem @@ -1,6 +1,9 @@ global str[32]; +global str_i = 0; main() { + local i; + strappend('H'); strappend('e'); strappend('l'); @@ -15,18 +18,18 @@ main() { strappend('!'); strappend('\n'); - print(str); -} - -strappend(c) { - local s; - s = str; + i = 0; loop { - if ([s] == 0) + i = i + 1; + if (i > 9) break; - s = s + 1; + print(str); } - [s] = c; +} + +strappend(c) { + [str+str_i] = c; + str_i = str_i + 1; } print(s) { @@ -975,7 +975,8 @@ main(int argc, char **argv) Node *node = parse(tok); - printf("\tJMP ,__fn_main ( entry point )\n"); + printf("\tJRT ,__fn_main ( entry point )\n"); + printf("\tRET\n"); codegen(node); printf("@__stack_ptr\n"); |