(asma) Implement new jump and call syntax.

This commit is contained in:
Andrew Alderwick 2023-01-14 20:39:59 +00:00
parent 3d68e08f6c
commit 7c5d90ba66
2 changed files with 23 additions and 9 deletions

View File

@ -57,10 +57,10 @@ EOD
expect_failure 'Invalid hexadecimal: #000' <<'EOD' expect_failure 'Invalid hexadecimal: #000' <<'EOD'
|1000 #000 |1000 #000
EOD EOD
expect_failure 'Unrecognised token: 0' <<'EOD' expect_failure 'Label not found: 0' <<'EOD'
|1000 0 |1000 0
EOD EOD
expect_failure 'Unrecognised token: 000' <<'EOD' expect_failure 'Label not found: 000' <<'EOD'
|1000 000 |1000 000
EOD EOD
expect_failure 'Address not in zero page: .hello' <<'EOD' expect_failure 'Address not in zero page: .hello' <<'EOD'
@ -75,7 +75,7 @@ expect_failure 'Address outside range: ,hello' <<'EOD'
|1000 @hello |1000 @hello
|2000 ,hello |2000 ,hello
EOD EOD
expect_failure 'Unrecognised token: hello' <<'EOD' expect_failure 'Label not found: hello' <<'EOD'
hello hello
EOD EOD
expect_failure 'Macro already exists: %me' <<'EOD' expect_failure 'Macro already exists: %me' <<'EOD'
@ -112,7 +112,7 @@ EOD
expect_failure 'Label not found: .blah' <<'EOD' expect_failure 'Label not found: .blah' <<'EOD'
|1000 .blah |1000 .blah
EOD EOD
expect_failure "Unrecognised token: 'a" <<'EOD' expect_failure "Label not found: 'a" <<'EOD'
|1000 'a |1000 'a
EOD EOD
echo 'All OK' echo 'All OK'

View File

@ -732,6 +732,20 @@
&ignore-error &ignore-error
JMP2r 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 @asma-literal-rel-addr
LIT LIT ;asma-write-byte JSR2 LIT LIT ;asma-write-byte JSR2
( fall through ) ( fall through )
@ -851,8 +865,7 @@
&not-macro &not-macro
POP2 POP2
;asma-msg-token ;asma/error STA2 #60 ;asma-jxi JMP2 ( tail call )
JMP2r
@asma-include @asma-include
;heap LDA2 ;heap LDA2
@ -867,7 +880,6 @@
@asma-msg-zero-page "Address 20 "not 20 "in 20 "zero 20 "page 00 @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-relative "Address 20 "outside 20 "range 00
@asma-msg-label "Label 20 "not 20 "found 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-macro "Macro 20 "already 20 "exists 00
@asma-msg-rewound "Memory 20 "overwrite 00 @asma-msg-rewound "Memory 20 "overwrite 00
@asma-msg-redefined "Label 20 "redefined 00 @asma-msg-redefined "Label 20 "redefined 00
@ -892,7 +904,8 @@
&7d $2 $2 "} 00 :asma-macro-end &7d $2 $2 "} 00 :asma-macro-end
@asma-first-char-normal @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 &23 :&22 $2 "# 00 :asma-literal-hex
&24 :&23 :&25 "$ 00 :asma-pad-relative &24 :&23 :&25 "$ 00 :asma-pad-relative
&25 $2 $2 "% 00 :asma-macro-define &25 $2 $2 "% 00 :asma-macro-define
@ -905,7 +918,8 @@
&3a $2 $2 ": 00 :asma-abs-addr &3a $2 $2 ": 00 :asma-abs-addr
&3b :&3a $2 "; 00 :asma-literal-abs-addr &3b :&3a $2 "; 00 :asma-literal-abs-addr
&3d :&3b :&40 "= 00 :asma-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 &5f :&3d :&7d "_ 00 :asma-rel-addr
&7b $2 $2 "{ 00 :asma-ignore &7b $2 $2 "{ 00 :asma-ignore
&7c :&7b $2 "| 00 :asma-pad-absolute &7c :&7b $2 "| 00 :asma-pad-absolute