mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-21 18:29:57 +00:00
RMW simplification
This commit is contained in:
parent
9a0cf0cca8
commit
b582412231
@ -176,20 +176,21 @@ namespace EightBit {
|
||||
#define FIXUP_RMW(ADDRESSING, OPERATION) \
|
||||
{ \
|
||||
fixup(ADDRESSING()); \
|
||||
const auto result = OPERATION(memoryRead()); \
|
||||
memoryModifyWrite(result); \
|
||||
_RMW(OPERATION); \
|
||||
}
|
||||
|
||||
#define RMW(ADDRESSING, OPERATION) \
|
||||
{ \
|
||||
const auto result = OPERATION(memoryRead(ADDRESSING())); \
|
||||
memoryModifyWrite(result); \
|
||||
BUS().ADDRESS() = ADDRESSING(); \
|
||||
_RMW(OPERATION); \
|
||||
}
|
||||
|
||||
void memoryModifyWrite(const uint8_t data) noexcept {
|
||||
// The read will have already taken place...
|
||||
memoryWrite();
|
||||
memoryWrite(data);
|
||||
#define _RMW(OPERATION) \
|
||||
{ \
|
||||
const auto data = memoryRead(); \
|
||||
const auto result = OPERATION(data); \
|
||||
memoryWrite(); \
|
||||
memoryWrite(result); \
|
||||
}
|
||||
|
||||
void maybe_fixup(register16_t address, uint8_t unfixed_page, bool always_fixup = false) noexcept {
|
||||
|
Loading…
Reference in New Issue
Block a user