fix leading spaces (again); squeeze bytes

This commit is contained in:
Joshua Bell 2019-01-09 17:33:33 -08:00
parent 0d6f42d22f
commit 5d56dd1e2a

30
path.s
View File

@ -141,19 +141,22 @@ CASE_MASK = $DF
page_num9 := *+2 ; address needing updating page_num9 := *+2 ; address needing updating
jsr skip_leading_spaces jsr skip_leading_spaces
ldy #0 ; position in command string
page_num6 := *+2 ; address needing updating page_num6 := *+2 ; address needing updating
nxtchr: jsr to_upper_ascii nxtchr: jsr to_upper_ascii
page_num1 := *+2 ; address needing updating page_num1 := *+2 ; address needing updating
cmp command_string,x cmp command_string,y
bne check_if_token bne check_if_token
inx inx
cpx #command_length iny
cpy #command_length
bne nxtchr bne nxtchr
;; A match - indicate end of command string for BI's parser. ;; A match - indicate end of command string for BI's parser.
lda #command_length-1 dey
sta XLEN sty XLEN
;; Point BI's parser at the command execution routine. ;; Point BI's parser at the command execution routine.
lda #<execute lda #<execute
@ -309,13 +312,18 @@ fail_gfi:
sta XCNUM sta XCNUM
sta PBITS sta PBITS
sta PBITS+1 sta PBITS+1
lda #$FF ; TODO: Signal how much of input was consumed (all?)
sta XLEN
lda #<XRETURN lda #<XRETURN
sta XTRNADDR sta XTRNADDR
lda #>XRETURN lda #>XRETURN
sta XTRNADDR+1 sta XTRNADDR+1
;; MLI/BI trashes part of INBUF, so stash it in upper half.
ldx #$7F
: lda INBUF,x
sta INBUF+$80,x
dex
bpl :-
;; Reserve buffer for I/O ;; Reserve buffer for I/O
lda #4 lda #4
jsr GETBUFR jsr GETBUFR
@ -341,21 +349,13 @@ fail_gfi:
lda #>max_cmd_size lda #>max_cmd_size
sta RWCOUNT+1 sta RWCOUNT+1
MLI_CALL READ, SREAD MLI_CALL READ, SREAD
bne fail_load bne fail_load
;; CLOSE call trashes lower bytes of INBUF, so stash it.
ldx #$7F
: lda INBUF,x
sta INBUF+$80,x
dex
bpl :-
MLI_CALL CLOSE, SCLOSE MLI_CALL CLOSE, SCLOSE
jsr FREEBUFR jsr FREEBUFR
;; Restore it. ;; Restore INBUF now that MLI/BI work is done.
ldx #$7F ldx #$7F
: lda INBUF+$80,x : lda INBUF+$80,x
sta INBUF,x sta INBUF,x