mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Implement RTE, RTS, RTR.
This commit is contained in:
parent
4e21cdfc63
commit
269263eecf
@ -184,8 +184,8 @@ struct TestProcessor: public CPU::MC68000Mk2::BusHandler {
|
||||
@"nbcd_pea.json",
|
||||
@"neg_not.json",
|
||||
@"negx_clr.json",
|
||||
// @"rtr.json",
|
||||
// @"rts.json",
|
||||
@"rtr.json",
|
||||
@"rts.json",
|
||||
@"swap.json",
|
||||
@"tas.json",
|
||||
@"tst.json",
|
||||
|
@ -167,6 +167,9 @@ enum ExecutionState: int {
|
||||
PEA,
|
||||
TAS,
|
||||
MOVEtoCCRSR,
|
||||
RTR,
|
||||
RTE,
|
||||
RTS,
|
||||
};
|
||||
|
||||
// MARK: - The state machine.
|
||||
@ -742,6 +745,10 @@ void Processor<BusHandler, dtack_is_implicit, permit_overrun, signal_will_perfor
|
||||
MoveToStateSpecific(CalcEffectiveAddress);
|
||||
});
|
||||
|
||||
StdCASE(RTR, MoveToStateSpecific(RTR));
|
||||
StdCASE(RTE, MoveToStateSpecific(RTE));
|
||||
StdCASE(RTS, MoveToStateSpecific(RTS));
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
@ -1988,6 +1995,57 @@ void Processor<BusHandler, dtack_is_implicit, permit_overrun, signal_will_perfor
|
||||
Prefetch();
|
||||
MoveToStateSpecific(Decode);
|
||||
|
||||
//
|
||||
// RTR, RTS, RTE
|
||||
//
|
||||
BeginState(RTS):
|
||||
SetupDataAccess(Microcycle::Read, Microcycle::SelectWord);
|
||||
SetDataAddress(registers_[15].l);
|
||||
|
||||
Access(program_counter_.high);
|
||||
registers_[15].l += 2;
|
||||
Access(program_counter_.low);
|
||||
registers_[15].l += 2;
|
||||
|
||||
Prefetch();
|
||||
Prefetch();
|
||||
MoveToStateSpecific(Decode);
|
||||
|
||||
BeginState(RTE):
|
||||
SetupDataAccess(Microcycle::Read, Microcycle::SelectWord);
|
||||
SetDataAddress(registers_[15].l);
|
||||
|
||||
Access(program_counter_.high);
|
||||
registers_[15].l += 2;
|
||||
Access(program_counter_.low);
|
||||
registers_[15].l += 2;
|
||||
|
||||
Access(temporary_value_.low);
|
||||
registers_[15].l += 2;
|
||||
status_.set_status(temporary_value_.w);
|
||||
|
||||
Prefetch();
|
||||
Prefetch();
|
||||
MoveToStateSpecific(Decode);
|
||||
|
||||
BeginState(RTR):
|
||||
SetupDataAccess(Microcycle::Read, Microcycle::SelectWord);
|
||||
SetDataAddress(registers_[15].l);
|
||||
|
||||
registers_[15].l += 2;
|
||||
Access(program_counter_.high);
|
||||
registers_[15].l += 2;
|
||||
Access(program_counter_.low);
|
||||
|
||||
registers_[15].l -= 4;
|
||||
Access(temporary_value_.low);
|
||||
registers_[15].l += 6;
|
||||
status_.set_ccr(temporary_value_.w);
|
||||
|
||||
Prefetch();
|
||||
Prefetch();
|
||||
MoveToStateSpecific(Decode);
|
||||
|
||||
//
|
||||
// Various states TODO.
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user