mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-05 10:28:58 +00:00
Corrects emulation-mode read-modify-writes not to empty the data buffer.
This commit is contained in:
parent
b439f40fe2
commit
451f83ba51
@ -11,7 +11,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
//#define BE_NOISY
|
#define BE_NOISY
|
||||||
|
|
||||||
using namespace CPU::MOS6502;
|
using namespace CPU::MOS6502;
|
||||||
|
|
||||||
@ -45,14 +45,14 @@ template <Type type> class ConcreteAllRAMProcessor: public AllRAMProcessor, publ
|
|||||||
*value = memory_[address];
|
*value = memory_[address];
|
||||||
#ifdef BE_NOISY
|
#ifdef BE_NOISY
|
||||||
// if((address&0xff00) == 0x100) {
|
// if((address&0xff00) == 0x100) {
|
||||||
printf("%04x -> %02x\n", address, *value);
|
// printf("%04x -> %02x\n", address, *value);
|
||||||
// }
|
// }
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
memory_[address] = *value;
|
memory_[address] = *value;
|
||||||
#ifdef BE_NOISY
|
#ifdef BE_NOISY
|
||||||
// if((address&0xff00) == 0x100) {
|
// if((address&0xff00) == 0x100) {
|
||||||
printf("%04x <- %02x\n", address, *value);
|
// printf("%04x <- %02x\n", address, *value);
|
||||||
// }
|
// }
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,10 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
|
|||||||
write(data_address_, data_buffer_.next_output());
|
write(data_address_, data_buffer_.next_output());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CycleStoreDataThrowaway:
|
||||||
|
write(data_address_, data_buffer_.preview_output());
|
||||||
|
break;
|
||||||
|
|
||||||
case CycleStoreIncrementData:
|
case CycleStoreIncrementData:
|
||||||
write(data_address_, data_buffer_.next_output());
|
write(data_address_, data_buffer_.next_output());
|
||||||
increment_data_address();
|
increment_data_address();
|
||||||
|
@ -157,7 +157,7 @@ struct CPU::WDC65816::ProcessorStorageConstructor {
|
|||||||
target(CycleFetchData); // Data [high].
|
target(CycleFetchData); // Data [high].
|
||||||
|
|
||||||
if(!is8bit) target(CycleFetchData); // 16-bit: reread final byte of data.
|
if(!is8bit) target(CycleFetchData); // 16-bit: reread final byte of data.
|
||||||
else target(CycleStoreData); // 8-bit rewrite final byte of data.
|
else target(CycleStoreDataThrowaway); // 8-bit rewrite final byte of data.
|
||||||
|
|
||||||
target(OperationPerform); // Perform operation within the data buffer.
|
target(OperationPerform); // Perform operation within the data buffer.
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ enum MicroOp: uint8_t {
|
|||||||
|
|
||||||
/// Stores a byte from the data buffer.
|
/// Stores a byte from the data buffer.
|
||||||
CycleStoreData,
|
CycleStoreData,
|
||||||
|
/// Stores the most recent byte placed into the data buffer without removing it.
|
||||||
|
CycleStoreDataThrowaway,
|
||||||
/// Stores a byte to the data address from the data buffer and increments the data address.
|
/// Stores a byte to the data address from the data buffer and increments the data address.
|
||||||
CycleStoreIncrementData,
|
CycleStoreIncrementData,
|
||||||
/// Stores a byte to the data address from the data buffer and decrements the data address.
|
/// Stores a byte to the data address from the data buffer and decrements the data address.
|
||||||
@ -282,6 +284,10 @@ struct ProcessorStorage {
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t *preview_output() {
|
||||||
|
return byte(read);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t *next_stack() {
|
uint8_t *next_stack() {
|
||||||
--size;
|
--size;
|
||||||
return byte(size);
|
return byte(size);
|
||||||
|
Loading…
Reference in New Issue
Block a user