22 extraMemoryDelay[page] =
23 extraMemoryDelays[page][primarySlot][secondarySlot];
28 unsigned val = dram ? 0 : 1;
29 extraMemoryDelays[0][0][0] = val;
30 extraMemoryDelays[1][0][0] = val;
31 extraMemoryDelays[0][3][1] = val;
32 extraMemoryDelays[1][3][1] = val;
44 , lastRefreshTime(time)
49 for (
auto page :
xrange(4)) {
50 for (
auto prim :
xrange(4)) {
51 for (
auto sec :
xrange(4)) {
52 extraMemoryDelays[page][prim][sec] = [&] {
53 if (prim ==
one_of(1, 2)) {
56 }
else if ((prim == 3) && (sec == 0)) {
67 for (
auto page :
xrange(4)) {
68 extraMemoryDelay[page] = extraMemoryDelays[page][0][0];
77 template<
bool PRE_PB,
bool POST_PB>
80 int newPage = narrow<int>(address >> 8);
81 if constexpr (PRE_PB) {
85 if ((newPage != lastPage) ||
86 (extraMemoryDelay[address >> 14])) [[unlikely]] {
90 if constexpr (!POST_PB) {
94 template<
bool POST_PB>
97 add(extraMemoryDelay[address >> 14]);
98 if constexpr (POST_PB) {
102 template<
bool PRE_PB,
bool POST_PB>
105 int newPage = narrow<int>(address >> 8);
106 if constexpr (PRE_PB) {
109 if (extraMemoryDelay[address >> 14]) [[unlikely]] {
113 if (extraMemoryDelay[address >> 14]) [[unlikely]] {
115 }
else if (newPage != lastPage) [[unlikely]] {
119 if constexpr (!POST_PB) {
123 template<
bool POST_PB>
126 add(2 * extraMemoryDelay[address >> 14]);
127 if constexpr (POST_PB) {
147 lastRefreshTime += 210;
162 lastRefreshTime.
reset(time);
168 static constexpr int I = 6;
169 static constexpr int O = 1;
173 static constexpr int P = 1;
271 template<
typename Archive>
275 ar.serialize(
"lastRefreshTime", lastRefreshTime,
276 "lastPage", lastPage,
277 "extraMemoryDelay", extraMemoryDelay);
287 std::array<std::array<std::array<unsigned, 4>, 4>, 4> extraMemoryDelays;
288 std::array<unsigned, 4> extraMemoryDelay;
void serialize(Archive &ar, unsigned version)
EmuTime getTimeFast() const
void setTime(EmuTime::param time)
void waitForEvenCycle(int cc)
R800 runs at 7MHz, but I/O is done over a slower 3.5MHz bus.
Represents a clock with a fixed frequency.
constexpr void reset(EmuTime::param e)
Reset the clock to start ticking at the given time.
constexpr unsigned getTicksTill_fast(EmuTime::param e) const
Same as above, only faster, Though the time interval may not be too large.
static constexpr int CC_MULUB
static constexpr int CC_CPI
static constexpr int CC_LD_R_R
static constexpr int CC_NEG
static constexpr int CC_LD_HL_N_2
ALWAYS_INLINE void PRE_MEM(unsigned address)
static constexpr int CC_RETN
static constexpr int CC_CALL
static constexpr int CC_LD_HL_XX_2
static constexpr int CC_LD_XX_HL_1
static constexpr int CC_IM
static constexpr int CC_LD_R_HL_1
static constexpr int CC_JR_1
static constexpr int CC_LDI_2
static constexpr int CC_CPI_1
static constexpr int CC_LD_NN_A
static constexpr int CC_LD_HL_N_1
static constexpr int CC_PUSH_1
static constexpr int CC_BIT_XIX
static constexpr int CC_INC_XIX_1
static constexpr int CC_JP_A
void serialize(Archive &ar, unsigned version)
static constexpr int CC_BIT_XHL
static constexpr int CC_LD_NN_A_2
static constexpr int CC_LD_HL_XX_1
static constexpr int CC_BIT_XHL_1
static constexpr int CC_LD_XIX_N
static constexpr int CC_WRMEM
static constexpr int CC_NOP
static constexpr int CC_RST
static constexpr int CC_JR_B
ALWAYS_INLINE void PRE_WORD(unsigned address)
static constexpr int CC_LD_SS_NN
static constexpr int CC_LD_NN_A_1
static constexpr int CC_CP_XHL_1
static constexpr int EE_ED
static constexpr int CC_JP_HL
static constexpr int CC_CALL_A
static constexpr int CC_LD_SP_HL
static constexpr int CC_DI
ALWAYS_INLINE unsigned getMemPtr() const
static constexpr int CC_LD_A_NN_1
static constexpr int CC_INC_XIX
static constexpr int EE_IRQ1_1
static constexpr int CC_RLD
static constexpr int CC_LD_XIX_N_1
static constexpr int CC_NMI
static constexpr int CLOCK_FREQ
static constexpr bool IS_R800
static constexpr int CC_CP_XIX_1
static constexpr int CC_INC_SS
void setTime(EmuTime::param time)
static constexpr int CC_LD_A_SS_1
static constexpr int CC_RET_A
static constexpr int CC_IRQ1
static constexpr int CC_LD_HL_XX
static constexpr int EE_RET_C
ALWAYS_INLINE void R800ForcePageBreak()
static constexpr int CC_LD_SS_NN_1
static constexpr int CC_CALL_B
static constexpr int CC_LD_XIX_N_2
static constexpr int CC_RDMEM
static constexpr int CC_SET_XHL_1
static constexpr int CC_ADD_HL_SS
static constexpr int CC_BIT_R
static constexpr int CC_CP_XHL
static constexpr int CC_MULUW
static constexpr int CC_DAA
static constexpr int CC_MAIN
static constexpr int CC_LD_R_N
static constexpr int CC_BIT_XIX_1
static constexpr int CC_EI
static constexpr int CC_JP_B
static constexpr int CC_CCF
static constexpr int CC_LD_HL_N
static constexpr int CC_INC_XHL
static constexpr int CC_EX_SP_HL
static constexpr int CC_OUT_C_R
static constexpr int CC_EX
static constexpr int CC_PUSH
void updateVisiblePage(byte page, byte primarySlot, byte secondarySlot)
ALWAYS_INLINE void R800Refresh(CPURegs &R)
static constexpr int CC_RET_B
static constexpr int CC_SET_XHL
ALWAYS_INLINE void POST_WORD(unsigned address)
R800TYPE(EmuTime::param time, Scheduler &scheduler_)
static constexpr int CC_LD_HL_R
static constexpr int CC_LD_A_NN
static constexpr int CC_LD_R_XIX_1
static constexpr int CC_HALT
static constexpr int CC_EX_SP_HL_1
static constexpr int CC_SCF
static constexpr int CC_LD_XIX_R_2
static constexpr int CC_CP_N_1
static constexpr int CC_LD_R_HL
static constexpr int CC_LD_A_NN_2
static constexpr int CC_LD_SS_A
static constexpr int CC_EX_SP_HL_2
ALWAYS_INLINE void POST_MEM(unsigned address)
static constexpr int CC_CP_R
static constexpr int CC_LD_HL_R_1
static constexpr int CC_LD_XX_HL_2
static constexpr int CC_INI
static constexpr int CC_OUT_N_A_2
static constexpr unsigned HALT_STATES
static constexpr int EE_CALL
static constexpr int CC_LD_XIX_R
NEVER_INLINE void R800RefreshSlow(EmuTime::param time, CPURegs &R)
static constexpr int CC_CALL_1
static constexpr int CC_IRQ2
void setDRAMmode(bool dram)
static constexpr int CC_DJNZ
static constexpr int CC_OUT_C_R_1
static constexpr int CC_OTIR
static constexpr int CC_RLD_1
static constexpr int CC_LD_SS_A_1
static constexpr int CC_POP_1
static constexpr int EE_RETN
static constexpr int CC_LD_XX_HL
static constexpr int CC_SET_XIX
static constexpr int CC_IN_R_C
static constexpr int CC_IRQ0
static constexpr int CC_INC_R
static constexpr int CC_LDI
static constexpr int CC_LD_XIX_R_1
static constexpr int CC_CP_XIX
static constexpr int CC_DD
static constexpr int CC_OUT_N_A_1
static constexpr int CC_OUTI_1
static constexpr int CC_IN_A_N_1
ALWAYS_INLINE void setMemPtr(unsigned) const
static constexpr int CC_INC_XHL_1
static constexpr int CC_LDIR
static constexpr int CC_RLD_2
static constexpr int CC_IN_A_N
static constexpr int EE_NMI_1
static constexpr int CC_CPIR
static constexpr int CC_JR_A
static constexpr int CC_LD_R_XIX_2
static constexpr int EE_IRQ0_1
static constexpr int CC_LD_A_SS
static constexpr int CC_CPL
static constexpr int CC_IN_R_C_1
static constexpr int CC_SET_XHL_2
static constexpr int CC_INIR
static constexpr int CC_SET_R
static constexpr int CC_CP_XIX_2
static constexpr int EE_INC_XIX
static constexpr int CC_JP_1
static constexpr int EE_IRQ2_1
static constexpr int CC_OUTI
static constexpr int CC_LD_R_N_1
static constexpr int EE_DJNZ
static constexpr int CC_ADC_HL_SS
static constexpr int CC_LD_A_I
static constexpr int CC_OUTI_2
static constexpr int CC_CP_N
static constexpr int CC_LD_R_XIX
static constexpr int CC_DD_CB
static constexpr int CC_PREFIX
static constexpr int CC_POP
static constexpr int CC_INI_2
static constexpr int EE_SET_XIX
static constexpr int CC_IRQ2_2
static constexpr int CC_RLA
static constexpr int CC_INC_XHL_2
static constexpr int CC_OUT_N_A
static constexpr int CC_LDI_1
static constexpr int CC_INI_1
static constexpr int CC_IN_A_N_2
This file implemented 3 utility functions:
static constexpr bool value
constexpr auto xrange(T e)