From 7831441cac9c8ec3b7579e4279eb97f810983b08 Mon Sep 17 00:00:00 2001 From: Paul Gardner-Stephen Date: Sat, 27 Apr 2019 22:09:56 +0930 Subject: [PATCH] strip leading spaces from received line before tokenising --- c64/basic/basic_main_loop.s | 22 ++++++++++++++++++++-- c64/basic/tokenise_line.s | 1 - 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/c64/basic/basic_main_loop.s b/c64/basic/basic_main_loop.s index 825a03ba..52b12522 100644 --- a/c64/basic/basic_main_loop.s +++ b/c64/basic/basic_main_loop.s @@ -27,12 +27,30 @@ got_line_of_input: ;; Store length of input buffer ready for tokenising stx tokenise_work1 - + + ;; Strip leading spaces from the line +remove_leading_spaces: + lda $0200 + cmp #$20 + bne + + ldx #1 +rsl_l1: lda $0200,x + sta $01ff,x + inx + cpx tokenise_work1 + bne rsl_l1 + + ;; Reduce length of input by one + dec tokenise_work1 + ;; Stop trying to rim if we run out of input + bne remove_leading_spaces +* + ;; Do printing of the new line lda #$0d jsr $ffd2 - jsr tokenise_line + jsr tokenise_line jsr ready_message diff --git a/c64/basic/tokenise_line.s b/c64/basic/tokenise_line.s index 27c89e1b..05deaf4d 100644 --- a/c64/basic/tokenise_line.s +++ b/c64/basic/tokenise_line.s @@ -235,7 +235,6 @@ word_boundary: inc $d020 ldy #$80 - stx $0427 token_count_loop: lda packed_keywords,x cmp #$fe