[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Apple II Random Events?
David wrote:
>The simplest use of the third parameter is to test for a flag bit
>becoming zero rather than one. For example, you could wait for paddle
>button 0 (the OpenApple key) to be released using WAIT -16287,128,128.
>
>This means "PEEK location -16287, XOR the result with 128, AND the
>subsequent result with 128, and stop waiting if the result is not zero.
>Rinse and repeat until then."
>
>
>I will now check the Applesoft reference manual to confirm my
>description. [Ruffling through bookshelf.]
>
>Yep.
>
>The Applesoft reference describes the third argument as the value to be
>tested for, except that it is complemented: 1 where you want the
>corresponding bit in the memory location to be 0, and vice versa. Only
>bits listed in the second argument are significant. An easy way to
>complement an 8-bit value is to subtract it from 255.
>
>If you wanted to wait for a specific character to be pressed, _and_ you
>weren't on a IIgs (keyboard buffering would kill this), then you could
>use WAIT -16384,255,255-160.
David, you are almost _always_ right, but this is
the rare exception. ;-)
There is no way to use WAIT to wait for a particular
multi-bit value, since _any_ one bit in the result is
sufficient to satisfy the condition. If all bits are on
in the "and" mask (255), then any bit in the tested
location which is _unequal_ to the corresponding
bit in the "eor" value will terminate the WAIT.
So you can wait until a value is _unequal_ to
some specified value, but not until it is _equal_
(except in the special case of testing only one bit).
Cheers,
-michael
Email: mjmahon@aol.com
Home page: http://members.aol.com/MJMahon/