Don't require CLC, fix BELL, handle spaces in ECHO
This commit is contained in:
parent
cea9223d47
commit
737b944c06
|
@ -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
|
||||||
|
|
43
echo.cmd.s
43
echo.cmd.s
|
@ -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")
|
|
@ -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
|
Loading…
Reference in New Issue