diff --git a/Components/9918/9918.cpp b/Components/9918/9918.cpp index 0f3c91852..640596409 100644 --- a/Components/9918/9918.cpp +++ b/Components/9918/9918.cpp @@ -89,14 +89,12 @@ constexpr ReverseTable reverse_table; } template -Base::Base(Personality p) : - personality_(p), +Base::Base() : crt_(CRTCyclesPerLine, CRTCyclesDivider, Outputs::Display::Type::NTSC60, Outputs::Display::InputDataType::Red8Green8Blue8) { // Unimaginatively, this class just passes RGB through to the shader. Investigation is needed // into whether there's a more natural form. It feels unlikely given the diversity of chips modelled. - ram_.resize(memory_size(p)); - if(is_sega_vdp(personality_)) { + if constexpr (is_sega_vdp(personality)) { mode_timing_.line_interrupt_position = 64; mode_timing_.end_of_frame_interrupt_position.column = 63; @@ -112,8 +110,7 @@ Base::Base(Personality p) : } template -TMS9918::TMS9918(Personality p): - Base(p) { +TMS9918::TMS9918() { this->crt_.set_display_type(Outputs::Display::DisplayType::RGB); this->crt_.set_visible_area(Outputs::Display::Rect(0.07f, 0.0375f, 0.875f, 0.875f)); @@ -514,7 +511,7 @@ template void Base::output_border(int cycles, uint32_t cram_dot) { cycles *= 4; const uint32_t border_colour = - is_sega_vdp(personality_) ? + is_sega_vdp(personality) ? master_system_.colour_ram[16 + background_colour_] : palette[background_colour_]; diff --git a/Components/9918/9918.hpp b/Components/9918/9918.hpp index 31db277e1..8888d8767 100644 --- a/Components/9918/9918.hpp +++ b/Components/9918/9918.hpp @@ -61,7 +61,7 @@ template class TMS9918: public Base { Constructs an instance of the drive controller that behaves according to personality @c p. @param p The type of controller to emulate. */ - TMS9918(Personality p); + TMS9918(); /*! Sets the TV standard for this TMS, if that is hard-coded in hardware. */ void set_tv_standard(TVStandard standard); diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index 552005383..496f30ddf 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -12,6 +12,7 @@ #include "../../../Outputs/CRT/CRT.hpp" #include "../../../ClockReceiver/ClockReceiver.hpp" +#include #include #include #include @@ -158,14 +159,13 @@ template class Base { palette_pack(255, 255, 255) }; - Base(Personality p); + Base(); - const Personality personality_; Outputs::CRT::CRT crt_; TVStandard tv_standard_ = TVStandard::NTSC; // Holds the contents of this VDP's connected DRAM. - std::vector ram_; + std::array ram_; // Holds the state of the DRAM/CRAM-access mechanism. uint16_t ram_pointer_ = 0; @@ -312,10 +312,12 @@ template class Base { return; } - if(is_sega_vdp(personality_) && master_system_.mode4_enable) { - screen_mode_ = ScreenMode::SMSMode4; - mode_timing_.maximum_visible_sprites = 8; - return; + if constexpr (is_sega_vdp(personality)) { + if(master_system_.mode4_enable) { + screen_mode_ = ScreenMode::SMSMode4; + mode_timing_.maximum_visible_sprites = 8; + return; + } } mode_timing_.maximum_visible_sprites = 4; diff --git a/Machines/ColecoVision/ColecoVision.cpp b/Machines/ColecoVision/ColecoVision.cpp index 1b6cec505..8349bbef6 100644 --- a/Machines/ColecoVision/ColecoVision.cpp +++ b/Machines/ColecoVision/ColecoVision.cpp @@ -117,7 +117,6 @@ class ConcreteMachine: public: ConcreteMachine(const Analyser::Static::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) : z80_(*this), - vdp_(TI::TMS::TMS9918A), sn76489_(TI::SN76489::Personality::SN76489, audio_queue_, sn76489_divider), ay_(GI::AY38910::Personality::AY38910, audio_queue_), mixer_(sn76489_, ay_), diff --git a/Machines/MSX/MSX.cpp b/Machines/MSX/MSX.cpp index 16752fdcf..6bc06bda0 100644 --- a/Machines/MSX/MSX.cpp +++ b/Machines/MSX/MSX.cpp @@ -146,7 +146,6 @@ class ConcreteMachine: ConcreteMachine(const Target &target, const ROMMachine::ROMFetcher &rom_fetcher): z80_(*this), - vdp_(TI::TMS::TMS9918A), i8255_(i8255_port_handler_), ay_(GI::AY38910::Personality::AY38910, audio_queue_), audio_toggle_(audio_queue_), diff --git a/Machines/MasterSystem/MasterSystem.cpp b/Machines/MasterSystem/MasterSystem.cpp index 5b233b7a2..c8db0256a 100644 --- a/Machines/MasterSystem/MasterSystem.cpp +++ b/Machines/MasterSystem/MasterSystem.cpp @@ -94,7 +94,6 @@ class ConcreteMachine: region_(target.region), paging_scheme_(target.paging_scheme), z80_(*this), - vdp_(tms_personality_for_model(target.model)), sn76489_( (target.model == Target::Model::SG1000) ? TI::SN76489::Personality::SN76489 : TI::SN76489::Personality::SMS, audio_queue_, @@ -486,7 +485,7 @@ class ConcreteMachine: const Target::Region region_; const Target::PagingScheme paging_scheme_; CPU::Z80::Processor z80_; - JustInTimeActor> vdp_; // TODO. + JustInTimeActor> vdp_; // TODO: use tms_personality_for_model Concurrency::AsyncTaskQueue audio_queue_; TI::SN76489 sn76489_;