aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kdx.42@42l.fr>2023-04-14 05:38:36 +0000
committerkdx <kdx.42@42l.fr>2023-04-14 05:38:36 +0000
commit2ba2fa23a5a12f48c222899c71731e83942bd55c (patch)
tree26f1ea9890bb709c5cd65fd663aeb164ed5009e9
parent2ee855705571090ab6a7e584eb42b64d2fc7d8f9 (diff)
downloadorga-2ba2fa23a5a12f48c222899c71731e83942bd55c.tar.gz
shorthand for routine call
-rw-r--r--samples/helloworld.orgaasm2
-rw-r--r--samples/shfthelloworld.orgaasm2
-rw-r--r--src/orgaasm.c8
3 files changed, 9 insertions, 3 deletions
diff --git a/samples/helloworld.orgaasm b/samples/helloworld.orgaasm
index 1b77832..dd5d3ab 100644
--- a/samples/helloworld.orgaasm
+++ b/samples/helloworld.orgaasm
@@ -1,5 +1,5 @@
-hellostr
- JRT ,putstr
+ /putstr
RET
@putstr ( str -- )
diff --git a/samples/shfthelloworld.orgaasm b/samples/shfthelloworld.orgaasm
index 5e37e02..bf10435 100644
--- a/samples/shfthelloworld.orgaasm
+++ b/samples/shfthelloworld.orgaasm
@@ -1,5 +1,5 @@
-hellostr
- JRT ,putstr
+ /putstr
RET
@putstr ( str -- )
diff --git a/src/orgaasm.c b/src/orgaasm.c
index 63581b7..3db100c 100644
--- a/src/orgaasm.c
+++ b/src/orgaasm.c
@@ -150,6 +150,7 @@ first_pass(char *s)
case '@': /* label marker */
register_label(tok + 1, pc);
break;
+ case '/': /* call label */
case '-': /* literal label */
case '#': /* literal marker */
pc += 2;
@@ -169,9 +170,14 @@ second_pass(char *s)
switch (tok[0]) {
case '@': /* label declaration, skip */
continue;
+ case '/': /* call label */
+ write_short(OP_JRT);
+ write_label(tok + 1);
+ continue;
case '-': /* literal label insertion */
write_short(OP_LIT);
- /* fallthrough */
+ write_label(tok + 1);
+ continue;
case ',': /* label insertion */
write_label(tok + 1);
continue;