mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-16 18:30:32 +00:00
Ensures the Master System is informed when it should pretend to be an SG1000.
This commit is contained in:
parent
f59386f523
commit
00b2db4fb9
@ -8,12 +8,25 @@
|
||||
|
||||
#include "StaticAnalyser.hpp"
|
||||
|
||||
#include "Target.hpp"
|
||||
|
||||
Analyser::Static::TargetList Analyser::Static::Sega::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
|
||||
TargetList targets;
|
||||
std::unique_ptr<Target> target(new Target);
|
||||
|
||||
target->machine = Machine::MasterSystem;
|
||||
|
||||
// Files named .sg are treated as for the SG1000; otherwise assume a Master System.
|
||||
if(file_name.size() >= 2 && *(file_name.end() - 2) == 's' && *(file_name.end() - 1) == 'g') {
|
||||
target->model = Target::Model::SG1000;
|
||||
} else {
|
||||
target->model = Target::Model::MasterSystem;
|
||||
}
|
||||
|
||||
target->media.cartridges = media.cartridges;
|
||||
|
||||
if(!target->media.empty())
|
||||
targets.push_back(std::move(target));
|
||||
|
||||
return targets;
|
||||
}
|
||||
|
29
Analyser/Static/Sega/Target.hpp
Normal file
29
Analyser/Static/Sega/Target.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
//
|
||||
// Target.hpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 23/09/2018.
|
||||
// Copyright © 2018 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef Analyser_Static_Sega_Target_h
|
||||
#define Analyser_Static_Sega_Target_h
|
||||
|
||||
namespace Analyser {
|
||||
namespace Static {
|
||||
namespace Sega {
|
||||
|
||||
struct Target: public ::Analyser::Static::Target {
|
||||
enum class Model {
|
||||
MasterSystem,
|
||||
SG1000
|
||||
};
|
||||
|
||||
Model model = Model::MasterSystem;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Analyser_Static_Sega_Target_h */
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include "../../Outputs/Speaker/Implementation/LowpassSpeaker.hpp"
|
||||
|
||||
#include "../../Analyser/Static/Sega/Target.hpp"
|
||||
|
||||
namespace {
|
||||
const int sn76489_divider = 2;
|
||||
}
|
||||
@ -33,7 +35,7 @@ class ConcreteMachine:
|
||||
public CRTMachine::Machine {
|
||||
|
||||
public:
|
||||
ConcreteMachine(const Analyser::Static::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||
ConcreteMachine(const Analyser::Static::Sega::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||
z80_(*this),
|
||||
sn76489_(TI::SN76489::Personality::SMS, audio_queue_, sn76489_divider),
|
||||
speaker_(sn76489_) {
|
||||
@ -104,17 +106,18 @@ class ConcreteMachine:
|
||||
break;
|
||||
|
||||
case CPU::Z80::PartialMachineCycle::Input:
|
||||
printf("Input %04x\n", address);
|
||||
*cycle.value = 0xff;
|
||||
switch(address & 0xc1) {
|
||||
case 0x00:
|
||||
printf("TODO: memory control\n");
|
||||
*cycle.value = 0xff;
|
||||
break;
|
||||
case 0x01:
|
||||
printf("TODO: I/O port control\n");
|
||||
*cycle.value = 0xff;
|
||||
break;
|
||||
case 0x40: case 0x41:
|
||||
printf("TODO: get current line\n");
|
||||
*cycle.value = 0xff;
|
||||
break;
|
||||
case 0x80: case 0x81:
|
||||
update_video();
|
||||
@ -124,9 +127,11 @@ class ConcreteMachine:
|
||||
break;
|
||||
case 0xc0:
|
||||
printf("TODO: I/O port A/N\n");
|
||||
*cycle.value = 0;
|
||||
break;
|
||||
case 0xc1:
|
||||
printf("TODO: I/O port B/misc\n");
|
||||
*cycle.value = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -219,7 +224,9 @@ class ConcreteMachine:
|
||||
using namespace Sega::MasterSystem;
|
||||
|
||||
Machine *Machine::MasterSystem(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) {
|
||||
return new ConcreteMachine(*target, rom_fetcher);
|
||||
using Target = Analyser::Static::Sega::Target;
|
||||
const Target *const sega_target = dynamic_cast<const Target *>(target);
|
||||
return new ConcreteMachine(*sega_target, rom_fetcher);
|
||||
}
|
||||
|
||||
Machine::~Machine() {}
|
||||
|
@ -1042,6 +1042,7 @@
|
||||
4BA61EAE1D91515900B3C876 /* NSData+StdVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+StdVector.h"; sourceTree = "<group>"; };
|
||||
4BA61EAF1D91515900B3C876 /* NSData+StdVector.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSData+StdVector.mm"; sourceTree = "<group>"; };
|
||||
4BA9C3CF1D8164A9002DDB61 /* MediaTarget.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MediaTarget.hpp; sourceTree = "<group>"; };
|
||||
4BAA167B21582B1D008A3276 /* Target.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = "<group>"; };
|
||||
4BAB62AC1D3272D200DF5BA0 /* Disk.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Disk.hpp; sourceTree = "<group>"; };
|
||||
4BAB62AE1D32730D00DF5BA0 /* Storage.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Storage.hpp; sourceTree = "<group>"; };
|
||||
4BAF2B4C2004580C00480230 /* DMK.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DMK.cpp; sourceTree = "<group>"; };
|
||||
@ -2213,6 +2214,7 @@
|
||||
children = (
|
||||
4B7F1895215486A100388727 /* StaticAnalyser.hpp */,
|
||||
4B7F1896215486A100388727 /* StaticAnalyser.cpp */,
|
||||
4BAA167B21582B1D008A3276 /* Target.hpp */,
|
||||
);
|
||||
path = Sega;
|
||||
sourceTree = "<group>";
|
||||
|
Loading…
x
Reference in New Issue
Block a user