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;
183 uint8_t
peek(uint_least16_t address)
192 if (dataFalloffBit6 || dataFalloffBit7)
194 const event_clock_t phi2time = pla->getPhi2Time();
197 if (dataFalloffBit6 && dataSetClkBit6 < phi2time)
199 dataFalloffBit6 =
false;
204 if (dataFalloffBit7 && dataSetClkBit7 < phi2time)
206 dataFalloffBit7 =
false;
211 uint8_t retval = dataRead;
219 retval |= dataSetBit6;
226 retval |= dataSetBit7;
232 return ramBank->
peek(address);
236 void poke(uint_least16_t address, uint8_t value)
246 if ((dir & 0x40) && !(value & 0x40))
248 dataSetClkBit6 = pla->getPhi2Time() + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES;
249 dataSetBit6 = data & 0x40;
250 dataFalloffBit6 =
true;
254 if ((dir & 0x80) && !(value & 0x80))
256 dataSetClkBit7 = pla->getPhi2Time() + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES;
257 dataSetBit7 = data & 0x80;
258 dataFalloffBit7 =
true;
266 value = pla->getLastReadByte();
274 dataSetBit6 = value & 0x40;
275 dataSetClkBit6 = pla->getPhi2Time() + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES;
276 dataFalloffBit6 =
true;
281 dataSetBit7 = value & 0x80;
282 dataSetClkBit7 = pla->getPhi2Time() + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES;
283 dataFalloffBit7 =
true;
291 value = pla->getLastReadByte();
297 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:236
Definition: SystemRAMBank.h:35
Definition: ZeroRAMBank.h:35
uint8_t peek(uint_least16_t address)
Definition: ZeroRAMBank.h:183
Definition: ZeroRAMBank.h:60
void poke(uint_least16_t address, uint8_t value)
Definition: SystemRAMBank.h:61