mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +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 <cstring>
|
||||
|
||||
//#define BE_NOISY
|
||||
#define BE_NOISY
|
||||
|
||||
using namespace CPU::MOS6502;
|
||||
|
||||
@ -45,14 +45,14 @@ template <Type type> class ConcreteAllRAMProcessor: public AllRAMProcessor, publ
|
||||
*value = memory_[address];
|
||||
#ifdef BE_NOISY
|
||||
// if((address&0xff00) == 0x100) {
|
||||
printf("%04x -> %02x\n", address, *value);
|
||||
// printf("%04x -> %02x\n", address, *value);
|
||||
// }
|
||||
#endif
|
||||
} else {
|
||||
memory_[address] = *value;
|
||||
#ifdef BE_NOISY
|
||||
// if((address&0xff00) == 0x100) {
|
||||
printf("%04x <- %02x\n", address, *value);
|
||||
// printf("%04x <- %02x\n", address, *value);
|
||||
// }
|
||||
#endif
|
||||
}
|
||||
|
@ -109,6 +109,10 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
|
||||
write(data_address_, data_buffer_.next_output());
|
||||
break;
|
||||
|
||||
case CycleStoreDataThrowaway:
|
||||
write(data_address_, data_buffer_.preview_output());
|
||||
break;
|
||||
|
||||
case CycleStoreIncrementData:
|
||||
write(data_address_, data_buffer_.next_output());
|
||||
increment_data_address();
|
||||
|
@ -157,7 +157,7 @@ struct CPU::WDC65816::ProcessorStorageConstructor {
|
||||
target(CycleFetchData); // Data [high].
|
||||
|
||||
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.
|
||||
|
||||
|
@ -31,6 +31,8 @@ enum MicroOp: uint8_t {
|
||||
|
||||
/// Stores a byte from the data buffer.
|
||||
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.
|
||||
CycleStoreIncrementData,
|
||||
/// Stores a byte to the data address from the data buffer and decrements the data address.
|
||||
@ -282,6 +284,10 @@ struct ProcessorStorage {
|
||||
return next;
|
||||
}
|
||||
|
||||
uint8_t *preview_output() {
|
||||
return byte(read);
|
||||
}
|
||||
|
||||
uint8_t *next_stack() {
|
||||
--size;
|
||||
return byte(size);
|
||||
|
Loading…
Reference in New Issue
Block a user