Re: picforth conditionals
Samuel Tardieu <[email protected]> Tue, 09 Mar 2004 19:26:41 +0100
| Newsgroups | gmane.comp.lang.forth.picforth |
|---|---|
| Organization | Avian Carrier & Friends |
| Message-ID | <[email protected]> |
>>>>> "Jamie" == Jamie Lawson <[email protected]> writes: Jamie> I am just starting to use Forth and in particular picforth-0.29 Jamie> and was wondering why the following statement does not seem to Jamie> work. Jamie> I'm waiting for a pin (sDATA) to go low or SW_Timer0 to reach Jamie> zero. Jamie> \***************************** Jamie> 1 pin-b sDATA variable SW_Timer0 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 -- [email protected] -- http://www.rfc1149.net/sam