mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Add a call to set register state with population of the prefetch.
This commit is contained in:
parent
64491525b4
commit
367ad8079a
@ -397,9 +397,18 @@ class Processor: private ProcessorBase {
|
||||
|
||||
void run_for(HalfCycles duration);
|
||||
|
||||
/// @returns The current processor state.
|
||||
CPU::MC68000Mk2::State get_state();
|
||||
|
||||
/// Sets the current processor state.
|
||||
void set_state(const CPU::MC68000Mk2::State &);
|
||||
|
||||
/// Sets all registers to the values provided, fills the prefetch queue and ensures the
|
||||
/// next action the processor will take is to decode whatever is in the queue.
|
||||
///
|
||||
/// The queue is filled synchronously, during this call, causing calls to the bus handler.
|
||||
void decode_from_state(const InstructionSet::M68k::RegisterSet &);
|
||||
|
||||
// TODO: bus ack/grant, halt,
|
||||
|
||||
/// Sets the DTack line — @c true for active, @c false for inactive.
|
||||
|
@ -2615,6 +2615,29 @@ void Processor<BusHandler, dtack_is_implicit, permit_overrun, signal_will_perfor
|
||||
did_update_status();
|
||||
}
|
||||
|
||||
template <class BusHandler, bool dtack_is_implicit, bool permit_overrun, bool signal_will_perform>
|
||||
void Processor<BusHandler, dtack_is_implicit, permit_overrun, signal_will_perform>::decode_from_state(const InstructionSet::M68k::RegisterSet ®isters) {
|
||||
// Populate registers.
|
||||
CPU::MC68000Mk2::State state;
|
||||
state.registers = registers;
|
||||
set_state(state);
|
||||
|
||||
// Ensure the state machine will resume at decode.
|
||||
state_ = Decode;
|
||||
|
||||
// Fill the prefetch queue.
|
||||
captured_interrupt_level_ = bus_interrupt_level_;
|
||||
|
||||
read_program.value = &prefetch_.high;
|
||||
bus_handler_.perform_bus_operation(read_program_announce, is_supervisor_);
|
||||
bus_handler_.perform_bus_operation(read_program, is_supervisor_);
|
||||
program_counter_.l += 2;
|
||||
|
||||
read_program.value = &prefetch_.low;
|
||||
bus_handler_.perform_bus_operation(read_program_announce, is_supervisor_);
|
||||
bus_handler_.perform_bus_operation(read_program, is_supervisor_);
|
||||
program_counter_.l += 2;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user