mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Eliminate runtime duplication of personality.
This commit is contained in:
parent
b7c315058f
commit
ffb0b2ce0b
@ -89,14 +89,12 @@ constexpr ReverseTable reverse_table;
|
||||
}
|
||||
|
||||
template <Personality personality>
|
||||
Base<personality>::Base(Personality p) :
|
||||
personality_(p),
|
||||
Base<personality>::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<personality>::Base(Personality p) :
|
||||
}
|
||||
|
||||
template <Personality personality>
|
||||
TMS9918<personality>::TMS9918(Personality p):
|
||||
Base<personality>(p) {
|
||||
TMS9918<personality>::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 <Personality personality>
|
||||
void Base<personality>::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_];
|
||||
|
||||
|
@ -61,7 +61,7 @@ template <Personality personality> class TMS9918: public Base<personality> {
|
||||
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);
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "../../../Outputs/CRT/CRT.hpp"
|
||||
#include "../../../ClockReceiver/ClockReceiver.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
@ -158,14 +159,13 @@ template <Personality personality> 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<uint8_t> ram_;
|
||||
std::array<uint8_t, memory_size(personality)> ram_;
|
||||
|
||||
// Holds the state of the DRAM/CRAM-access mechanism.
|
||||
uint16_t ram_pointer_ = 0;
|
||||
@ -312,10 +312,12 @@ template <Personality personality> 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;
|
||||
|
@ -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_),
|
||||
|
@ -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_),
|
||||
|
@ -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<ConcreteMachine, false, false> z80_;
|
||||
JustInTimeActor<TI::TMS::TMS9918<TI::TMS::Personality::SMSVDP>> vdp_; // TODO.
|
||||
JustInTimeActor<TI::TMS::TMS9918<TI::TMS::Personality::SMSVDP>> vdp_; // TODO: use tms_personality_for_model
|
||||
|
||||
Concurrency::AsyncTaskQueue<false> audio_queue_;
|
||||
TI::SN76489 sn76489_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user