mirror of
https://github.com/mre/mos6502.git
synced 2024-12-22 12:29:31 +00:00
Add and_test().
This commit is contained in:
parent
6807b78a83
commit
5e0d151f12
@ -628,6 +628,35 @@ fn add_with_carry_test() {
|
||||
assert_eq!(machine.registers.status.contains(PS_OVERFLOW), true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn and_test() {
|
||||
let mut machine = Machine::new();
|
||||
|
||||
machine.registers.accumulator = 0;
|
||||
machine.and(0xff);
|
||||
assert_eq!(machine.registers.accumulator, 0);
|
||||
assert_eq!(machine.registers.status.contains(PS_ZERO), true);
|
||||
assert_eq!(machine.registers.status.contains(PS_NEGATIVE), false);
|
||||
|
||||
machine.registers.accumulator = 0xff;
|
||||
machine.and(0);
|
||||
assert_eq!(machine.registers.accumulator, 0);
|
||||
assert_eq!(machine.registers.status.contains(PS_ZERO), true);
|
||||
assert_eq!(machine.registers.status.contains(PS_NEGATIVE), false);
|
||||
|
||||
machine.registers.accumulator = 0xff;
|
||||
machine.and(0x0f);
|
||||
assert_eq!(machine.registers.accumulator, 0x0f);
|
||||
assert_eq!(machine.registers.status.contains(PS_ZERO), false);
|
||||
assert_eq!(machine.registers.status.contains(PS_NEGATIVE), false);
|
||||
|
||||
machine.registers.accumulator = 0xff;
|
||||
machine.and(0xf0);
|
||||
assert_eq!(machine.registers.accumulator, 0xf0);
|
||||
assert_eq!(machine.registers.status.contains(PS_ZERO), false);
|
||||
assert_eq!(machine.registers.status.contains(PS_NEGATIVE), true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn subtract_with_carry_test() {
|
||||
let mut machine = Machine::new();
|
||||
|
Loading…
Reference in New Issue
Block a user