mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-24 12:30:17 +00:00
Get strict about writeables.
This commit is contained in:
parent
e56e49a318
commit
91b7d55871
@ -46,12 +46,11 @@ template <typename IntT>
|
||||
class Writeable {
|
||||
public:
|
||||
Writeable(IntT &target) : target_(target) {}
|
||||
void operator=(IntT value) { target_ = value; }
|
||||
IntT operator=(IntT value) { return target_ = value; }
|
||||
private:
|
||||
IntT &target_;
|
||||
};
|
||||
//template <typename IntT> struct Accessor<IntT, AccessType::Write> { using type = Writeable<IntT>; };
|
||||
template <typename IntT> struct Accessor<IntT, AccessType::Write> { using type = IntT &; };
|
||||
template <typename IntT> struct Accessor<IntT, AccessType::Write> { using type = Writeable<IntT>; };
|
||||
|
||||
// Read-modify-writes: return a reference.
|
||||
template <typename IntT> struct Accessor<IntT, AccessType::ReadModifyWrite> { using type = IntT &; };
|
||||
|
@ -1013,9 +1013,9 @@ void setmo(
|
||||
write_t<IntT> destination,
|
||||
ContextT &context
|
||||
) {
|
||||
destination = ~0;
|
||||
const auto result = destination = ~0;
|
||||
context.flags.template set_from<Flag::Carry, Flag::AuxiliaryCarry, Flag::Overflow>(0);
|
||||
context.flags.template set_from<IntT, Flag::Sign, Flag::Zero, Flag::ParityOdd>(destination);
|
||||
context.flags.template set_from<IntT, Flag::Sign, Flag::Zero, Flag::ParityOdd>(result);
|
||||
}
|
||||
|
||||
template <typename IntT, typename ContextT>
|
||||
|
@ -44,7 +44,7 @@ uint32_t address(
|
||||
|
||||
uint32_t address;
|
||||
uint16_t zero = 0;
|
||||
address = resolve<uint16_t, access>(instruction, pointer.index(), pointer, context, &zero);
|
||||
address = resolve<uint16_t, AccessType::Read>(instruction, pointer.index(), pointer, context, &zero);
|
||||
if constexpr (is_32bit(ContextT::model)) {
|
||||
address <<= pointer.scale();
|
||||
}
|
||||
@ -53,7 +53,7 @@ uint32_t address(
|
||||
if constexpr (source == Source::IndirectNoBase) {
|
||||
return address;
|
||||
}
|
||||
return address + resolve<uint16_t, access>(instruction, pointer.base(), pointer, context);
|
||||
return address + resolve<uint16_t, AccessType::Read>(instruction, pointer.base(), pointer, context);
|
||||
}
|
||||
|
||||
/// @returns a pointer to the contents of the register identified by the combination of @c IntT and @c Source if any;
|
||||
|
Loading…
Reference in New Issue
Block a user