mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-26 15:32:04 +00:00
Realign fetching.
This commit is contained in:
parent
96896f838c
commit
e5b0e666cc
@ -71,8 +71,7 @@ template<bool use_end, typename SequencerT> void Base<personality>::dispatch(Seq
|
||||
#define index(n) \
|
||||
if(use_end && end == n) return; \
|
||||
[[fallthrough]]; \
|
||||
case n: fetcher.template fetch<(n + 171 - 16) % 171>(n);
|
||||
// `template fetch` call includes an in-place internal -> sync-aligned conversion for now, during transition.
|
||||
case n: fetcher.template fetch<n>(n);
|
||||
|
||||
switch(start) {
|
||||
default: assert(false);
|
||||
|
@ -216,20 +216,10 @@ template <Personality personality> struct Storage<personality, std::enable_if_t<
|
||||
}
|
||||
|
||||
private:
|
||||
// This emulator treats position 0 as being immediately after the standard pixel area.
|
||||
// i.e. offset 1282 on Grauw's http://map.grauw.nl/articles/vdp-vram-timing/vdp-timing.png
|
||||
static constexpr int ZeroAsGrauwIndex = 1282;
|
||||
constexpr static int grauw_to_internal(int offset) {
|
||||
return (offset + 1368 - ZeroAsGrauwIndex) % 1368;
|
||||
}
|
||||
constexpr static int internal_to_grauw(int offset) {
|
||||
return (offset + ZeroAsGrauwIndex) % 1368;
|
||||
}
|
||||
|
||||
template <typename GeneratorT> static constexpr size_t events_size() {
|
||||
size_t size = 0;
|
||||
for(int c = 0; c < 1368; c++) {
|
||||
const auto event_type = GeneratorT::event(internal_to_grauw(c));
|
||||
const auto event_type = GeneratorT::event(c);
|
||||
size += event_type.has_value();
|
||||
}
|
||||
return size + 1;
|
||||
@ -240,7 +230,7 @@ template <Personality personality> struct Storage<personality, std::enable_if_t<
|
||||
std::array<Event, size> result{};
|
||||
size_t index = 0;
|
||||
for(int c = 0; c < 1368; c++) {
|
||||
const auto event = GeneratorT::event(internal_to_grauw(c));
|
||||
const auto event = GeneratorT::event(c);
|
||||
if(!event) {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user