ld instructions

This commit is contained in:
Alex Janka 2023-02-01 22:54:02 +11:00
parent e3199f32b6
commit d03043bef9

View file

@ -195,6 +195,70 @@ impl CPU {
self.clear_flag(Flags::HalfCarry);
self.set_or_clear_flag(Flags::Carry, !self.is_flag(Flags::Carry));
}
0x40 => self.reg.set_8(Reg8::B, self.reg.get_8(Reg8::B)),
0x41 => self.reg.set_8(Reg8::B, self.reg.get_8(Reg8::C)),
0x42 => self.reg.set_8(Reg8::B, self.reg.get_8(Reg8::D)),
0x43 => self.reg.set_8(Reg8::B, self.reg.get_8(Reg8::E)),
0x44 => self.reg.set_8(Reg8::B, self.reg.get_8(Reg8::H)),
0x45 => self.reg.set_8(Reg8::B, self.reg.get_8(Reg8::L)),
0x46 => self.reg.set_8(Reg8::B, self.memory.get(self.reg.hl)),
0x47 => self.reg.set_8(Reg8::B, self.reg.get_8(Reg8::A)),
0x48 => self.reg.set_8(Reg8::C, self.reg.get_8(Reg8::B)),
0x49 => self.reg.set_8(Reg8::C, self.reg.get_8(Reg8::C)),
0x4A => self.reg.set_8(Reg8::C, self.reg.get_8(Reg8::D)),
0x4B => self.reg.set_8(Reg8::C, self.reg.get_8(Reg8::E)),
0x4C => self.reg.set_8(Reg8::C, self.reg.get_8(Reg8::H)),
0x4D => self.reg.set_8(Reg8::C, self.reg.get_8(Reg8::L)),
0x4E => self.reg.set_8(Reg8::C, self.memory.get(self.reg.hl)),
0x4F => self.reg.set_8(Reg8::C, self.reg.get_8(Reg8::A)),
0x50 => self.reg.set_8(Reg8::D, self.reg.get_8(Reg8::B)),
0x51 => self.reg.set_8(Reg8::D, self.reg.get_8(Reg8::C)),
0x52 => self.reg.set_8(Reg8::D, self.reg.get_8(Reg8::D)),
0x53 => self.reg.set_8(Reg8::D, self.reg.get_8(Reg8::E)),
0x54 => self.reg.set_8(Reg8::D, self.reg.get_8(Reg8::H)),
0x55 => self.reg.set_8(Reg8::D, self.reg.get_8(Reg8::L)),
0x56 => self.reg.set_8(Reg8::D, self.memory.get(self.reg.hl)),
0x57 => self.reg.set_8(Reg8::D, self.reg.get_8(Reg8::A)),
0x58 => self.reg.set_8(Reg8::E, self.reg.get_8(Reg8::B)),
0x59 => self.reg.set_8(Reg8::E, self.reg.get_8(Reg8::C)),
0x5A => self.reg.set_8(Reg8::E, self.reg.get_8(Reg8::D)),
0x5B => self.reg.set_8(Reg8::E, self.reg.get_8(Reg8::E)),
0x5C => self.reg.set_8(Reg8::E, self.reg.get_8(Reg8::H)),
0x5D => self.reg.set_8(Reg8::E, self.reg.get_8(Reg8::L)),
0x5E => self.reg.set_8(Reg8::E, self.memory.get(self.reg.hl)),
0x5F => self.reg.set_8(Reg8::E, self.reg.get_8(Reg8::A)),
0x60 => self.reg.set_8(Reg8::H, self.reg.get_8(Reg8::B)),
0x61 => self.reg.set_8(Reg8::H, self.reg.get_8(Reg8::C)),
0x62 => self.reg.set_8(Reg8::H, self.reg.get_8(Reg8::D)),
0x63 => self.reg.set_8(Reg8::H, self.reg.get_8(Reg8::E)),
0x64 => self.reg.set_8(Reg8::H, self.reg.get_8(Reg8::H)),
0x65 => self.reg.set_8(Reg8::H, self.reg.get_8(Reg8::L)),
0x66 => self.reg.set_8(Reg8::H, self.memory.get(self.reg.hl)),
0x67 => self.reg.set_8(Reg8::H, self.reg.get_8(Reg8::A)),
0x68 => self.reg.set_8(Reg8::L, self.reg.get_8(Reg8::B)),
0x69 => self.reg.set_8(Reg8::L, self.reg.get_8(Reg8::C)),
0x6A => self.reg.set_8(Reg8::L, self.reg.get_8(Reg8::D)),
0x6B => self.reg.set_8(Reg8::L, self.reg.get_8(Reg8::E)),
0x6C => self.reg.set_8(Reg8::L, self.reg.get_8(Reg8::H)),
0x6D => self.reg.set_8(Reg8::L, self.reg.get_8(Reg8::L)),
0x6E => self.reg.set_8(Reg8::L, self.memory.get(self.reg.hl)),
0x6F => self.reg.set_8(Reg8::L, self.reg.get_8(Reg8::A)),
0x70 => self.memory.set(self.reg.hl, self.reg.get_8(Reg8::B)),
0x71 => self.memory.set(self.reg.hl, self.reg.get_8(Reg8::C)),
0x72 => self.memory.set(self.reg.hl, self.reg.get_8(Reg8::D)),
0x73 => self.memory.set(self.reg.hl, self.reg.get_8(Reg8::E)),
0x74 => self.memory.set(self.reg.hl, self.reg.get_8(Reg8::H)),
0x75 => self.memory.set(self.reg.hl, self.reg.get_8(Reg8::L)),
0x76 => panic!("halt"),
0x77 => self.memory.set(self.reg.hl, self.reg.get_8(Reg8::A)),
0x78 => self.reg.set_8(Reg8::A, self.reg.get_8(Reg8::B)),
0x79 => self.reg.set_8(Reg8::A, self.reg.get_8(Reg8::C)),
0x7A => self.reg.set_8(Reg8::A, self.reg.get_8(Reg8::D)),
0x7B => self.reg.set_8(Reg8::A, self.reg.get_8(Reg8::E)),
0x7C => self.reg.set_8(Reg8::A, self.reg.get_8(Reg8::H)),
0x7D => self.reg.set_8(Reg8::A, self.reg.get_8(Reg8::L)),
0x7E => self.reg.set_8(Reg8::A, self.memory.get(self.reg.hl)),
0x7F => self.reg.set_8(Reg8::A, self.reg.get_8(Reg8::A)),
_ => {
undefined(opcode);