aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kdx.42@42l.fr>2023-04-14 04:56:14 +0000
committerkdx <kdx.42@42l.fr>2023-04-14 04:56:14 +0000
commit0b9399cb2e553b1c5a67bd6b3f14bd45b69249d5 (patch)
tree1aaf564146b2d88ccd4d6ee26fd772d358f0736e
parentdcbc2dfa4dba9bf800d730f76f3c63faa3accb81 (diff)
downloadorga-0b9399cb2e553b1c5a67bd6b3f14bd45b69249d5.tar.gz
shorthand for literal label
-rw-r--r--samples/helloworld.orgaasm2
-rw-r--r--samples/input.orgaasm2
-rw-r--r--samples/screen.orgaasm2
-rw-r--r--samples/shfthelloworld.orgaasm2
-rw-r--r--src/orgaasm.c4
5 files changed, 8 insertions, 4 deletions
diff --git a/samples/helloworld.orgaasm b/samples/helloworld.orgaasm
index abc99bc..1b77832 100644
--- a/samples/helloworld.orgaasm
+++ b/samples/helloworld.orgaasm
@@ -1,4 +1,4 @@
- LIT ,hellostr
+ -hellostr
JRT ,putstr
RET
diff --git a/samples/input.orgaasm b/samples/input.orgaasm
index 46b4c9e..517895f 100644
--- a/samples/input.orgaasm
+++ b/samples/input.orgaasm
@@ -1,6 +1,6 @@
@loop
SLP ( cycle input events )
- LIT ,Input LDA ( get input )
+ -Input LDA ( get input )
DBG ( print to console )
#0008 AND ( loop until start is pressed )
JEZ ,loop
diff --git a/samples/screen.orgaasm b/samples/screen.orgaasm
index 7b16d71..bd22ca0 100644
--- a/samples/screen.orgaasm
+++ b/samples/screen.orgaasm
@@ -1,4 +1,4 @@
- LIT ,Screen
+ -Screen
@loop
DUP DUP STA ( draw pixel )
INC DUP ( overflow check )
diff --git a/samples/shfthelloworld.orgaasm b/samples/shfthelloworld.orgaasm
index da77f20..5e37e02 100644
--- a/samples/shfthelloworld.orgaasm
+++ b/samples/shfthelloworld.orgaasm
@@ -1,4 +1,4 @@
- LIT ,hellostr
+ -hellostr
JRT ,putstr
RET
diff --git a/src/orgaasm.c b/src/orgaasm.c
index 18a0e54..63581b7 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 '-': /* literal label */
case '#': /* literal marker */
pc += 2;
break;
@@ -168,6 +169,9 @@ second_pass(char *s)
switch (tok[0]) {
case '@': /* label declaration, skip */
continue;
+ case '-': /* literal label insertion */
+ write_short(OP_LIT);
+ /* fallthrough */
case ',': /* label insertion */
write_label(tok + 1);
continue;