diff --git a/bell.cmd.s b/bell.cmd.s index aa04cb4..44c2e0a 100644 --- a/bell.cmd.s +++ b/bell.cmd.s @@ -1,11 +1,9 @@ .include "apple2.inc" -BELL := $FBE4 +BELL := $FF3A .org $4000 - ldy #0 jsr BELL - clc rts diff --git a/echo.cmd.s b/echo.cmd.s index 687f1f5..9bddb55 100644 --- a/echo.cmd.s +++ b/echo.cmd.s @@ -8,25 +8,46 @@ INBUF := $200 .org $4000 jsr CROUT + ldx #0 - ldx #cmd_length-1 + ;; Skip any leading spaces + jsr skip_spaces - ;; Skip spaces -: inx + ;; Invoked with "-" ? lda INBUF,x - cmp #' ' | $80 - beq :- - dex + cmp #'-'|$80 + bne :+ + inx +: + ;; Skip any more leading spaces + jsr skip_spaces + + ;; Skip command name (i.e. "echo") + txa + clc + adc #cmd_length + tax + + ;; Skip leading spaces before string to echo + jsr skip_spaces ;; Echo string -: inx - lda INBUF,x +: lda INBUF,x jsr COUT cmp #$D | $80 - bne :- + beq exit + inx + jmp :- - clc +exit: rts + +.proc skip_spaces + lda INBUF,x + cmp #' '|$80 + beq :+ rts - +: inx + jmp skip_spaces +.endproc cmd_length = .strlen("echo") \ No newline at end of file diff --git a/hello.cmd.s b/hello.cmd.s index 1b7edc0..18206a1 100644 --- a/hello.cmd.s +++ b/hello.cmd.s @@ -16,7 +16,6 @@ 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 4b9af22..9af092e 100644 --- a/path.s +++ b/path.s @@ -373,6 +373,7 @@ fail_gfi: ;; Invoke command jsr cmd_load_addr + clc ; success rts ; Return to BASIC.SYSTEM fail_load: