1
0
mirror of https://github.com/mre/mos6502.git synced 2024-11-28 07:49:19 +00:00

Fix and_test().

This commit is contained in:
Andrew Keeton 2014-11-06 19:13:42 -05:00
parent 413d063f82
commit 198ddc3131

View File

@ -638,26 +638,26 @@ fn and_test() {
let mut machine = Machine::new(); let mut machine = Machine::new();
machine.registers.accumulator = 0; machine.registers.accumulator = 0;
machine.and(0xff); machine.and(-1);
assert_eq!(machine.registers.accumulator, 0); assert_eq!(machine.registers.accumulator, 0);
assert_eq!(machine.registers.status.contains(PS_ZERO), true); assert_eq!(machine.registers.status.contains(PS_ZERO), true);
assert_eq!(machine.registers.status.contains(PS_NEGATIVE), false); assert_eq!(machine.registers.status.contains(PS_NEGATIVE), false);
machine.registers.accumulator = 0xff; machine.registers.accumulator = -1;
machine.and(0); machine.and(0);
assert_eq!(machine.registers.accumulator, 0); assert_eq!(machine.registers.accumulator, 0);
assert_eq!(machine.registers.status.contains(PS_ZERO), true); assert_eq!(machine.registers.status.contains(PS_ZERO), true);
assert_eq!(machine.registers.status.contains(PS_NEGATIVE), false); assert_eq!(machine.registers.status.contains(PS_NEGATIVE), false);
machine.registers.accumulator = 0xff; machine.registers.accumulator = -1;
machine.and(0x0f); machine.and(0x0f);
assert_eq!(machine.registers.accumulator, 0x0f); assert_eq!(machine.registers.accumulator, 0x0f);
assert_eq!(machine.registers.status.contains(PS_ZERO), false); assert_eq!(machine.registers.status.contains(PS_ZERO), false);
assert_eq!(machine.registers.status.contains(PS_NEGATIVE), false); assert_eq!(machine.registers.status.contains(PS_NEGATIVE), false);
machine.registers.accumulator = 0xff; machine.registers.accumulator = -1;
machine.and(0xf0); machine.and(-128);
assert_eq!(machine.registers.accumulator, 0xf0); assert_eq!(machine.registers.accumulator, -128);
assert_eq!(machine.registers.status.contains(PS_ZERO), false); assert_eq!(machine.registers.status.contains(PS_ZERO), false);
assert_eq!(machine.registers.status.contains(PS_NEGATIVE), true); assert_eq!(machine.registers.status.contains(PS_NEGATIVE), true);
} }