mirror of
https://github.com/FranLMSP/rmg-001.git
synced 2024-11-23 10:12:11 +00:00
More tests for INC and DEC with 16bit registers
This commit is contained in:
parent
c55256a5b7
commit
0a1edfa39e
18
src/cpu.rs
18
src/cpu.rs
@ -816,7 +816,15 @@ mod tests {
|
|||||||
cpu.exec(Opcode::INC(true, Register::A), &mut bus);
|
cpu.exec(Opcode::INC(true, Register::A), &mut bus);
|
||||||
assert_eq!(cpu.registers.get_flag(FlagRegister::Zero), false);
|
assert_eq!(cpu.registers.get_flag(FlagRegister::Zero), false);
|
||||||
assert_eq!(cpu.registers.get_flag(FlagRegister::Substract), false);
|
assert_eq!(cpu.registers.get_flag(FlagRegister::Substract), false);
|
||||||
//assert_eq!(cpu.registers.get_flag(FlagRegister::HalfCarry), true);
|
assert_eq!(cpu.registers.get_flag(FlagRegister::HalfCarry), true);
|
||||||
|
assert_eq!(cpu.registers.get(Register::PC), 0x101);
|
||||||
|
let mut cpu = CPU::new();
|
||||||
|
cpu.registers.set(Register::HL, 0b0000111111111111);
|
||||||
|
cpu.exec(Opcode::INC(true, Register::HL), &mut bus);
|
||||||
|
assert_eq!(cpu.registers.get_flag(FlagRegister::Zero), false);
|
||||||
|
assert_eq!(cpu.registers.get_flag(FlagRegister::Substract), false);
|
||||||
|
assert_eq!(cpu.registers.get_flag(FlagRegister::HalfCarry), true);
|
||||||
|
assert_eq!(cpu.registers.get(Register::HL), 0b0001000000000000);
|
||||||
assert_eq!(cpu.registers.get(Register::PC), 0x101);
|
assert_eq!(cpu.registers.get(Register::PC), 0x101);
|
||||||
|
|
||||||
// DEC
|
// DEC
|
||||||
@ -836,6 +844,14 @@ mod tests {
|
|||||||
assert_eq!(cpu.registers.get_flag(FlagRegister::HalfCarry), true);
|
assert_eq!(cpu.registers.get_flag(FlagRegister::HalfCarry), true);
|
||||||
assert_eq!(cpu.registers.get(Register::A), 0b00001111);
|
assert_eq!(cpu.registers.get(Register::A), 0b00001111);
|
||||||
assert_eq!(cpu.registers.get(Register::PC), 0x101);
|
assert_eq!(cpu.registers.get(Register::PC), 0x101);
|
||||||
|
let mut cpu = CPU::new();
|
||||||
|
cpu.registers.set(Register::HL, 0b0001000000000000);
|
||||||
|
cpu.exec(Opcode::DEC(true, Register::HL), &mut bus);
|
||||||
|
assert_eq!(cpu.registers.get_flag(FlagRegister::Zero), false);
|
||||||
|
assert_eq!(cpu.registers.get_flag(FlagRegister::Substract), true);
|
||||||
|
assert_eq!(cpu.registers.get_flag(FlagRegister::HalfCarry), true);
|
||||||
|
assert_eq!(cpu.registers.get(Register::HL), 0b0000111111111111);
|
||||||
|
assert_eq!(cpu.registers.get(Register::PC), 0x101);
|
||||||
|
|
||||||
// NOP
|
// NOP
|
||||||
let mut cpu = CPU::new();
|
let mut cpu = CPU::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user