[PicForth] Re: picforth conditionals
Jamie Lawson
jlawson at ces.uoguelph.ca
Wed Mar 10 16:24:34 CET 2004
> Jamie> begin sDATA bit-set? SW_Timer0 @ 0 <> and while repeat
>
> Jamie> \***************************
>
> You may have hit a bug.
>
> I haven't looked at the generated code yet, but I am sure that the
> following will be more efficient: (speed and code space)
>
> : waitforcond ( -- )
> begin
> sDATA bit-clr? if exit then
> SW_Timer0 0= if exit then
> again;
>
> This has the advantage of not requiring a boolean normalization --
> status bits can be used directly, as in your example a normalization
> to 0 or $FF is needed in order to perform the "and" operation.
>
> Sam
> --
> Samuel Tardieu -- sam at rfc1149.net -- http://www.rfc1149.net/sam
Yes, thanks, that works and looks much cleaner. It even saved 16 words of
program memory.
I am using a slightly modified version of picforth-0.29. I am using it
with a 16f88 (very close to a 16f876). The changes consist of a few
register additions/deletions and the addition of a second configuration
word.
You are welcome to look at these changes, but as I mentioned, I am just
beginning with Forth. It would be nice to be able to select a processor
from the applications source code.
Jamie
More information about the PicForth
mailing list