Add move from CCR

This commit is contained in:
pjht 2024-03-13 10:24:24 -05:00
parent 8919dc182f
commit 74584bc076
Signed by: pjht
GPG Key ID: CA239FC6934E6F3A
3 changed files with 11 additions and 0 deletions

View File

@ -385,6 +385,12 @@ impl<T> Disasm<'_, T> {
let dst_reg = ins_word[13..16].load_be::<u8>();
let dst = self.decode_effective(dst_mode, dst_reg, size)?;
Ok(Instruction::MoveFromSr(dst))
} else if ins_word[4..10].load_be::<u8>() == 0b00_1011 {
let dst_mode =
AddressingMode::try_from(ins_word[10..13].load_be::<u8>()).unwrap();
let dst_reg = ins_word[13..16].load_be::<u8>();
let dst = self.decode_effective(dst_mode, dst_reg, size)?;
Ok(Instruction::MoveFromCcr(dst))
} else if ins_word[4..10].load_be::<u8>() == 0b01_0011 {
let src_mode =
AddressingMode::try_from(ins_word[10..13].load_be::<u8>()).unwrap();

View File

@ -318,6 +318,7 @@ pub enum Instruction {
size: Size,
},
MoveFromSr(EffectiveAddress),
MoveFromCcr(EffectiveAddress),
MoveToCcr(EffectiveAddress),
MoveToSr(EffectiveAddress),
Negx(Size, EffectiveAddress),
@ -461,6 +462,7 @@ impl Display for Instruction {
},
Self::Move { src, dst, size } => write!(f, "MOVE.{size} {src}, {dst}"),
Self::MoveFromSr(dst) => write!(f, "MOVE SR, {dst}"),
Self::MoveFromCcr(dst) => write!(f, "MOVE CCR, {dst}"),
Self::MoveToCcr(src) => write!(f, "MOVE {src}, CCR"),
Self::MoveToSr(src) => write!(f, "MOVE {src}, SR"),
Self::Negx(size, dst) => write!(f, "NEGX.{size} {dst}"),

View File

@ -536,6 +536,9 @@ impl M68K {
self.sr = (self.sr & 0xFFE0) | new_flags;
}
}
Instruction::MoveFromCcr(dst) => {
self.write_effective(dst, u32::from(self.sr & 0xFF), Size::Word)?;
}
Instruction::MoveFromSr(dst) => {
self.write_effective(dst, u32::from(self.sr), Size::Word)?;
}