From 92228cef9e0b081c37ff677a5db8ec73ceafcc7e Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 8 Jan 2019 22:55:06 -0800 Subject: [PATCH] Preserve INBUF --- bell.cmd.s | 1 + echo.cmd.s | 18 ++++++++++++++---- hello.cmd.s | 1 + path.s | 16 +++++++++++++--- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/bell.cmd.s b/bell.cmd.s index fbdc5bc..aa04cb4 100644 --- a/bell.cmd.s +++ b/bell.cmd.s @@ -7,4 +7,5 @@ BELL := $FBE4 ldy #0 jsr BELL + clc rts diff --git a/echo.cmd.s b/echo.cmd.s index 6a7051b..687f1f5 100644 --- a/echo.cmd.s +++ b/echo.cmd.s @@ -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 diff --git a/hello.cmd.s b/hello.cmd.s index 18206a1..1b7edc0 100644 --- a/hello.cmd.s +++ b/hello.cmd.s @@ -16,6 +16,7 @@ COUT := $FDED jmp :- done: jsr CROUT + clc rts str: .byte "Hello, world!", 0 \ No newline at end of file diff --git a/path.s b/path.s index c01ecd1..4b9af22 100644 --- a/path.s +++ b/path.s @@ -340,7 +340,6 @@ fail_gfi: sta RWREFNUM sta CFREFNUM - 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: