From 561e2b774e04b9eff8e6b4db26711b7420a1f1d4 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 30 Apr 2023 17:24:14 -0400 Subject: [PATCH] Unify numbered and named slots. --- Components/9918/Implementation/Fetch.hpp | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Components/9918/Implementation/Fetch.hpp b/Components/9918/Implementation/Fetch.hpp index 0df3e8d2f..6d0bda432 100644 --- a/Components/9918/Implementation/Fetch.hpp +++ b/Components/9918/Implementation/Fetch.hpp @@ -71,7 +71,7 @@ template void Base::dispatch(Seq #define index(n) \ if(use_end && end == n) return; \ [[fallthrough]]; \ - case n: fetcher.template fetch(n); + case n: fetcher.template fetch(); switch(start) { default: assert(false); @@ -388,9 +388,9 @@ template struct RefreshSequencer { RefreshSequencer(Base *base) : base(base) {} - template void fetch(int c) { + template void fetch() { if(cycle < 26 || (cycle & 1) || cycle >= 154) { - base->do_external_slot(to_internal(c)); + base->do_external_slot(to_internal(cycle)); } } @@ -401,10 +401,10 @@ template struct TextSequencer { template TextSequencer(Args&&... args) : fetcher(std::forward(args)...) {} - template void fetch(int c) { + template void fetch() { // The first 30 and the final 4 slots are external. if constexpr (cycle < 30 || cycle >= 150) { - fetcher.base->do_external_slot(to_internal(c)); + fetcher.base->do_external_slot(to_internal(cycle)); return; } else { // For the 120 slots in between follow a three-step pattern of: @@ -412,7 +412,7 @@ struct TextSequencer { constexpr auto column = AddressT(offset / 3); switch(offset % 3) { case 0: fetcher.fetch_name(column); break; // (1) fetch tile name. - case 1: fetcher.base->do_external_slot(to_internal(c)); break; // (2) external slot. + case 1: fetcher.base->do_external_slot(to_internal(cycle)); break; // (2) external slot. case 2: fetcher.fetch_pattern(column); break; // (3) fetch tile pattern. } } @@ -428,9 +428,9 @@ struct CharacterSequencer { character_fetcher(std::forward(args)...), sprite_fetcher(std::forward(args)...) {} - template void fetch(int c) { + template void fetch() { if(cycle < 5) { - character_fetcher.base->do_external_slot(to_internal(c)); + character_fetcher.base->do_external_slot(to_internal(cycle)); } if(cycle == 5) { @@ -441,7 +441,7 @@ struct CharacterSequencer { } if(cycle > 14 && cycle < 19) { - character_fetcher.base->do_external_slot(to_internal(c)); + character_fetcher.base->do_external_slot(to_internal(cycle)); } // Fetch 8 new sprite Y coordinates, to begin selecting sprites for next line. @@ -459,7 +459,7 @@ struct CharacterSequencer { case 0: character_fetcher.fetch_name(block); break; case 1: if(!(block & 3)) { - character_fetcher.base->do_external_slot(to_internal(c)); + character_fetcher.base->do_external_slot(to_internal(cycle)); } else { constexpr int sprite = 8 + ((block >> 2) * 3) + ((block & 3) - 1); sprite_fetcher.fetch_y(sprite); @@ -474,7 +474,7 @@ struct CharacterSequencer { } if(cycle >= 155 && cycle < 157) { - character_fetcher.base->do_external_slot(to_internal(c)); + character_fetcher.base->do_external_slot(to_internal(cycle)); } if(cycle == 157) { @@ -520,9 +520,9 @@ struct SMSSequencer { // Cf. https://www.smspower.org/forums/16485-GenesisMode4VRAMTiming with this implementation pegging // window 0 to HSYNC low. - template void fetch(int c) { + template void fetch() { if(cycle < 3) { - fetcher.base->do_external_slot(to_internal(c)); + fetcher.base->do_external_slot(to_internal(cycle)); } if(cycle == 3) { @@ -533,7 +533,7 @@ struct SMSSequencer { } if(cycle == 15 || cycle == 16) { - fetcher.base->do_external_slot(to_internal(c)); + fetcher.base->do_external_slot(to_internal(cycle)); } if(cycle == 17) { @@ -554,7 +554,7 @@ struct SMSSequencer { case 0: fetcher.fetch_tile_name(block); break; case 1: if(!(block & 3)) { - fetcher.base->do_external_slot(to_internal(c)); + fetcher.base->do_external_slot(to_internal(cycle)); } else { constexpr int sprite = (8 + ((block >> 2) * 3) + ((block & 3) - 1)) << 1; fetcher.posit_sprite(sprite); @@ -566,7 +566,7 @@ struct SMSSequencer { } if(cycle >= 153 && cycle < 157) { - fetcher.base->do_external_slot(to_internal(c)); + fetcher.base->do_external_slot(to_internal(cycle)); } if(cycle == 157) { @@ -577,7 +577,7 @@ struct SMSSequencer { } if(cycle >= 169) { - fetcher.base->do_external_slot(to_internal(c)); + fetcher.base->do_external_slot(to_internal(cycle)); } }