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;
76 static const event_clock_t C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES = 350000;
85 static const bool tape_sense =
false;
95 event_clock_t dataSetClkBit6;
96 event_clock_t dataSetClkBit7;
101 bool dataFalloffBit6;
102 bool dataFalloffBit7;
121 uint8_t procPortPins;
127 procPortPins = (procPortPins & ~dir) | (data & dir);
129 dataRead = (data | ~dir) & (procPortPins | 0x17);
131 pla->setCpuPort((data | ~dir) & 0x07);
133 if ((dir & 0x20) == 0)
137 if (tape_sense && (dir & 0x10) == 0)
155 dataFalloffBit6 =
false;
156 dataFalloffBit7 =
false;
180 uint8_t
peek(uint_least16_t address)
189 if (dataFalloffBit6 || dataFalloffBit7)
191 const event_clock_t phi2time = pla->getPhi2Time();
194 if (dataFalloffBit6 && dataSetClkBit6 < phi2time)
196 dataFalloffBit6 =
false;
201 if (dataFalloffBit7 && dataSetClkBit7 < phi2time)
203 dataFalloffBit7 =
false;
208 uint8_t retval = dataRead;
216 retval |= dataSetBit6;
223 retval |= dataSetBit7;
229 return ramBank->
peek(address);
233 void poke(uint_least16_t address, uint8_t value)
243 if ((dir & 0x40) && !(value & 0x40))
245 dataSetClkBit6 = pla->getPhi2Time() + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES;
246 dataSetBit6 = data & 0x40;
247 dataFalloffBit6 =
true;
251 if ((dir & 0x80) && !(value & 0x80))
253 dataSetClkBit7 = pla->getPhi2Time() + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES;
254 dataSetBit7 = data & 0x80;
255 dataFalloffBit7 =
true;
263 value = pla->getLastReadByte();
271 dataSetBit6 = value & 0x40;
272 dataSetClkBit6 = pla->getPhi2Time() + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES;
273 dataFalloffBit6 =
true;
278 dataSetBit7 = value & 0x80;
279 dataSetClkBit7 = pla->getPhi2Time() + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES;
280 dataFalloffBit7 =
true;
288 value = pla->getLastReadByte();
294 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:233
Definition: SystemRAMBank.h:35
Definition: ZeroRAMBank.h:35
uint8_t peek(uint_least16_t address)
Definition: ZeroRAMBank.h:180
Definition: ZeroRAMBank.h:57
void poke(uint_least16_t address, uint8_t value)
Definition: SystemRAMBank.h:61