mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-29 12:50:28 +00:00
Merge pull request #1049 from TomHarte/68000Mk2Bus
Correct 68000 mark 2 Microcycle helper methods.
This commit is contained in:
commit
cb162b6755
@ -175,17 +175,17 @@ struct Microcycle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@returns non-zero if this is a byte read and 68000 LDS is asserted.
|
@returns non-zero if the 68000 LDS is asserted; zero otherwise.
|
||||||
*/
|
*/
|
||||||
forceinline int lower_data_select() const {
|
forceinline int lower_data_select() const {
|
||||||
return (operation & SelectByte) & ((*address & 1) << 3);
|
return ((operation & SelectByte) & (*address & 1)) | (operation & SelectWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@returns non-zero if this is a byte read and 68000 UDS is asserted.
|
@returns non-zero if the 68000 UDS is asserted; zero otherwise.
|
||||||
*/
|
*/
|
||||||
forceinline int upper_data_select() const {
|
forceinline int upper_data_select() const {
|
||||||
return (operation & SelectByte) & ~((*address & 1) << 3);
|
return ((operation & SelectByte) & ~(*address & 1)) | (operation & SelectWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -229,21 +229,18 @@ struct Microcycle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@returns the value currently on the high 8 lines of the data bus if any;
|
@returns the value currently on the high 8 lines of the data bus.
|
||||||
@c 0xff otherwise. Assumes this is a write cycle.
|
|
||||||
*/
|
*/
|
||||||
forceinline uint8_t value8_high() const {
|
forceinline uint8_t value8_high() const {
|
||||||
const uint8_t values[] = { uint8_t(value->w), value->b};
|
const uint8_t values[] = { uint8_t(value->w >> 8), value->b};
|
||||||
return values[operation & SelectByte];
|
return values[operation & SelectByte];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@returns the value currently on the low 8 lines of the data bus if any;
|
@returns the value currently on the low 8 lines of the data bus.
|
||||||
@c 0xff otherwise. Assumes this is a write cycle.
|
|
||||||
*/
|
*/
|
||||||
forceinline uint8_t value8_low() const {
|
forceinline uint8_t value8_low() const {
|
||||||
const uint8_t values[] = { uint8_t(value->w), value->b};
|
return value->b;
|
||||||
return values[operation & SelectByte];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -394,6 +391,8 @@ template <class BusHandler, bool dtack_is_implicit = true, bool permit_overrun =
|
|||||||
class Processor: private ProcessorBase {
|
class Processor: private ProcessorBase {
|
||||||
public:
|
public:
|
||||||
Processor(BusHandler &bus_handler) : ProcessorBase(), bus_handler_(bus_handler) {}
|
Processor(BusHandler &bus_handler) : ProcessorBase(), bus_handler_(bus_handler) {}
|
||||||
|
Processor(const Processor& rhs) = delete;
|
||||||
|
Processor& operator=(const Processor& rhs) = delete;
|
||||||
|
|
||||||
void run_for(HalfCycles duration);
|
void run_for(HalfCycles duration);
|
||||||
|
|
||||||
|
@ -1091,6 +1091,7 @@ void Processor<BusHandler, dtack_is_implicit, permit_overrun, signal_will_perfor
|
|||||||
// (i) this operand isn't used; or
|
// (i) this operand isn't used; or
|
||||||
// (ii) its address calculation will end up conflated with performance,
|
// (ii) its address calculation will end up conflated with performance,
|
||||||
// so there's no generic bus-accurate approach.
|
// so there's no generic bus-accurate approach.
|
||||||
|
assert(next_operand_ >= 0 && next_operand_ < 2);
|
||||||
if(!(operand_flags_ & (1 << next_operand_))) {
|
if(!(operand_flags_ & (1 << next_operand_))) {
|
||||||
MoveToStateDynamic(perform_state_);
|
MoveToStateDynamic(perform_state_);
|
||||||
}
|
}
|
||||||
@ -1099,6 +1100,7 @@ void Processor<BusHandler, dtack_is_implicit, permit_overrun, signal_will_perfor
|
|||||||
|
|
||||||
// As above, but for .l.
|
// As above, but for .l.
|
||||||
BeginState(FetchOperand_l):
|
BeginState(FetchOperand_l):
|
||||||
|
assert(next_operand_ >= 0 && next_operand_ < 2);
|
||||||
if(!(operand_flags_ & (1 << next_operand_))) {
|
if(!(operand_flags_ & (1 << next_operand_))) {
|
||||||
MoveToStateDynamic(perform_state_);
|
MoveToStateDynamic(perform_state_);
|
||||||
}
|
}
|
||||||
@ -1183,7 +1185,7 @@ void Processor<BusHandler, dtack_is_implicit, permit_overrun, signal_will_perfor
|
|||||||
|
|
||||||
Access(operand_[next_operand_].high); // nW
|
Access(operand_[next_operand_].high); // nW
|
||||||
effective_address_[1].l += 2;
|
effective_address_[1].l += 2;
|
||||||
Access(operand_[next_operand_].low); // nW
|
Access(operand_[next_operand_].low); // nw
|
||||||
|
|
||||||
Prefetch(); // np
|
Prefetch(); // np
|
||||||
MoveToStateSpecific(Decode);
|
MoveToStateSpecific(Decode);
|
||||||
|
@ -22,6 +22,8 @@ struct ProcessorBase: public InstructionSet::M68k::NullFlowController {
|
|||||||
ProcessorBase() {
|
ProcessorBase() {
|
||||||
read_program_announce.address = read_program.address = &program_counter_.l;
|
read_program_announce.address = read_program.address = &program_counter_.l;
|
||||||
}
|
}
|
||||||
|
ProcessorBase(const ProcessorBase& rhs) = delete;
|
||||||
|
ProcessorBase& operator=(const ProcessorBase& rhs) = delete;
|
||||||
|
|
||||||
int state_ = std::numeric_limits<int>::min();
|
int state_ = std::numeric_limits<int>::min();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user