begin implementing framework for interpreting BASIC statements.

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-28 21:50:52 +09:30
1 parent 3ab4f385ac
commit 249266232c
3 files changed
+42 -3

No files matched your search

+5
View File
@@ -25,7 +25,12 @@
.alias basic_start_of_free_space_ptr $31
.alias basic_start_of_strings_ptr $33
.alias basic_top_of_memory_ptr $37
.alias basic_current_line_number $39
.alias basic_current_line_ptr $3d
;; Note that the statement point is in the CHRGET/CHRGOT routine
;; in ZP RAM. (Compute's Mapping the 64, p25)
.alias basic_current_statement_ptr $7a
.alias basic_numeric_work_area $57 ; $57 - $60 inclusive = 10 bytes
+11
View File
@@ -0,0 +1,11 @@
;; Go through the line until its end is reached.
;; If we reach the end are in direct mode, then
;; go back to reading input, else look for the
;; next line, and advance to that, or else
;; return to READY prompt because we have run out
;; of program.
basic_execute_line:
jmp basic_main_loop
+26 -3
View File
@@ -54,6 +54,11 @@ rsl_l1: lda $0200,x
lda #$0d
jsr $ffd2
;; Ignore empty lines
lda tokenise_work1
beq basic_read_next_line
;; Else, tokenise the line
jsr tokenise_line
;; Has the user entered a line of BASIC beginning with a number?
@@ -135,6 +140,24 @@ skip_spaces:
not_a_line:
;; XXX - Actually interpret the line
jmp basic_main_loop
;; Actually interpret the line
;; Setup pointer to the statement
lda #<$0200
sta basic_current_statement_ptr+0
lda #>$0200
sta basic_current_statement_ptr+1
;; There is no stored line, so zero that pointer out
lda #$00
sta basic_current_line_ptr+0
sta basic_current_line_ptr+1
;; Put invalid line number in current line number value,
;; so that we know we are in direct mode
;; (Compute's Mapping the 64 p19)
lda #$ff
sta basic_current_line_number+1
jmp basic_execute_line