28 #include "SystemRAMBank.h"
30 #include "sidplayfp/event.h"
38 virtual void setCpuPort(
int state) =0;
39 virtual uint8_t getLastReadByte()
const =0;
40 virtual event_clock_t getPhi2Time()
const =0;
79 static const event_clock_t C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES = 350000;
88 static const bool tape_sense =
false;
98 event_clock_t dataSetClkBit6;
99 event_clock_t dataSetClkBit7;
104 bool dataFalloffBit6;
105 bool dataFalloffBit7;
124 uint8_t procPortPins;
130 procPortPins = (procPortPins & ~dir) | (data & dir);
132 dataRead = (data | ~dir) & (procPortPins | 0x17);
134 pla->setCpuPort((data | ~dir) & 0x07);
136 if ((dir & 0x20) == 0)
140 if (tape_sense && (dir & 0x10) == 0)
158 dataFalloffBit6 =
false;
159 dataFalloffBit7 =
false;
185 uint8_t
peek(uint_least16_t address)
194 if (dataFalloffBit6 || dataFalloffBit7)
196 const event_clock_t phi2time = pla->getPhi2Time();
199 if (dataFalloffBit6 && dataSetClkBit6 < phi2time)
201 dataFalloffBit6 =
false;
206 if (dataFalloffBit7 && dataSetClkBit7 < phi2time)
208 dataFalloffBit7 =
false;
213 uint8_t retval = dataRead;
221 retval |= dataSetBit6;
228 retval |= dataSetBit7;
234 return ramBank->
peek(address);
238 void poke(uint_least16_t address, uint8_t value)
248 if ((dir & 0x40) && !(value & 0x40))
250 dataSetClkBit6 = pla->getPhi2Time() + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES;
251 dataSetBit6 = data & 0x40;
252 dataFalloffBit6 =
true;
256 if ((dir & 0x80) && !(value & 0x80))
258 dataSetClkBit7 = pla->getPhi2Time() + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES;
259 dataSetBit7 = data & 0x80;
260 dataFalloffBit7 =
true;
268 value = pla->getLastReadByte();
276 dataSetBit6 = value & 0x40;
277 dataSetClkBit6 = pla->getPhi2Time() + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES;
278 dataFalloffBit6 =
true;
283 dataSetBit7 = value & 0x80;
284 dataSetClkBit7 = pla->getPhi2Time() + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES;
285 dataFalloffBit7 =
true;
293 value = pla->getLastReadByte();
299 ramBank->
poke(address, value);
uint8_t peek(uint_least16_t address)
Definition: SystemRAMBank.h:56
void poke(uint_least16_t address, uint8_t value)
Definition: ZeroRAMBank.h:238
Definition: SystemRAMBank.h:35
Definition: ZeroRAMBank.h:35
uint8_t peek(uint_least16_t address)
Definition: ZeroRAMBank.h:185
Definition: ZeroRAMBank.h:60
void poke(uint_least16_t address, uint8_t value)
Definition: SystemRAMBank.h:61