mirror of
https://github.com/mre/mos6502.git
synced 2024-12-01 11:51:51 +00:00
Fix and_test().
This commit is contained in:
parent
413d063f82
commit
198ddc3131
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user