mirror of
https://github.com/gopher64/gopher64.git
synced 2026-07-11 01:25:20 +02:00
@@ -975,22 +975,21 @@ pub fn jr(device: &mut device::Device, opcode: u32) {
|
||||
}
|
||||
|
||||
pub fn jalr(device: &mut device::Device, opcode: u32) {
|
||||
let target = device.cpu.gpr[rs(opcode) as usize];
|
||||
let in_delay_slot_taken = device::cpu::in_delay_slot_taken(device);
|
||||
|
||||
if !in_delay_slot_taken {
|
||||
check_relative_idle_loop(device, opcode);
|
||||
device.cpu.branch_state.state = device::cpu::State::Take;
|
||||
device.cpu.branch_state.pc = device.cpu.gpr[rs(opcode) as usize];
|
||||
} else if !device::cpu::in_delay_slot(device) {
|
||||
device.cpu.branch_state.state = device::cpu::State::NotTaken;
|
||||
}
|
||||
|
||||
if in_delay_slot_taken {
|
||||
device.cpu.gpr[rd(opcode) as usize] = device.cpu.branch_state.pc + 4
|
||||
} else {
|
||||
device.cpu.gpr[rd(opcode) as usize] = device.cpu.pc + 8
|
||||
}
|
||||
|
||||
if !in_delay_slot_taken {
|
||||
check_relative_idle_loop(device, opcode);
|
||||
device.cpu.branch_state.state = device::cpu::State::Take;
|
||||
device.cpu.branch_state.pc = target;
|
||||
} else if !device::cpu::in_delay_slot(device) {
|
||||
device.cpu.branch_state.state = device::cpu::State::NotTaken;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn sync(_device: &mut device::Device, _opcode: u32) {}
|
||||
|
||||
@@ -306,22 +306,21 @@ pub fn jr(device: &mut device::Device, opcode: u32) {
|
||||
}
|
||||
|
||||
pub fn jalr(device: &mut device::Device, opcode: u32) {
|
||||
let target = device.rsp.cpu.gpr[rs(opcode) as usize];
|
||||
let in_delay_slot_taken = device::rsp_cpu::in_delay_slot_taken(device);
|
||||
|
||||
if !in_delay_slot_taken {
|
||||
device.rsp.cpu.branch_state.state = device::cpu::State::Take;
|
||||
device.rsp.cpu.branch_state.pc = device.rsp.cpu.gpr[rs(opcode) as usize]
|
||||
} else if !device::rsp_cpu::in_delay_slot(device) {
|
||||
device.rsp.cpu.branch_state.state = device::cpu::State::NotTaken;
|
||||
}
|
||||
|
||||
if in_delay_slot_taken {
|
||||
device.rsp.cpu.gpr[rd(opcode) as usize] = (device.rsp.cpu.branch_state.pc + 4) & 0xFFF
|
||||
} else {
|
||||
device.rsp.cpu.gpr[rd(opcode) as usize] =
|
||||
(device.rsp.regs2[device::rsp_interface::SP_PC_REG as usize] + 8) & 0xFFF
|
||||
}
|
||||
|
||||
if !in_delay_slot_taken {
|
||||
device.rsp.cpu.branch_state.state = device::cpu::State::Take;
|
||||
device.rsp.cpu.branch_state.pc = target
|
||||
} else if !device::rsp_cpu::in_delay_slot(device) {
|
||||
device.rsp.cpu.branch_state.state = device::cpu::State::NotTaken;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn break_(device: &mut device::Device, _opcode: u32) {
|
||||
|
||||
Reference in New Issue
Block a user