82 friend void MOS6510Debug::DumpState(event_clock_t time,
MOS6510 &cpu);
85 class haltInstruction {
87 const std::string m_msg;
90 explicit haltInstruction(
const std::string &msg) :
93 std::string message()
const {
return m_msg; }
102 static constexpr int MAX = 65536;
105 static constexpr uint8_t SP_PAGE = 0x01;
112 struct ProcessorCycle
135 bool irqAssertedOnPin;
152 bool rdyOnThrowAwayRead;
158 uint_least16_t Register_ProgramCounter;
159 uint_least16_t Cycle_EffectiveAddress;
160 uint_least16_t Cycle_Pointer;
163 uint8_t Register_StackPointer;
164 uint8_t Register_Accumulator;
169 struct ProcessorCycle instrTable[0x101 << 3];
172 std::unique_ptr<CPUDebug> cpu_debug;
175 void eventWithoutSteals();
176 void eventWithSteals();
187 inline void Initialise();
190 inline void IRQLoRequest();
191 inline void IRQHiRequest();
192 inline void interruptsAndNextOpcode();
193 inline void calculateInterruptTriggerCycle();
196 inline void fetchNextOpcode();
197 inline void throwAwayFetch();
198 inline void throwAwayRead();
199 inline void FetchDataByte();
200 inline void FetchLowAddr();
201 inline void FetchLowAddrX();
202 inline void FetchLowAddrY();
203 inline void FetchHighAddr();
204 inline void FetchHighAddrX();
205 inline void FetchHighAddrX2();
206 inline void FetchHighAddrY();
207 inline void FetchHighAddrY2();
208 inline void FetchLowEffAddr();
209 inline void FetchHighEffAddr();
210 inline void FetchHighEffAddrY();
211 inline void FetchHighEffAddrY2();
212 inline void FetchLowPointer();
213 inline void FetchLowPointerX();
214 inline void FetchHighPointer();
215 inline void FetchEffAddrDataByte();
216 inline void PutEffAddrDataByte();
217 inline void PushLowPC();
218 inline void PushHighPC();
219 inline void PushSR();
220 inline void PopLowPC();
221 inline void PopHighPC();
223 inline void brkPushLowPC();
224 inline void WasteCycle();
226 inline void Push(uint8_t data);
227 inline uint8_t Pop();
228 inline void compare(uint8_t data);
231 inline void adc_instr();
232 inline void alr_instr();
233 inline void anc_instr();
234 inline void and_instr();
235 inline void ane_instr();
236 inline void arr_instr();
237 inline void asl_instr();
238 inline void asla_instr();
239 inline void aso_instr();
240 inline void axa_instr();
241 inline void axs_instr();
242 inline void bcc_instr();
243 inline void bcs_instr();
244 inline void beq_instr();
245 inline void bit_instr();
246 inline void bmi_instr();
247 inline void bne_instr();
248 inline void branch_instr(
bool condition);
249 inline void fix_branch();
250 inline void bpl_instr();
251 inline void bvc_instr();
252 inline void bvs_instr();
253 inline void clc_instr();
254 inline void cld_instr();
255 inline void cli_instr();
256 inline void clv_instr();
257 inline void cmp_instr();
258 inline void cpx_instr();
259 inline void cpy_instr();
260 inline void dcm_instr();
261 inline void dec_instr();
262 inline void dex_instr();
263 inline void dey_instr();
264 inline void eor_instr();
265 inline void inc_instr();
266 inline void ins_instr();
267 inline void inx_instr();
268 inline void iny_instr();
269 inline void jmp_instr();
270 inline void las_instr();
271 inline void lax_instr();
272 inline void lda_instr();
273 inline void ldx_instr();
274 inline void ldy_instr();
275 inline void lse_instr();
276 inline void lsr_instr();
277 inline void lsra_instr();
278 inline void oal_instr();
279 inline void ora_instr();
280 inline void pha_instr();
281 inline void pla_instr();
282 inline void rla_instr();
283 inline void rol_instr();
284 inline void rola_instr();
285 inline void ror_instr();
286 inline void rora_instr();
287 inline void rra_instr();
288 inline void rti_instr();
289 inline void rts_instr();
290 inline void sbx_instr();
291 inline void say_instr();
292 inline void sbc_instr();
293 inline void sec_instr();
294 inline void sed_instr();
295 inline void sei_instr();
296 inline void shs_instr();
297 inline void sta_instr();
298 inline void stx_instr();
299 inline void sty_instr();
300 inline void tax_instr();
301 inline void tay_instr();
302 inline void tsx_instr();
303 inline void txa_instr();
304 inline void txs_instr();
305 inline void tya_instr();
306 inline void xas_instr();
307 inline void sh_instr();
312 void invalidOpcode();
318 inline bool checkInterrupts()
const {
return rstFlag || nmiFlag || (irqAssertedOnPin && !flags.getI()); }
320 inline void buildInstructionTable();
323 MOS6510(EventScheduler &scheduler, CPUDataBus& bus);
325 inline uint8_t cpuRead(uint_least16_t addr) {
return dataBus.cpuRead(addr); }
327 inline void cpuWrite(uint_least16_t addr, uint8_t data) { dataBus.cpuWrite(addr, data); }
333 void debug(
bool enable, FILE *out);