changeset 43:b27b34d0afff

Fix line number parsing to actually handle first character It turns out that if you clobber the first character of your input line number, you don't end up with a correct result when parsing.
author William Astle <lost@l-w.ca>
date Fri, 09 Dec 2022 22:00:17 -0700
parents 1f74c2df443f
children c04068c37316
files src/lwbasic.s
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lwbasic.s	Fri Dec 09 21:34:31 2022 -0700
+++ b/src/lwbasic.s	Fri Dec 09 22:00:17 2022 -0700
@@ -1137,9 +1137,10 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; Parse a line number and return it in binval; raise syntax error if the line number overflows 16 bits unsigned.
 ; Preserves; registers except D. This will accept the entire 16 bit unsigned number range which is why there is
-; a BCS after every shift or add. Enter with the first character in A with C set for digits and clear otherwise.
+; a BCS after every shift or add. Enter with the input pointer pointing to the number to parse.
 parse_lineno    ldd zero                        ; clear out accumlator but preserve carry flag
                 std binval
+                jsr curchar                     ; set flags on current character; skip spaces
                 bcc parse_lineno1               ; brif first character wasn't a digit - default to zero
 parse_lineno0   suba #0x30                      ; adjust to binary digit
                 pshs a                          ; save digit so we can add it later