Re: LZ: Help with a routine
[Prev][Next][Index][Thread]
-> >> Sure. BIT is easy. All it does is compliment the bit you test
-> and
-> >> then puts that in the zero flag.
-> >> For example:
-> >> BIT 7,a
-> >> tests the MSB of the accumulator. If the bit is 1, then the zero
-> >> flag is cleared, indicating "not zero". (Right?) If the bit is
-> 0,
-> >> then the zero flag is set, indicating "zero".
-> >>
-> >> Got that? ;)
-> >> --------
-> >> >I need to know how to use the BIT opcode... the
-> >> >specific routine requires me to test the MSB (first
-> >> >bit) of a byte and branch if it is 1. Can someone
-> >> >please fill me in?
-> >>
-> >> ____
-> >> ~Keith
-> >> FFNP69C@PRODIGY.COM
-> >>
-> >
-> >Actually, I think that if the bit is set, it will set the ZERO
-> >flag, but if it is cleared, then it will clear the Z flag
-> (indicating
-> >nz).
-> No, because if the zf is set, it indicates a zero result.
-> If a bit is set, it is not zero, so the zf is cleared... Wait a
-> minute. Why argue? Does anyone have a Z80 book that could check
-> this out?
The book that I have says: "BIT sets the zero flag to the condition of
the bit" so there you go, if the bit is set it sets ZF to 1 else to 0
References: