53 template<
typename CPU_POLICY>
66 void doReset(EmuTime::param time);
82 void warp(EmuTime::param time);
84 void wait(EmuTime::param time);
85 EmuTime
waitCycles(EmuTime::param time,
unsigned cycles);
88 return {readCacheLine, writeCacheLine};
90 [[nodiscard]]
bool isM1Cycle(
unsigned address)
const;
93 std::span<const TclObject> tokens,
125 template<
typename Archive>
126 void serialize(Archive& ar,
unsigned version);
129 void execute2(
bool fastForward);
130 [[nodiscard]]
bool needExitCPULoop();
131 void setSlowInstructions();
158 int slowInstructions;
168 std::atomic<bool> exitLoop;
177 inline void cpuTracePre();
178 inline void cpuTracePost();
179 void cpuTracePost_slow();
181 inline byte READ_PORT(
unsigned port,
unsigned cc);
182 inline void WRITE_PORT(
unsigned port,
byte value,
unsigned cc);
184 template<
bool PRE_PB,
bool POST_PB>
185 byte RDMEMslow(
unsigned address,
unsigned cc);
186 template<
bool PRE_PB,
bool POST_PB>
187 inline byte RDMEM_impl2(
unsigned address,
unsigned cc);
188 template<
bool PRE_PB,
bool POST_PB>
189 inline byte RDMEM_impl (
unsigned address,
unsigned cc);
190 template<
unsigned PC_OFFSET>
191 inline byte RDMEM_OPCODE(
unsigned cc);
192 inline byte RDMEM(
unsigned address,
unsigned cc);
194 template<
bool PRE_PB,
bool POST_PB>
195 unsigned RD_WORD_slow(
unsigned address,
unsigned cc);
196 template<
bool PRE_PB,
bool POST_PB>
197 inline unsigned RD_WORD_impl2(
unsigned address,
unsigned cc);
198 template<
bool PRE_PB,
bool POST_PB>
199 inline unsigned RD_WORD_impl (
unsigned address,
unsigned cc);
200 template<
unsigned PC_OFFSET>
201 inline unsigned RD_WORD_PC(
unsigned cc);
202 inline unsigned RD_WORD(
unsigned address,
unsigned cc);
204 template<
bool PRE_PB,
bool POST_PB>
205 void WRMEMslow(
unsigned address,
byte value,
unsigned cc);
206 template<
bool PRE_PB,
bool POST_PB>
207 inline void WRMEM_impl2(
unsigned address,
byte value,
unsigned cc);
208 template<
bool PRE_PB,
bool POST_PB>
209 inline void WRMEM_impl (
unsigned address,
byte value,
unsigned cc);
210 inline void WRMEM(
unsigned address,
byte value,
unsigned cc);
212 void WR_WORD_slow(
unsigned address,
unsigned value,
unsigned cc);
213 inline void WR_WORD(
unsigned address,
unsigned value,
unsigned cc);
215 template<
bool PRE_PB,
bool POST_PB>
216 void WR_WORD_rev_slow(
unsigned address,
unsigned value,
unsigned cc);
217 template<
bool PRE_PB,
bool POST_PB>
218 inline void WR_WORD_rev2(
unsigned address,
unsigned value,
unsigned cc);
219 template<
bool PRE_PB,
bool POST_PB>
220 inline void WR_WORD_rev (
unsigned address,
unsigned value,
unsigned cc);
222 void executeInstructions();
227 [[nodiscard]]
ExecIRQ getExecIRQ()
const;
228 void executeSlow(
ExecIRQ execIRQ);
230 template<Reg8> [[nodiscard]]
inline byte get8()
const;
231 template<Reg16> [[nodiscard]]
inline unsigned get16()
const;
232 template<Reg8>
inline void set8 (
byte x);
233 template<Reg16>
inline void set16(
unsigned x);
235 template<Reg8 DST, Reg8 SRC,
int EE>
inline II ld_R_R();
236 template<Reg16 REG,
int EE>
inline II ld_sp_SS();
237 template<Reg16 REG>
inline II ld_SS_a();
238 template<Reg8 SRC>
inline II ld_xhl_R();
239 template<Reg16 IXY, Reg8 SRC>
inline II ld_xix_R();
241 inline II ld_xhl_byte();
242 template<Reg16 IXY>
inline II ld_xix_byte();
244 template<
int EE>
inline II WR_NN_Y(
unsigned reg);
245 template<Reg16 REG,
int EE>
inline II ld_xword_SS();
246 template<Reg16 REG>
inline II ld_xword_SS_ED();
247 template<Reg16 REG>
inline II ld_a_SS();
249 inline II ld_xbyte_a();
250 inline II ld_a_xbyte();
252 template<Reg8 DST,
int EE>
inline II ld_R_byte();
253 template<Reg8 DST>
inline II ld_R_xhl();
254 template<Reg8 DST, Reg16 IXY>
inline II ld_R_xix();
256 template<
int EE>
inline unsigned RD_P_XX();
257 template<Reg16 REG,
int EE>
inline II ld_SS_xword();
258 template<Reg16 REG>
inline II ld_SS_xword_ED();
260 template<Reg16 REG,
int EE>
inline II ld_SS_word();
262 inline void ADC(
byte reg);
264 template<Reg8 SRC,
int EE>
inline II adc_a_R();
265 inline II adc_a_byte();
266 inline II adc_a_xhl();
267 template<Reg16 IXY>
inline II adc_a_xix();
269 inline void ADD(
byte reg);
271 template<Reg8 SRC,
int EE>
inline II add_a_R();
272 inline II add_a_byte();
273 inline II add_a_xhl();
274 template<Reg16 IXY>
inline II add_a_xix();
276 inline void AND(
byte reg);
278 template<Reg8 SRC,
int EE>
inline II and_R();
279 inline II and_byte();
281 template<Reg16 IXY>
inline II and_xix();
283 inline void CP(
byte reg);
285 template<Reg8 SRC,
int EE>
inline II cp_R();
288 template<Reg16 IXY>
inline II cp_xix();
290 inline void OR(
byte reg);
292 template<Reg8 SRC,
int EE>
inline II or_R();
295 template<Reg16 IXY>
inline II or_xix();
297 inline void SBC(
byte reg);
299 template<Reg8 SRC,
int EE>
inline II sbc_a_R();
300 inline II sbc_a_byte();
301 inline II sbc_a_xhl();
302 template<Reg16 IXY>
inline II sbc_a_xix();
304 inline void SUB(
byte reg);
306 template<Reg8 SRC,
int EE>
inline II sub_R();
307 inline II sub_byte();
309 template<Reg16 IXY>
inline II sub_xix();
311 inline void XOR(
byte reg);
313 template<Reg8 SRC,
int EE>
inline II xor_R();
314 inline II xor_byte();
316 template<Reg16 IXY>
inline II xor_xix();
318 inline byte DEC(
byte reg);
319 template<Reg8 REG,
int EE>
inline II dec_R();
320 template<
int EE>
inline void DEC_X(
unsigned x);
322 template<Reg16 IXY>
inline II dec_xix();
324 inline byte INC(
byte reg);
325 template<Reg8 REG,
int EE>
inline II inc_R();
326 template<
int EE>
inline void INC_X(
unsigned x);
328 template<Reg16 IXY>
inline II inc_xix();
330 template<Reg16 REG>
inline II adc_hl_SS();
331 inline II adc_hl_hl();
332 template<Reg16 REG1, Reg16 REG2,
int EE>
inline II add_SS_TT();
333 template<Reg16 REG,
int EE>
inline II add_SS_SS();
334 template<Reg16 REG>
inline II sbc_hl_SS();
335 inline II sbc_hl_hl();
337 template<Reg16 REG,
int EE>
inline II dec_SS();
338 template<Reg16 REG,
int EE>
inline II inc_SS();
340 template<
unsigned N, Reg8 REG>
inline II bit_N_R();
341 template<
unsigned N>
inline II bit_N_xhl();
342 template<
unsigned N>
inline II bit_N_xix(
unsigned a);
344 template<
unsigned N, Reg8 REG>
inline II res_N_R();
345 template<
int EE>
inline byte RES_X(
unsigned bit,
unsigned addr);
346 template<
unsigned N>
inline II res_N_xhl();
347 template<
unsigned N, Reg8 REG>
inline II res_N_xix_R(
unsigned a);
349 template<
unsigned N, Reg8 REG>
inline II set_N_R();
350 template<
int EE>
inline byte SET_X(
unsigned bit,
unsigned addr);
351 template<
unsigned N>
inline II set_N_xhl();
352 template<
unsigned N, Reg8 REG>
inline II set_N_xix_R(
unsigned a);
354 inline byte RL(
byte reg);
355 template<
int EE>
inline byte RL_X(
unsigned x);
356 template<Reg8 REG>
inline II rl_R();
358 template<Reg8 REG>
inline II rl_xix_R(
unsigned a);
360 inline byte RLC(
byte reg);
361 template<
int EE>
inline byte RLC_X(
unsigned x);
362 template<Reg8 REG>
inline II rlc_R();
364 template<Reg8 REG>
inline II rlc_xix_R(
unsigned a);
366 inline byte RR(
byte reg);
367 template<
int EE>
inline byte RR_X(
unsigned x);
368 template<Reg8 REG>
inline II rr_R();
370 template<Reg8 REG>
inline II rr_xix_R(
unsigned a);
372 inline byte RRC(
byte reg);
373 template<
int EE>
inline byte RRC_X(
unsigned x);
374 template<Reg8 REG>
inline II rrc_R();
376 template<Reg8 REG>
inline II rrc_xix_R(
unsigned a);
378 inline byte SLA(
byte reg);
379 template<
int EE>
inline byte SLA_X(
unsigned x);
380 template<Reg8 REG>
inline II sla_R();
382 template<Reg8 REG>
inline II sla_xix_R(
unsigned a);
384 inline byte SLL(
byte reg);
385 template<
int EE>
inline byte SLL_X(
unsigned x);
386 template<Reg8 REG>
inline II sll_R();
388 template<Reg8 REG>
inline II sll_xix_R(
unsigned a);
391 inline byte SRA(
byte reg);
392 template<
int EE>
inline byte SRA_X(
unsigned x);
393 template<Reg8 REG>
inline II sra_R();
395 template<Reg8 REG>
inline II sra_xix_R(
unsigned a);
397 inline byte SRL(
byte reg);
398 template<
int EE>
inline byte SRL_X(
unsigned x);
399 template<Reg8 REG>
inline II srl_R();
401 template<Reg8 REG>
inline II srl_xix_R(
unsigned a);
411 template<
int EE>
inline void PUSH(
unsigned reg);
412 template<Reg16 REG,
int EE>
inline II push_SS();
413 template<
int EE>
inline unsigned POP();
414 template<Reg16 REG,
int EE>
inline II pop_SS();
416 template<
typename COND>
inline II call(COND cond);
417 template<
unsigned ADDR>
inline II rst();
419 template<
int EE,
typename COND>
inline II RET(COND cond);
420 template<
typename COND>
inline II ret(COND cond);
424 template<Reg16 REG,
int EE>
inline II jp_SS();
425 template<
typename COND>
inline II jp(COND cond);
426 template<
typename COND>
inline II jr(COND cond);
429 template<Reg16 REG,
int EE>
inline II ex_xsp_SS();
431 template<Reg8 REG>
inline II in_R_c();
432 inline II in_a_byte();
433 template<Reg8 REG>
inline II out_c_R();
435 inline II out_byte_a();
437 inline II BLOCK_CP(
int increase,
bool repeat);
443 inline II BLOCK_LD(
int increase,
bool repeat);
449 inline II BLOCK_IN(
int increase,
bool repeat);
455 inline II BLOCK_OUT(
int increase,
bool repeat);
467 inline II ex_af_af();
468 inline II ex_de_hl();
473 template<
unsigned N>
inline II im_N();
475 template<Reg8 REG>
inline II ld_a_IR();
479 template<Reg8 REG>
inline II mulub_a_R();
480 template<Reg16 REG>
inline II muluw_hl_SS();
void lowerIRQ()
Lowers the maskable interrupt count.
void setNextSyncPoint(EmuTime::param time)
void disasmCommand(Interpreter &interp, std::span< const TclObject > tokens, TclObject &result) const
void setFreq(unsigned freq)
Change the clock freq.
void execute(bool fastForward)
void warp(EmuTime::param time)
CPUCore(MSXMotherBoard &motherboard, const std::string &name, const BooleanSetting &traceSetting, TclCallback &diHaltCallback, EmuTime::param time)
void lowerNMI()
Lowers the non-maskable interrupt count.
void exitCPULoopSync()
Request to exit the main CPU emulation loop.
EmuTime::param getCurrentTime() const
void exitCPULoopAsync()
Similar to exitCPULoopSync(), but this method may be called from any thread.
void raiseNMI()
Raises the non-maskable interrupt count.
void serialize(Archive &ar, unsigned version)
void doReset(EmuTime::param time)
Reset the CPU.
void setInterface(MSXCPUInterface *interf)
void wait(EmuTime::param time)
EmuTime waitCycles(EmuTime::param time, unsigned cycles)
bool isM1Cycle(unsigned address) const
CacheLines getCacheLines()
void raiseIRQ()
Raises the maskable interrupt count.
A Setting with an integer value.
This file implemented 3 utility functions:
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
constexpr KeyMatrixPosition x
Keyboard bindings.
constexpr void repeat(T n, Op op)
Repeat the given operation 'op' 'n' times.