mirror of
https://github.com/a2stuff/prodos-path.git
synced 2025-01-14 09:30:38 +00:00
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"
|
||||
|
||||
BELL := $FBE4
|
||||
BELL := $FF3A
|
||||
|
||||
.org $4000
|
||||
|
||||
ldy #0
|
||||
jsr BELL
|
||||
clc
|
||||
rts
|
||||
|
43
echo.cmd.s
43
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")
|
@ -16,7 +16,6 @@ COUT := $FDED
|
||||
jmp :-
|
||||
|
||||
done: jsr CROUT
|
||||
clc
|
||||
rts
|
||||
|
||||
str: .byte "Hello, world!", 0
|
Loading…
x
Reference in New Issue
Block a user