| ... | ... |
@@ -46,6 +46,18 @@ EOD |
| 46 | 46 |
expect_failure 'Invalid hexadecimal: #' <<'EOD' |
| 47 | 47 |
|1000 # |
| 48 | 48 |
EOD |
| 49 |
+expect_failure 'Invalid hexadecimal: #0' <<'EOD' |
|
| 50 |
+|1000 #0 |
|
| 51 |
+EOD |
|
| 52 |
+expect_failure 'Invalid hexadecimal: #000' <<'EOD' |
|
| 53 |
+|1000 #000 |
|
| 54 |
+EOD |
|
| 55 |
+expect_failure 'Unrecognised token: 0' <<'EOD' |
|
| 56 |
+|1000 0 |
|
| 57 |
+EOD |
|
| 58 |
+expect_failure 'Unrecognised token: 000' <<'EOD' |
|
| 59 |
+|1000 000 |
|
| 60 |
+EOD |
|
| 49 | 61 |
expect_failure 'Address not in zero page: .hello' <<'EOD' |
| 50 | 62 |
|1000 @hello |
| 51 | 63 |
.hello |
| ... | ... |
@@ -371,13 +371,14 @@ include projects/library/file-read-chunks.tal |
| 371 | 371 |
#57 SUB |
| 372 | 372 |
JMP2r |
| 373 | 373 |
|
| 374 |
-@asma-parse-hex-string ( -- value* 06 if valid hex and 2 < length <= 4 |
|
| 375 |
- OR value* 03 if valid hex and length <= 2 |
|
| 376 |
- OR 00 otherwise ) |
|
| 374 |
+@asma-parse-hex-string ( strict -- value* 06 if valid hex and (length == 4 or (length == 3 and not strict)) |
|
| 375 |
+ OR value* 03 if valid hex and (length == 2 or (length == 1 and not strict)) |
|
| 376 |
+ OR 00 otherwise ) |
|
| 377 |
+ STH |
|
| 377 | 378 |
;asma/token LDA2 DUP2 ,strlen JSR ( token* length^ ) |
| 379 |
+ DUP STHr AND ,&fail2 JCN |
|
| 378 | 380 |
DUP2 #0004 GTH2 ,&fail2 JCN |
| 379 | 381 |
ORAk #00 EQU ,&fail2 JCN |
| 380 |
- &resume |
|
| 381 | 382 |
#0002 GTH2 ROT ROT |
| 382 | 383 |
LIT2r 0000 |
| 383 | 384 |
|
| ... | ... |
@@ -624,7 +625,7 @@ include projects/library/heap.tal |
| 624 | 625 |
( fall through ) |
| 625 | 626 |
|
| 626 | 627 |
@asma-pad-helper ( offset* -- ) |
| 627 |
- ;asma-parse-hex-string JSR2 |
|
| 628 |
+ #00 ;asma-parse-hex-string JSR2 |
|
| 628 | 629 |
,&valid JCN |
| 629 | 630 |
|
| 630 | 631 |
;asma-msg-hex ;asma/error STA2 |
| ... | ... |
@@ -740,7 +741,7 @@ include projects/library/heap.tal |
| 740 | 741 |
JMP2r |
| 741 | 742 |
|
| 742 | 743 |
@asma-literal-hex |
| 743 |
- ;asma-parse-hex-string JSR2 JMP |
|
| 744 |
+ #01 ;asma-parse-hex-string JSR2 JMP |
|
| 744 | 745 |
( hex invalid ) ,&invalid JMP |
| 745 | 746 |
( hex byte ) ,asma-byte-helper JMP |
| 746 | 747 |
( hex short ) ,asma-short-helper JMP |
| ... | ... |
@@ -766,7 +767,7 @@ include projects/library/heap.tal |
| 766 | 767 |
;asma-write-byte JMP2 ( tail call ) |
| 767 | 768 |
|
| 768 | 769 |
¬-opcode |
| 769 |
- ;asma-parse-hex-string JSR2 JMP |
|
| 770 |
+ #01 ;asma-parse-hex-string JSR2 JMP |
|
| 770 | 771 |
( hex invalid ) ,¬-hex JMP |
| 771 | 772 |
( hex byte ) ,asma-byte-helper/raw JMP |
| 772 | 773 |
( hex short ) ,asma-short-helper/raw JMP |