Browse code

(asma) Implement new jump and call syntax.

Andrew Alderwick authored on 14/01/2023 20:39:59
Showing 2 changed files
... ...
@@ -57,10 +57,10 @@ EOD
57 57
 expect_failure 'Invalid hexadecimal: #000' <<'EOD'
58 58
 |1000 #000
59 59
 EOD
60
-expect_failure 'Unrecognised token: 0' <<'EOD'
60
+expect_failure 'Label not found: 0' <<'EOD'
61 61
 |1000 0
62 62
 EOD
63
-expect_failure 'Unrecognised token: 000' <<'EOD'
63
+expect_failure 'Label not found: 000' <<'EOD'
64 64
 |1000 000
65 65
 EOD
66 66
 expect_failure 'Address not in zero page: .hello' <<'EOD'
... ...
@@ -75,7 +75,7 @@ expect_failure 'Address outside range: ,hello' <<'EOD'
75 75
 |1000 @hello
76 76
 |2000 ,hello
77 77
 EOD
78
-expect_failure 'Unrecognised token: hello' <<'EOD'
78
+expect_failure 'Label not found: hello' <<'EOD'
79 79
 hello
80 80
 EOD
81 81
 expect_failure 'Macro already exists: %me' <<'EOD'
... ...
@@ -112,7 +112,7 @@ EOD
112 112
 expect_failure 'Label not found: .blah' <<'EOD'
113 113
 |1000 .blah
114 114
 EOD
115
-expect_failure "Unrecognised token: 'a" <<'EOD'
115
+expect_failure "Label not found: 'a" <<'EOD'
116 116
 |1000 'a
117 117
 EOD
118 118
 echo 'All OK'
... ...
@@ -732,6 +732,20 @@
732 732
 	&ignore-error
733 733
 	JMP2r
734 734
 
735
+@asma-jci
736
+	#20 ,asma-jxi JMP ( tail call )
737
+
738
+@asma-jmi
739
+	#40
740
+	( fall through )
741
+
742
+@asma-jxi
743
+	;asma-write-byte JSR2
744
+	,asma-addr-helper JSR
745
+	;asma/addr LDA2 SUB2
746
+	#0002 SUB2
747
+	;asma-write-short JMP2 ( tail call )
748
+
735 749
 @asma-literal-rel-addr
736 750
 	LIT LIT ;asma-write-byte JSR2
737 751
 	( fall through )
... ...
@@ -851,8 +865,7 @@
851 865
 
852 866
 	&not-macro
853 867
 	POP2
854
-	;asma-msg-token ;asma/error STA2
855
-	JMP2r
868
+	#60 ;asma-jxi JMP2 ( tail call )
856 869
 
857 870
 @asma-include
858 871
 	;heap LDA2
... ...
@@ -867,7 +880,6 @@
867 880
 @asma-msg-zero-page "Address 20 "not 20 "in 20 "zero 20 "page 00
868 881
 @asma-msg-relative  "Address 20 "outside 20 "range 00
869 882
 @asma-msg-label     "Label 20 "not 20 "found 00
870
-@asma-msg-token     "Unrecognised 20 "token 00
871 883
 @asma-msg-macro     "Macro 20 "already 20 "exists 00
872 884
 @asma-msg-rewound   "Memory 20 "overwrite 00
873 885
 @asma-msg-redefined "Label 20 "redefined 00
... ...
@@ -892,7 +904,8 @@
892 904
 	&7d          $2         $2          "} 00          :asma-macro-end
893 905
 
894 906
 @asma-first-char-normal
895
-	&22          $2         $2          "" 00          :asma-raw-word
907
+	&21          $2         $2          "! 00          :asma-jmi
908
+	&22         :&21        $2          "" 00          :asma-raw-word
896 909
 	&23         :&22        $2          "# 00          :asma-literal-hex
897 910
 	&24         :&23       :&25         "$ 00          :asma-pad-relative
898 911
 	&25          $2         $2          "% 00          :asma-macro-define
... ...
@@ -905,7 +918,8 @@
905 918
 	&3a          $2         $2          ": 00          :asma-abs-addr
906 919
 	&3b         :&3a        $2          "; 00          :asma-literal-abs-addr
907 920
 	&3d         :&3b       :&40         "= 00          :asma-abs-addr
908
-	&40          $2         $2          "@ 00          :asma-label-define
921
+	&3f          $2         $2          "? 00          :asma-jci
922
+	&40         :&3f        $2          "@ 00          :asma-label-define
909 923
 	&5f         :&3d       :&7d         "_ 00          :asma-rel-addr
910 924
 	&7b          $2         $2          "{ 00          :asma-ignore
911 925
 	&7c         :&7b        $2          "| 00          :asma-pad-absolute