mirror of
https://github.com/mre/mos6502.git
synced 2025-01-08 16:30:04 +00:00
zeropage wraparound test
This commit is contained in:
parent
89d6e66e11
commit
5290a9d61e
@ -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)));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user