commit 7c5d90ba66a9b3f70a2c0d6459591a73ddf514c8
parent 3d68e08f6cca173b95e41b650f407f60b0b22cbc
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date: Sat, 14 Jan 2023 20:39:59 +0000
(asma) Implement new jump and call syntax.
Diffstat:
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/etc/asma-test.sh b/etc/asma-test.sh
@@ -57,10 +57,10 @@ EOD
expect_failure 'Invalid hexadecimal: #000' <<'EOD'
|1000 #000
EOD
-expect_failure 'Unrecognised token: 0' <<'EOD'
+expect_failure 'Label not found: 0' <<'EOD'
|1000 0
EOD
-expect_failure 'Unrecognised token: 000' <<'EOD'
+expect_failure 'Label not found: 000' <<'EOD'
|1000 000
EOD
expect_failure 'Address not in zero page: .hello' <<'EOD'
@@ -75,7 +75,7 @@ expect_failure 'Address outside range: ,hello' <<'EOD'
|1000 @hello
|2000 ,hello
EOD
-expect_failure 'Unrecognised token: hello' <<'EOD'
+expect_failure 'Label not found: hello' <<'EOD'
hello
EOD
expect_failure 'Macro already exists: %me' <<'EOD'
@@ -112,7 +112,7 @@ EOD
expect_failure 'Label not found: .blah' <<'EOD'
|1000 .blah
EOD
-expect_failure "Unrecognised token: 'a" <<'EOD'
+expect_failure "Label not found: 'a" <<'EOD'
|1000 'a
EOD
echo 'All OK'
diff --git a/projects/library/asma.tal b/projects/library/asma.tal
@@ -732,6 +732,20 @@
&ignore-error
JMP2r
+@asma-jci
+ #20 ,asma-jxi JMP ( tail call )
+
+@asma-jmi
+ #40
+ ( fall through )
+
+@asma-jxi
+ ;asma-write-byte JSR2
+ ,asma-addr-helper JSR
+ ;asma/addr LDA2 SUB2
+ #0002 SUB2
+ ;asma-write-short JMP2 ( tail call )
+
@asma-literal-rel-addr
LIT LIT ;asma-write-byte JSR2
( fall through )
@@ -851,8 +865,7 @@
¬-macro
POP2
- ;asma-msg-token ;asma/error STA2
- JMP2r
+ #60 ;asma-jxi JMP2 ( tail call )
@asma-include
;heap LDA2
@@ -867,7 +880,6 @@
@asma-msg-zero-page "Address 20 "not 20 "in 20 "zero 20 "page 00
@asma-msg-relative "Address 20 "outside 20 "range 00
@asma-msg-label "Label 20 "not 20 "found 00
-@asma-msg-token "Unrecognised 20 "token 00
@asma-msg-macro "Macro 20 "already 20 "exists 00
@asma-msg-rewound "Memory 20 "overwrite 00
@asma-msg-redefined "Label 20 "redefined 00
@@ -892,7 +904,8 @@
&7d $2 $2 "} 00 :asma-macro-end
@asma-first-char-normal
- &22 $2 $2 "" 00 :asma-raw-word
+ &21 $2 $2 "! 00 :asma-jmi
+ &22 :&21 $2 "" 00 :asma-raw-word
&23 :&22 $2 "# 00 :asma-literal-hex
&24 :&23 :&25 "$ 00 :asma-pad-relative
&25 $2 $2 "% 00 :asma-macro-define
@@ -905,7 +918,8 @@
&3a $2 $2 ": 00 :asma-abs-addr
&3b :&3a $2 "; 00 :asma-literal-abs-addr
&3d :&3b :&40 "= 00 :asma-abs-addr
- &40 $2 $2 "@ 00 :asma-label-define
+ &3f $2 $2 "? 00 :asma-jci
+ &40 :&3f $2 "@ 00 :asma-label-define
&5f :&3d :&7d "_ 00 :asma-rel-addr
&7b $2 $2 "{ 00 :asma-ignore
&7c :&7b $2 "| 00 :asma-pad-absolute