bugfix: bit r8, n
should return true when bit n is zero
This commit is contained in:
parent
dff0df87e9
commit
14cbfd4112
@ -687,9 +687,9 @@ mod instructions {
|
||||
*self.flags_mut() = Flags::new().with_z(value == 0).with_c(value & 1 > 0);
|
||||
Ok(())
|
||||
}
|
||||
/// Tests whether the given bit of r8 is set
|
||||
/// Tests whether the given bit of r8 is zero
|
||||
pub fn bit(&mut self, reg: R8, bit: u8, bus: &impl BusIO) -> Result<(), Error> {
|
||||
let value = self.get_r8(reg, bus) & (1 << bit) == 1;
|
||||
let value = self.get_r8(reg, bus) & (1 << bit) == 0;
|
||||
self.set_z(value).set_n(false).set_h(true);
|
||||
Ok(())
|
||||
}
|
||||
@ -699,6 +699,7 @@ mod instructions {
|
||||
self.set_r8(reg, value & !(1 << bit), bus);
|
||||
Ok(())
|
||||
}
|
||||
/// Sets the given bit of the given register to 1
|
||||
pub fn set(&mut self, reg: R8, bit: u8, bus: &mut impl BusIO) -> Result<(), Error> {
|
||||
let value = self.get_r8(reg, bus);
|
||||
self.set_r8(reg, value | 1 << bit, bus);
|
||||
|
Loading…
Reference in New Issue
Block a user