Don't require CLC, fix BELL, handle spaces in ECHO

This commit is contained in:
Joshua Bell 2019-01-09 16:09:58 -08:00
parent cea9223d47
commit 737b944c06
4 changed files with 34 additions and 15 deletions

View File

@ -1,11 +1,9 @@
.include "apple2.inc" .include "apple2.inc"
BELL := $FBE4 BELL := $FF3A
.org $4000 .org $4000
ldy #0
jsr BELL jsr BELL
clc
rts rts

View File

@ -8,25 +8,46 @@ INBUF := $200
.org $4000 .org $4000
jsr CROUT jsr CROUT
ldx #0
ldx #cmd_length-1 ;; Skip any leading spaces
jsr skip_spaces
;; Skip spaces ;; Invoked with "-" ?
: inx
lda INBUF,x lda INBUF,x
cmp #' ' | $80 cmp #'-'|$80
beq :- bne :+
dex 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 ;; Echo string
: inx : lda INBUF,x
lda INBUF,x
jsr COUT jsr COUT
cmp #$D | $80 cmp #$D | $80
bne :- beq exit
inx
jmp :-
clc exit: rts
.proc skip_spaces
lda INBUF,x
cmp #' '|$80
beq :+
rts rts
: inx
jmp skip_spaces
.endproc
cmd_length = .strlen("echo") cmd_length = .strlen("echo")

View File

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

1
path.s
View File

@ -373,6 +373,7 @@ fail_gfi:
;; Invoke command ;; Invoke command
jsr cmd_load_addr jsr cmd_load_addr
clc ; success
rts ; Return to BASIC.SYSTEM rts ; Return to BASIC.SYSTEM
fail_load: fail_load: