mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-25 16:31:42 +00:00
Implement TAS Dn, with detour for other TASes.
This commit is contained in:
parent
cb4d6710df
commit
1dd6ed6ae3
@ -187,10 +187,10 @@ struct TestProcessor: public CPU::MC68000Mk2::BusHandler {
|
||||
// @"rtr.json",
|
||||
// @"rts.json",
|
||||
@"swap.json",
|
||||
// @"tas.json",
|
||||
@"tas.json",
|
||||
// @"tst.json",
|
||||
]];
|
||||
// _testSet = [NSSet setWithArray:@[@"PEA 0038"]];
|
||||
// _testSet = [NSSet setWithArray:@[@"TAS 4ac0"]];
|
||||
}
|
||||
|
||||
- (void)testAll {
|
||||
|
@ -165,6 +165,7 @@ enum ExecutionState: int {
|
||||
MULU_MULS,
|
||||
LEA,
|
||||
PEA,
|
||||
TAS,
|
||||
};
|
||||
|
||||
// MARK: - The state machine.
|
||||
@ -714,6 +715,20 @@ void Processor<BusHandler, dtack_is_implicit, permit_overrun, signal_will_perfor
|
||||
MoveToStateSpecific(CalcEffectiveAddress);
|
||||
});
|
||||
|
||||
StdCASE(TAS, {
|
||||
// TAS uses a special atomic bus cycle for memory accesses,
|
||||
// but is also available as DataRegisterDirect, with no
|
||||
// memory access whatsoever. So segue elsewhere here only
|
||||
// for the other cases.
|
||||
if(instruction_.mode(0) != Mode::DataRegisterDirect) {
|
||||
post_ea_state_ = TAS;
|
||||
next_operand_ = 0;
|
||||
MoveToStateSpecific(CalcEffectiveAddress);
|
||||
}
|
||||
|
||||
perform_state_ = Perform_np;
|
||||
});
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
@ -1902,6 +1917,17 @@ void Processor<BusHandler, dtack_is_implicit, permit_overrun, signal_will_perfor
|
||||
Prefetch();
|
||||
MoveToStateSpecific(Decode);
|
||||
|
||||
//
|
||||
// TAS
|
||||
//
|
||||
BeginState(TAS):
|
||||
|
||||
// TODO: use the specialised TAS bus cycle; five parts.
|
||||
// PerformBusOperation
|
||||
|
||||
Prefetch();
|
||||
MoveToStateSpecific(Decode);
|
||||
|
||||
//
|
||||
// Various states TODO.
|
||||
//
|
||||
@ -2019,6 +2045,16 @@ template <bool use_current_instruction_pc> void ProcessorBase::raise_exception(i
|
||||
exception_vector_ = vector;
|
||||
}
|
||||
|
||||
inline void ProcessorBase::tas(Preinstruction instruction, uint32_t) {
|
||||
// This will be reached only if addressing mode is Dn.
|
||||
const uint8_t value = registers_[instruction.reg(0)].b;
|
||||
registers_[instruction.reg(0)].b |= 0x80;
|
||||
|
||||
status_.overflow_flag = status_.carry_flag = 0;
|
||||
status_.zero_result = value;
|
||||
status_.negative_flag = value & 0x80;
|
||||
}
|
||||
|
||||
// MARK: - External state.
|
||||
|
||||
template <class BusHandler, bool dtack_is_implicit, bool permit_overrun, bool signal_will_perform>
|
||||
|
@ -143,7 +143,7 @@ struct ProcessorBase: public InstructionSet::M68k::NullFlowController {
|
||||
inline void unlink(uint32_t &) {} //
|
||||
inline void move_to_usp(uint32_t) {} //
|
||||
inline void move_from_usp(uint32_t &) {} //
|
||||
inline void tas(Preinstruction, uint32_t) {} //
|
||||
inline void tas(Preinstruction, uint32_t);
|
||||
template <bool use_current_instruction_pc = true> void raise_exception(int);
|
||||
|
||||
// These aren't implemented because the specific details of the implementation
|
||||
|
Loading…
Reference in New Issue
Block a user