Skip to content

Commit

Permalink
when parsing, treat shift+space as space.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotlinski committed May 22, 2019
1 parent c48b0d8 commit 3bcb5ee
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,9 @@ Thanks to polluks for suggestions!

[Fixed]
* include, included would clobber the text input buffer.

2019-05-22: v1.6.8

[Changed]
* when parsing, treat shift+space like space. it used to
be like this but accidentally (?) changed in 1.6.0.
2 changes: 1 addition & 1 deletion docs/forth.tex
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ \section{Input}
\item[source ( -- caddr u)] Gives the address of, and number of characters in, the input buffer.
\item[source-id ( -- n )] Returns 0 if current input is keyboard, -1 if it is a string from \texttt{evaluate}, or the current file id.

\item[word ( delim -- addr )] Reads a word from input, using delimiter \texttt{delim}, and puts the string address on the stack.
\item[word ( delim -- addr )] Reads a word from input, using delimiter \texttt{delim}, and puts the string address on the stack. If the delimiter is the space character, non-breaking space (hex a0) will also be treated as a delimiter.

\item[interpret ( -- value )] Interprets a word from input and puts it on the stack.

Expand Down
18 changes: 16 additions & 2 deletions durexforth.asm
Original file line number Diff line number Diff line change
Expand Up @@ -838,14 +838,14 @@ WORD
-
jsr GET_CHAR_FROM_TIB
beq .word_end
cmp LSB, x
jsr .is_delim
beq -
jmp .append

.get_char
jsr GET_CHAR_FROM_TIB
beq .word_end
cmp LSB,x
jsr .is_delim
beq .word_end

.append
Expand All @@ -864,6 +864,20 @@ WORD
sta MSB, x
rts

.is_delim
; a == delim?
cmp LSB,x
beq + ; yes

; delim == space?
ldy LSB,x
cpy #K_SPACE
bne + ; no

; compare with nonbreaking space, too
cmp #K_SPACE | $80
+ rts

FIND_BUFFER_SIZE = 31
FIND_BUFFER
!fill FIND_BUFFER_SIZE
Expand Down

0 comments on commit 3bcb5ee

Please sign in to comment.