1
0
mirror of https://github.com/mre/mos6502.git synced 2024-06-13 00:29:33 +00:00

zeropage wraparound test

This commit is contained in:
Sam M W 2022-10-18 13:35:17 +01:00
parent 89d6e66e11
commit 5290a9d61e

View File

@ -768,3 +768,20 @@ pub static OPCODES: [Option<(Instruction, AddressingMode)>; 256] = [
/*0xFF*/
None,
];
#[cfg(test)]
mod tests {
#[test]
fn zeropage_wrap_around() {
use crate::instruction::AddressingMode;
use crate::instruction::CPU;
use crate::instruction::OpInput;
let mut cpu = CPU::new();
cpu.registers.index_x = 9;
assert!(matches!(AddressingMode::ZeroPageX.process(&cpu, &[10]), OpInput::UseAddress(19)));
assert!(matches!(AddressingMode::ZeroPageX.process(&cpu, &[250]), OpInput::UseAddress(3)));
}
}