allow multiple statements on single line. Issue #14
This commit is contained in:
1 parent
3a58c781c7
commit
b15ddafa6a
3 files changed
+39
-2
No files matched your search
@@ -1,3 +1,23 @@
|
|||||||
|
;; 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.
|
;; Go through the line until its end is reached.
|
||||||
;; If we reach the end are in direct mode, then
|
;; If we reach the end are in direct mode, then
|
||||||
;; go back to reading input, else look for the
|
;; go back to reading input, else look for the
|
||||||
@@ -26,6 +46,10 @@ basic_execute_line:
|
|||||||
pha
|
pha
|
||||||
lda basic_command_jump_table+0,x
|
lda basic_command_jump_table+0,x
|
||||||
pha
|
pha
|
||||||
|
|
||||||
|
;; Now consume the character
|
||||||
|
jsr basic_consume_character
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
not_a_token:
|
not_a_token:
|
||||||
@@ -46,11 +70,16 @@ not_a_token:
|
|||||||
jmp basic_main_loop
|
jmp basic_main_loop
|
||||||
|
|
||||||
basic_skip_char:
|
basic_skip_char:
|
||||||
|
jsr basic_consume_character
|
||||||
|
jmp basic_execute_line
|
||||||
|
|
||||||
|
basic_consume_character:
|
||||||
;; Advance basic text pointer
|
;; Advance basic text pointer
|
||||||
inc basic_current_statement_ptr+0
|
inc basic_current_statement_ptr+0
|
||||||
bne +
|
bne +
|
||||||
inc basic_current_statement_ptr+1
|
inc basic_current_statement_ptr+1
|
||||||
* jmp basic_execute_line
|
*
|
||||||
|
rts
|
||||||
|
|
||||||
basic_end_of_line:
|
basic_end_of_line:
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ list_loop:
|
|||||||
jsr peek_pointer_null_check
|
jsr peek_pointer_null_check
|
||||||
bcs list_more_lines
|
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
|
jmp basic_main_loop
|
||||||
|
|
||||||
list_more_lines:
|
list_more_lines:
|
||||||
|
|||||||
+6
-1
@@ -1,11 +1,16 @@
|
|||||||
|
|
||||||
cmd_new:
|
cmd_new:
|
||||||
jsr basic_do_new
|
jsr basic_do_new
|
||||||
|
|
||||||
|
;; NEW command terminates execution
|
||||||
|
;; (Confirmed on a C64)
|
||||||
jmp basic_main_loop
|
jmp basic_main_loop
|
||||||
|
|
||||||
cmd_clr:
|
cmd_clr:
|
||||||
jsr basic_do_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:
|
basic_do_new:
|
||||||
;; Setup pointers to memory storage
|
;; Setup pointers to memory storage
|
||||||
|
|||||||
Reference in new issue
Block a user