diff options
author | kdx <kdx.42@42l.fr> | 2023-04-14 04:56:14 +0000 |
---|---|---|
committer | kdx <kdx.42@42l.fr> | 2023-04-14 04:56:14 +0000 |
commit | 0b9399cb2e553b1c5a67bd6b3f14bd45b69249d5 (patch) | |
tree | 1aaf564146b2d88ccd4d6ee26fd772d358f0736e | |
parent | dcbc2dfa4dba9bf800d730f76f3c63faa3accb81 (diff) | |
download | orga-0b9399cb2e553b1c5a67bd6b3f14bd45b69249d5.tar.gz |
shorthand for literal label
-rw-r--r-- | samples/helloworld.orgaasm | 2 | ||||
-rw-r--r-- | samples/input.orgaasm | 2 | ||||
-rw-r--r-- | samples/screen.orgaasm | 2 | ||||
-rw-r--r-- | samples/shfthelloworld.orgaasm | 2 | ||||
-rw-r--r-- | src/orgaasm.c | 4 |
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; |