Command line parsing fixes.

This commit is contained in:
Bobbi Webber-Manners 2021-08-04 11:17:40 -04:00
parent 22a33d9673
commit 0ed16ad952
2 changed files with 18 additions and 9 deletions

Binary file not shown.

View File

@ -1274,6 +1274,8 @@ STRCMP LDY #$00
BEQ :MATCH
CMP #' '
BEQ :MATCH
CMP #'"'
BEQ :MATCH
BRA :MISMTCH
:MATCH CLC
RTS
@ -1360,29 +1362,36 @@ PRONEENT TAX
:S2 JSR OSNEWL
:EXIT RTS
* Consume spaces in command line
* Consume spaces in command line. Treat " as space!
* Return C set if no space found, C clear otherwise
* Command line pointer in (ZP1),Y
EATSPC LDA (ZP1),Y ; Check first char is space
CMP #' '
BNE :NOTFND
INY
:L1 LDA (ZP1),Y ; Eat any additional spaces
CMP #' '
EATSPC LDA (ZP1),Y ; Check first char is ...
CMP #' ' ; ... space
BEQ :START
CMP #'"' ; Or quote mark
BEQ :START
BRA :NOTFND
:START INY
:L1 LDA (ZP1),Y ; Eat any additional ...
CMP #' ' ; ... spaces
BEQ :CONT
CMP #'"' ; Or quote marks
BNE :DONE
INY
:CONT INY
BRA :L1
:DONE CLC
RTS
:NOTFND SEC
RTS
* Consume non-spaces in command line
* Consume chars in command line until space or " is found
* Command line pointer in (ZP1),Y
* Returns with carry set if EOL
EATWORD LDA (ZP1),Y
CMP #' '
BEQ :SPC
CMP #'"'
BEQ :SPC
CMP #$0D ; Carriage return
BEQ :EOL
INY