mirror of
https://github.com/transistorfet/moa.git
synced 2024-12-23 03:29:24 +00:00
Fixed LINK instruction
This commit is contained in:
parent
d074b7fc5e
commit
2a9ca9beae
@ -273,13 +273,18 @@ impl M68k {
|
|||||||
self.set_target_value(target, pair.0, size, Used::Twice)?;
|
self.set_target_value(target, pair.0, size, Used::Twice)?;
|
||||||
|
|
||||||
// Adjust flags
|
// Adjust flags
|
||||||
self.set_flag(Flags::Extend, false);
|
|
||||||
self.set_logic_flags(pair.0, size);
|
self.set_logic_flags(pair.0, size);
|
||||||
if pair.1 {
|
|
||||||
self.set_flag(Flags::Carry, true);
|
|
||||||
self.set_flag(Flags::Extend, true);
|
|
||||||
}
|
|
||||||
self.set_flag(Flags::Overflow, overflow);
|
self.set_flag(Flags::Overflow, overflow);
|
||||||
|
|
||||||
|
if count != 0 {
|
||||||
|
self.set_flag(Flags::Extend, false);
|
||||||
|
if pair.1 {
|
||||||
|
self.set_flag(Flags::Carry, true);
|
||||||
|
self.set_flag(Flags::Extend, true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.set_flag(Flags::Carry, false);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Instruction::Bcc(cond, offset) => {
|
Instruction::Bcc(cond, offset) => {
|
||||||
let should_branch = self.get_current_condition(cond);
|
let should_branch = self.get_current_condition(cond);
|
||||||
@ -536,12 +541,12 @@ impl M68k {
|
|||||||
*addr = value;
|
*addr = value;
|
||||||
},
|
},
|
||||||
Instruction::LINK(reg, offset) => {
|
Instruction::LINK(reg, offset) => {
|
||||||
let value = *self.get_a_reg_mut(reg);
|
*self.get_stack_pointer_mut() -= 4;
|
||||||
self.push_long(value)?;
|
|
||||||
let sp = *self.get_stack_pointer_mut();
|
let sp = *self.get_stack_pointer_mut();
|
||||||
let addr = self.get_a_reg_mut(reg);
|
let value = *self.get_a_reg_mut(reg);
|
||||||
*addr = sp;
|
self.set_address_sized(sp as Address, value, Size::Long)?;
|
||||||
*self.get_stack_pointer_mut() = sp.wrapping_add((offset as i32) as u32);
|
*self.get_a_reg_mut(reg) = sp;
|
||||||
|
*self.get_stack_pointer_mut() = (sp as i32).wrapping_add(offset as i32) as u32;
|
||||||
},
|
},
|
||||||
Instruction::LSd(count, target, size, shift_dir) => {
|
Instruction::LSd(count, target, size, shift_dir) => {
|
||||||
let count = self.get_target_value(count, size, Used::Once)? % 64;
|
let count = self.get_target_value(count, size, Used::Once)? % 64;
|
||||||
|
@ -183,7 +183,7 @@ impl M68k {
|
|||||||
for i in 0..7 {
|
for i in 0..7 {
|
||||||
println!("D{}: {:#010x} A{}: {:#010x}", i, self.state.d_reg[i as usize], i, self.state.a_reg[i as usize]);
|
println!("D{}: {:#010x} A{}: {:#010x}", i, self.state.d_reg[i as usize], i, self.state.a_reg[i as usize]);
|
||||||
}
|
}
|
||||||
println!("D7: {:#010x} USP: {:#010x}", self.state.d_reg[7], self.state.ssp);
|
println!("D7: {:#010x} USP: {:#010x}", self.state.d_reg[7], self.state.usp);
|
||||||
println!(" SSP: {:#010x}", self.state.ssp);
|
println!(" SSP: {:#010x}", self.state.ssp);
|
||||||
|
|
||||||
println!("Current Instruction: {:#010x} {:?}", self.decoder.start, self.decoder.instruction);
|
println!("Current Instruction: {:#010x} {:?}", self.decoder.start, self.decoder.instruction);
|
||||||
|
Loading…
Reference in New Issue
Block a user