Re: A82: bit n,a


[Prev][Next][Index][Thread]

Re: A82: bit n,a




At 03:04 PM 6/16/98 -0400, you wrote:
>What does the command:
>bit [number],[var] 
>do?  I'm thinking it is similar to compare.

It tests a single bit of a variable.  Here's how it works:

bit 0,a

This will test bit 0 of the contents in the a register.  A single register
looks like this (bitwise):

76543210  <-- bit 0!!!

Bit 0 is the far right bit.  The zero flag = bit.  So, if bit 0 of register
a is 0, the zero flag will be zero (z)...otherwise it will be not zero
(nz).  NOTE:  If you can destroy whatever register you are testing, it is
MUCH faster to use and %00000001 which does the same thing as bit 0,a.


                 Thomas J. Hruska -- thruska@tir.com
Shining Light Productions -- "Meeting the needs of fellow programmers"
         http://www.geocities.com/SiliconValley/Heights/8504
                    http://shinelight.home.ml.org


References: