allow multiple statements on single line. Issue #14

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-29 22:05:27 +09:30
1 parent 3a58c781c7
commit b15ddafa6a
3 files changed
+40 -3

No files matched your search

+31 -2
View File
@@ -1,10 +1,30 @@
;; Jump back into the BASIC execute line loop
;; after first checking that we have a colon
;; or $00 char
basic_run_next_statement:
ldx #<basic_current_statement_ptr
ldy #0
jsr peek_under_roms
cmp #$00
beq +
cmp #$3a
beq +
;; Nope, so SYNTAX ERROR it is!
ldx #10
jmp do_basic_error
*
;; 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:
;; Get next char of program text, even if it is hiding under a ROM or the
@@ -26,6 +46,10 @@ basic_execute_line:
pha
lda basic_command_jump_table+0,x
pha
;; Now consume the character
jsr basic_consume_character
rts
not_a_token:
@@ -46,11 +70,16 @@ not_a_token:
jmp basic_main_loop
basic_skip_char:
jsr basic_consume_character
jmp basic_execute_line
basic_consume_character:
;; Advance basic text pointer
inc basic_current_statement_ptr+0
bne +
inc basic_current_statement_ptr+1
* jmp basic_execute_line
*
rts
basic_end_of_line:
+3
View File
@@ -15,6 +15,9 @@ list_loop:
jsr peek_pointer_null_check
bcs list_more_lines
;; LIST terminates any running program,
;; because it has fiddled with the current line pointer.
;; (Confirmed by testing on a C64)
jmp basic_main_loop
list_more_lines:
+6 -1
View File
@@ -1,11 +1,16 @@
cmd_new:
jsr basic_do_new
;; NEW command terminates execution
;; (Confirmed on a C64)
jmp basic_main_loop
cmd_clr:
jsr basic_do_clr
jmp basic_main_loop
;; CLR command does not stop execution
;; (Cconfirmed on a c64)
jmp basic_run_next_statement
basic_do_new:
;; Setup pointers to memory storage