Preserve INBUF

This commit is contained in:
Joshua Bell 2019-01-08 22:55:06 -08:00
parent 76178cf0a8
commit 92228cef9e
4 changed files with 29 additions and 7 deletions

View File

@ -7,4 +7,5 @@ BELL := $FBE4
ldy #0
jsr BELL
clc
rts

View File

@ -9,13 +9,23 @@ INBUF := $200
jsr CROUT
ldx #cmd_length
: lda INBUF,x
inx
ldx #cmd_length-1
;; Skip spaces
: inx
lda INBUF,x
cmp #' ' | $80
beq :-
dex
;; Echo string
: inx
lda INBUF,x
jsr COUT
cmp #$8D
cmp #$D | $80
bne :-
clc
rts

View File

@ -16,6 +16,7 @@ COUT := $FDED
jmp :-
done: jsr CROUT
clc
rts
str: .byte "Hello, world!", 0

16
path.s
View File

@ -340,7 +340,6 @@ fail_gfi:
sta RWREFNUM
sta CFREFNUM
lda #<cmd_load_addr
sta RWDATA
lda #>cmd_load_addr
@ -354,15 +353,26 @@ fail_gfi:
MLI_CALL READ, SREAD
bne fail_load
;; CLOSE call trashes INBUF ????
;; 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
jsr FREEBUFR
;; Restore it.
ldx #$7F
: lda INBUF+$80,x
sta INBUF,x
dex
bpl :-
;; Invoke command
jsr cmd_load_addr
clc ; Success
rts ; Return to BASIC.SYSTEM
fail_load: