Hello Artur,

I think you are pointing to "within" not working as you expect.

 > ver
amforth 4.6 ATmega328P ok
 > 0 0 10 within .
-1  ok
 > -1 0 10 within .
0  ok
 > 9 0 10 within .
-1  ok
 > 10 0 10 within .
-1  ok

Looking into Conklin, Rather -- Forth Programmer's Handbook 
(3rd. Edition) p.59:

WITHIN ( x1 x2 x3 -- flag )
return true if x1 is greater than or equal to x2 AND less than 
x3. ...

So x3 is excluded in the "true" case. As you can see above,
"within" in amforth includes x3. Now, someone needs to check
"The Standard". :-)

Thanks for pointing this out.

Cheers,
Erich

On 09/10/2012 04:31 PM, Arthur Ivanov wrote:
> Hi !
>
> I think I see a bug in your AmForth v4.9.
> In file ..\core\words\to-lower.asm I see
>
> ; ( C --  c) ; String
> ; if C is an uppercase letter convert it to lowercase
> VE_TOLOWER:
>       .dw $ff07
>       .db "tolower",0
>       .dw VE_HEAD
>       .set VE_HEAD = VE_TOLOWER
> XT_TOLOWER:
>       .dw DO_COLON
> PFA_TOLOWER:
>       .dw XT_DUP
>       .dw XT_DOLITERAL
>       .dw 'A'
>       .dw XT_DOLITERAL
>       .dw 'Z'
>       .dw XT_WITHIN
>       .dw XT_DOCONDBRANCH
>       .dw PFA_TOLOWER0
>       .dw XT_DOLITERAL
>       .dw $20
>       .dw XT_OR PFA_TOLOWER0:
>       .dw XT_EXIT
>
> This will not convert Z chat to lower case.
> To fix you have to replace the string
>       .dw 'Z'
> by the string
>       .dw 'Z'+1
>
>                             Ethereal
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to