From 7c960fd6b40065ab2b88267347e8d071bba7ed6d Mon Sep 17 00:00:00 2001 From: Paul Gardner-Stephen Date: Mon, 29 Apr 2019 22:20:02 +0930 Subject: [PATCH] implement RUN command. Show line number in errors when in program mode. --- c64/basic/cmd_run.s | 11 +++++++++++ c64/basic/cmd_unimplemented.s | 1 - c64/basic/do_basic_error.s | 12 ++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 c64/basic/cmd_run.s diff --git a/c64/basic/cmd_run.s b/c64/basic/cmd_run.s new file mode 100644 index 00000000..82749dde --- /dev/null +++ b/c64/basic/cmd_run.s @@ -0,0 +1,11 @@ +cmd_run: + ;; XXX - Parse starting line number + + ;; Reset line pointer to first line of program. + lda basic_start_of_text_ptr+0 + sta basic_current_line_ptr+0 + lda basic_start_of_text_ptr+1 + sta basic_current_line_ptr+1 + + ;; Run it! + jmp basic_execute_from_current_line diff --git a/c64/basic/cmd_unimplemented.s b/c64/basic/cmd_unimplemented.s index 2256914d..6fc2a27d 100644 --- a/c64/basic/cmd_unimplemented.s +++ b/c64/basic/cmd_unimplemented.s @@ -10,7 +10,6 @@ cmd_dim: cmd_read: cmd_let: cmd_goto: -cmd_run: cmd_if: cmd_restore: cmd_gosub: diff --git a/c64/basic/do_basic_error.s b/c64/basic/do_basic_error.s index c65e3045..60be41e1 100644 --- a/c64/basic/do_basic_error.s +++ b/c64/basic/do_basic_error.s @@ -22,6 +22,18 @@ do_basic_error: ldx #33 jsr print_packed_message + lda basic_current_line_number+1 + cmp #$ff + beq + + + ;; We were in a program, so show IN + jsr printf + .byte " IN ",0 + + lda basic_current_line_number+1 + ldx basic_current_line_number+0 + jsr print_integer +* ;; New lines lda #$0d jsr $ffd2