Ignore leading spaces

This commit is contained in:
Joshua Bell 2019-01-09 16:23:19 -08:00
parent 737b944c06
commit afeed7db72

30
path.s
View File

@ -134,8 +134,8 @@ CASE_MASK = $DF
ptr := $06 ptr := $06
;; Check for this command, character by character. ;; Check for this command, character by character.
ldx #0 page_num9 := *+2 ; address needing updating
;; TODO: skip leading spaces jsr skip_leading_spaces
nxtchr: lda INBUF,x nxtchr: lda INBUF,x
page_num6 := *+2 ; address needing updating page_num6 := *+2 ; address needing updating
@ -176,15 +176,13 @@ nxtchr: lda INBUF,x
check_if_token: check_if_token:
;; Is a PATH set? ;; Is a PATH set?
page_num18 := *+2 ; address needing updating page_num18 := *+2 ; address needing updating
lda path_buffer lda path_buffer
beq not_ours beq not_ours
;; TODO: skip leading spaces page_num10 := *+2 ; address needing updating
jsr skip_leading_spaces
;; Ensure it's alpha page_num7 := *+2 ; address needing updating
lda INBUF
page_num7 := *+2 ; address needing updating
jsr to_upper_ascii jsr to_upper_ascii
cmp #'A' cmp #'A'
@ -226,7 +224,7 @@ next_char:
;; Otherwise, advance to next token ;; Otherwise, advance to next token
next_token: next_token:
ldx #0 ; Start next match at start of input line jsr skip_leading_spaces
sloop: lda (ptr),y ; Scan table looking for a high bit set sloop: lda (ptr),y ; Scan table looking for a high bit set
iny iny
bne :+ bne :+
@ -267,7 +265,7 @@ maybe_invoke:
sta (ptr),y sta (ptr),y
iny iny
ldx #0 jsr skip_leading_spaces
: lda INBUF,x : lda INBUF,x
and #$7F and #$7F
cmp #'.' cmp #'.'
@ -440,6 +438,18 @@ set_path:
skip: rts skip: rts
.endproc .endproc
;;; Returns with X pointing at first non-space in INBUF,
;;; and that character loaded in A.
.proc skip_leading_spaces
ldx #$FF
: inx
lda INBUF,x
cmp #' '|$80
beq :-
rts
.endproc
;;; ============================================================ ;;; ============================================================
;;; Data ;;; Data