mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-13 15:25:56 +00:00
Get strict about writeables.
This commit is contained in:
@@ -46,12 +46,11 @@ template <typename IntT>
|
|||||||
class Writeable {
|
class Writeable {
|
||||||
public:
|
public:
|
||||||
Writeable(IntT &target) : target_(target) {}
|
Writeable(IntT &target) : target_(target) {}
|
||||||
void operator=(IntT value) { target_ = value; }
|
IntT operator=(IntT value) { return target_ = value; }
|
||||||
private:
|
private:
|
||||||
IntT &target_;
|
IntT &target_;
|
||||||
};
|
};
|
||||||
//template <typename IntT> struct Accessor<IntT, AccessType::Write> { using type = Writeable<IntT>; };
|
template <typename IntT> struct Accessor<IntT, AccessType::Write> { using type = Writeable<IntT>; };
|
||||||
template <typename IntT> struct Accessor<IntT, AccessType::Write> { using type = IntT &; };
|
|
||||||
|
|
||||||
// Read-modify-writes: return a reference.
|
// Read-modify-writes: return a reference.
|
||||||
template <typename IntT> struct Accessor<IntT, AccessType::ReadModifyWrite> { using type = IntT &; };
|
template <typename IntT> struct Accessor<IntT, AccessType::ReadModifyWrite> { using type = IntT &; };
|
||||||
|
@@ -1013,9 +1013,9 @@ void setmo(
|
|||||||
write_t<IntT> destination,
|
write_t<IntT> destination,
|
||||||
ContextT &context
|
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<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>
|
template <typename IntT, typename ContextT>
|
||||||
|
@@ -44,7 +44,7 @@ uint32_t address(
|
|||||||
|
|
||||||
uint32_t address;
|
uint32_t address;
|
||||||
uint16_t zero = 0;
|
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)) {
|
if constexpr (is_32bit(ContextT::model)) {
|
||||||
address <<= pointer.scale();
|
address <<= pointer.scale();
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ uint32_t address(
|
|||||||
if constexpr (source == Source::IndirectNoBase) {
|
if constexpr (source == Source::IndirectNoBase) {
|
||||||
return address;
|
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;
|
/// @returns a pointer to the contents of the register identified by the combination of @c IntT and @c Source if any;
|
||||||
|
Reference in New Issue
Block a user