From 3bcb5ee6c99ef4d884631405cf2339b50f5337a5 Mon Sep 17 00:00:00 2001 From: Johan Kotlinski Date: Wed, 22 May 2019 21:29:37 +0200 Subject: [PATCH] when parsing, treat shift+space as space. --- CHANGELOG | 6 ++++++ docs/forth.tex | 2 +- durexforth.asm | 18 ++++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 301b33145..68f102962 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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. diff --git a/docs/forth.tex b/docs/forth.tex index f678595f0..a464ae313 100755 --- a/docs/forth.tex +++ b/docs/forth.tex @@ -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. diff --git a/durexforth.asm b/durexforth.asm index 836b575a2..c47938de6 100755 --- a/durexforth.asm +++ b/durexforth.asm @@ -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 @@ -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