1#ifndef VDPACCESSSLOTS_HH
2#define VDPACCESSSLOTS_HH
31static constexpr int NUM_DELTAS = 15;
43 EmuTime::param limit_, std::span<const uint8_t, NUM_DELTAS * TICKS> tab_)
44 : ref(frame), tab(tab_)
46 assert(frame <= time);
47 assert(frame <= limit_);
52 int lines = ticks /
TICKS;
53 ticks -= lines *
TICKS;
54 limit -= lines *
TICKS;
56 assert(0 <= ticks); assert(ticks <
TICKS);
61 return ticks >= limit;
67 [[nodiscard]]
inline EmuTime
getTime()
const {
75 if (ticks >=
TICKS) [[unlikely]] {
86 std::span<const uint8_t, NUM_DELTAS * TICKS> tab;
92[[nodiscard]] EmuTime
getAccessSlot(EmuTime::param frame, EmuTime::param time,
Delta delta,
98 EmuTime::param frame, EmuTime::param time, EmuTime::param limit,
constexpr EmuTime getFastAdd(unsigned n) const
Like operator+() but faster, though the step can't be too big (max a little over 1 second).
constexpr unsigned getTicksTill_fast(EmuTime::param e) const
Same as above, only faster, Though the time interval may not be too large.
VDP-VRAM access slot calculator, meant to be used in the inner loops of the VDPCmdEngine commands.
Calculator(EmuTime::param frame, EmuTime::param time, EmuTime::param limit_, std::span< const uint8_t, NUM_DELTAS *TICKS > tab_)
This shouldn't be called directly, instead use getCalculator().
void next(Delta delta)
Advance time to the earliest access slot that is at least 'delta' ticks later than the current time.
bool limitReached() const
Has 'time' advanced to or past 'limit'?
EmuTime getTime() const
Get the current time.
Unified implementation of MSX Video Display Processors (VDPs).
static constexpr int TICKS_PER_LINE
Number of VDP clock ticks per line.
EmuTime getAccessSlot(EmuTime::param frame_, EmuTime::param time, Delta delta, const VDP &vdp)
Return the time of the next available access slot that is at least 'delta' cycles later than 'time'.
Calculator getCalculator(EmuTime::param frame, EmuTime::param time, EmuTime::param limit, const VDP &vdp)
When many calls to getAccessSlot() are needed, it's more efficient to instead use this function.
constexpr auto to_underlying(E e) noexcept