make injest_number work from current basic statement pointer

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-29 22:25:03 +09:30
1 parent 7c960fd6b4
commit 3bdfa8f834
2 files changed
+20 -11

No files matched your search

+10 -1
View File
@@ -78,9 +78,18 @@ rsl_l1: lda $0200,x
sta tokenise_work2
lda #$00
sta tokenise_work1
;; Try to read linne number
lda #<$0200
sta basic_current_statement_ptr+0
lda #>$0200
sta basic_current_statement_ptr+1
jsr injest_number
;; Copy offset of first position after number back out
lda basic_current_statement_ptr+0
sta tokenise_work1
;; Check if the number is a valid line number
;; i.e., 16 bits, no exponent, no decimal
lda basic_fac1_mantissa+2
+10 -10
View File
@@ -1,6 +1,6 @@
;; Parse a number from the input buffer at $0200+tokenise_work1
;; Parse a number from the input buffer at (basic_current_statement_ptr)
;; Result is put into FAC1.
;; tokenise_work1 is updated with first position after the number.
;; basic_current_statement_ptr is updated with first position after the number.
;; XXX - Remember decimal position and exponent, and apply them
;; after to produce normalised floating point number.
@@ -51,8 +51,8 @@ injest_number:
;; Check if leading char is a - sign
;; Note: the - will have been tokenised to $AB
;; XXX - implement
ldx tokenise_work1
lda $0200,x
ldy #$00
lda (basic_current_statement_ptr),y
cmp #$AB
bne ij_not_minus
@@ -63,9 +63,9 @@ injest_number:
ij_not_minus:
ij_loop1:
ldx tokenise_work1
lda $0200,x
ij_loop1:
ldy #$00
lda (basic_current_statement_ptr),y
cmp #$30
bcc ij_not_a_digit
cmp #$39
@@ -102,8 +102,8 @@ ij_accept_precision:
bne ij_consider_next_digit
;; Get digit
ldx tokenise_work1
lda $0200,x
ldy #$00
lda (basic_current_statement_ptr),y
sec
sbc #$30
@@ -131,7 +131,7 @@ ij_loop2:
ij_consider_next_digit:
;; Consider next digit
inc tokenise_work1
jsr basic_consume_character
jmp ij_loop1
rts