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"
BELL := $FBE4
BELL := $FF3A
.org $4000
ldy #0
jsr BELL
clc
rts

View File

@ -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")

View File

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

1
path.s
View File

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