2016-09-01 00:43:29 +00:00
|
|
|
//
|
|
|
|
// CSStaticAnalyser.m
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 31/08/2016.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2016 Thomas Harte. All rights reserved.
|
2016-09-01 00:43:29 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#import "CSStaticAnalyser.h"
|
|
|
|
|
|
|
|
#import "CSMachine.h"
|
|
|
|
#import "CSMachine+Target.h"
|
|
|
|
|
2016-10-12 02:20:13 +00:00
|
|
|
#include "StaticAnalyser.hpp"
|
|
|
|
|
2018-04-03 02:42:41 +00:00
|
|
|
#include "../../../../../Analyser/Static/Acorn/Target.hpp"
|
2021-08-07 01:58:31 +00:00
|
|
|
#include "../../../../../Analyser/Static/Amiga/Target.hpp"
|
2018-04-03 02:42:41 +00:00
|
|
|
#include "../../../../../Analyser/Static/AmstradCPC/Target.hpp"
|
2018-04-24 04:14:45 +00:00
|
|
|
#include "../../../../../Analyser/Static/AppleII/Target.hpp"
|
2020-10-21 02:18:11 +00:00
|
|
|
#include "../../../../../Analyser/Static/AppleIIgs/Target.hpp"
|
2020-03-15 04:13:38 +00:00
|
|
|
#include "../../../../../Analyser/Static/AtariST/Target.hpp"
|
2018-04-03 02:42:41 +00:00
|
|
|
#include "../../../../../Analyser/Static/Commodore/Target.hpp"
|
2021-06-15 00:55:39 +00:00
|
|
|
#include "../../../../../Analyser/Static/Enterprise/Target.hpp"
|
2019-06-03 18:50:36 +00:00
|
|
|
#include "../../../../../Analyser/Static/Macintosh/Target.hpp"
|
2018-04-03 02:42:41 +00:00
|
|
|
#include "../../../../../Analyser/Static/MSX/Target.hpp"
|
|
|
|
#include "../../../../../Analyser/Static/Oric/Target.hpp"
|
2023-12-05 20:19:58 +00:00
|
|
|
#include "../../../../../Analyser/Static/PCCompatible/Target.hpp"
|
2018-04-03 02:42:41 +00:00
|
|
|
#include "../../../../../Analyser/Static/ZX8081/Target.hpp"
|
2021-03-22 01:50:50 +00:00
|
|
|
#include "../../../../../Analyser/Static/ZXSpectrum/Target.hpp"
|
2018-04-03 02:42:41 +00:00
|
|
|
|
2016-10-12 02:20:13 +00:00
|
|
|
#import "Clock_Signal-Swift.h"
|
|
|
|
|
2017-07-31 02:05:29 +00:00
|
|
|
@implementation CSStaticAnalyser {
|
2018-04-14 23:46:15 +00:00
|
|
|
Analyser::Static::TargetList _targets;
|
2016-09-01 00:43:29 +00:00
|
|
|
}
|
|
|
|
|
2020-06-19 03:34:28 +00:00
|
|
|
// MARK: - File-based Initialiser
|
|
|
|
|
2017-07-31 02:05:29 +00:00
|
|
|
- (instancetype)initWithFileAtURL:(NSURL *)url {
|
2016-09-01 00:43:29 +00:00
|
|
|
self = [super init];
|
2017-07-31 02:05:29 +00:00
|
|
|
if(self) {
|
2018-01-25 02:48:44 +00:00
|
|
|
_targets = Analyser::Static::GetTargets([url fileSystemRepresentation]);
|
2018-01-24 03:18:16 +00:00
|
|
|
if(!_targets.size()) return nil;
|
2016-09-13 02:15:38 +00:00
|
|
|
|
2018-01-25 01:14:15 +00:00
|
|
|
// TODO: could this better be supplied by the analyser? A hypothetical file format might
|
|
|
|
// provide a better name for it contents than the file name?
|
2020-12-31 20:23:46 +00:00
|
|
|
_displayName = [url.lastPathComponent copy];
|
2016-09-01 00:43:29 +00:00
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-06-19 03:34:28 +00:00
|
|
|
// MARK: - Machine-based Initialisers
|
|
|
|
|
2021-12-22 23:20:55 +00:00
|
|
|
- (instancetype)initWithAmigaModel:(CSMachineAmigaModel)model chipMemorySize:(Kilobytes)chipMemorySize fastMemorySize:(Kilobytes)fastMemorySize {
|
2021-08-07 01:58:31 +00:00
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
|
|
|
using Target = Analyser::Static::Amiga::Target;
|
|
|
|
auto target = std::make_unique<Target>();
|
2021-12-22 23:20:55 +00:00
|
|
|
|
|
|
|
switch(chipMemorySize) {
|
|
|
|
default: return nil;
|
|
|
|
case 512: target->chip_ram = Target::ChipRAM::FiveHundredAndTwelveKilobytes; break;
|
|
|
|
case 1024: target->chip_ram = Target::ChipRAM::OneMegabyte; break;
|
|
|
|
case 2048: target->chip_ram = Target::ChipRAM::TwoMegabytes; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(fastMemorySize) {
|
|
|
|
default: return nil;
|
|
|
|
case 0: target->fast_ram = Target::FastRAM::None; break;
|
|
|
|
case 1024: target->fast_ram = Target::FastRAM::OneMegabyte; break;
|
|
|
|
case 2048: target->fast_ram = Target::FastRAM::TwoMegabytes; break;
|
|
|
|
case 4096: target->fast_ram = Target::FastRAM::FourMegabytes; break;
|
|
|
|
case 8192: target->fast_ram = Target::FastRAM::EightMegabytes; break;
|
|
|
|
}
|
|
|
|
|
2021-08-07 01:58:31 +00:00
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-06-19 03:34:28 +00:00
|
|
|
- (instancetype)initWithAmstradCPCModel:(CSMachineCPCModel)model {
|
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
|
|
|
using Target = Analyser::Static::AmstradCPC::Target;
|
|
|
|
auto target = std::make_unique<Target>();
|
|
|
|
switch(model) {
|
|
|
|
case CSMachineCPCModel464: target->model = Target::Model::CPC464; break;
|
|
|
|
case CSMachineCPCModel664: target->model = Target::Model::CPC664; break;
|
|
|
|
case CSMachineCPCModel6128: target->model = Target::Model::CPC6128; break;
|
|
|
|
}
|
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2024-02-15 14:10:19 +00:00
|
|
|
- (instancetype)initWithAppleIIModel:(CSMachineAppleIIModel)model diskController:(CSMachineAppleIIDiskController)diskController hasMockingboard:(BOOL)hasMockingboard {
|
2020-06-19 03:34:28 +00:00
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
|
|
|
using Target = Analyser::Static::AppleII::Target;
|
|
|
|
auto target = std::make_unique<Target>();
|
|
|
|
switch(model) {
|
|
|
|
default: target->model = Target::Model::II; break;
|
|
|
|
case CSMachineAppleIIModelAppleIIPlus: target->model = Target::Model::IIplus; break;
|
|
|
|
case CSMachineAppleIIModelAppleIIe: target->model = Target::Model::IIe; break;
|
|
|
|
case CSMachineAppleIIModelAppleEnhancedIIe: target->model = Target::Model::EnhancedIIe; break;
|
|
|
|
}
|
|
|
|
switch(diskController) {
|
|
|
|
default:
|
|
|
|
case CSMachineAppleIIDiskControllerNone: target->disk_controller = Target::DiskController::None; break;
|
|
|
|
case CSMachineAppleIIDiskControllerSixteenSector: target->disk_controller = Target::DiskController::SixteenSector; break;
|
|
|
|
case CSMachineAppleIIDiskControllerThirteenSector: target->disk_controller = Target::DiskController::ThirteenSector; break;
|
|
|
|
}
|
2024-02-15 14:10:19 +00:00
|
|
|
target->has_mockingboard = hasMockingboard;
|
2020-06-19 03:34:28 +00:00
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-10-21 02:18:11 +00:00
|
|
|
- (instancetype)initWithAppleIIgsModel:(CSMachineAppleIIgsModel)model memorySize:(Kilobytes)memorySize {
|
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
|
|
|
using Target = Analyser::Static::AppleIIgs::Target;
|
|
|
|
auto target = std::make_unique<Target>();
|
|
|
|
switch(model) {
|
|
|
|
default: target->model = Target::Model::ROM00; break;
|
|
|
|
case CSMachineAppleIIgsModelROM01: target->model = Target::Model::ROM01; break;
|
|
|
|
case CSMachineAppleIIgsModelROM03: target->model = Target::Model::ROM03; break;
|
|
|
|
}
|
|
|
|
switch(memorySize) {
|
|
|
|
default: target->memory_model = Target::MemoryModel::EightMB; break;
|
|
|
|
case 1024: target->memory_model = Target::MemoryModel::OneMB; break;
|
|
|
|
case 256: target->memory_model = Target::MemoryModel::TwoHundredAndFiftySixKB; break;
|
|
|
|
}
|
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2024-04-18 00:44:45 +00:00
|
|
|
- (instancetype)initWithArchimedesModel:(CSMachineArchimedesModel)model {
|
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
2024-05-14 01:42:38 +00:00
|
|
|
auto target = std::make_unique<Analyser::Static::Acorn::ArchimedesTarget>();
|
2024-04-18 00:44:45 +00:00
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (instancetype)initWithAtariSTMemorySize:(Kilobytes)memorySize {
|
2020-06-19 03:34:28 +00:00
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
|
|
|
using Target = Analyser::Static::AtariST::Target;
|
|
|
|
auto target = std::make_unique<Target>();
|
2022-08-10 18:58:19 +00:00
|
|
|
switch(memorySize) {
|
|
|
|
default: target->memory_size = Target::MemorySize::FiveHundredAndTwelveKilobytes; break;
|
|
|
|
case 1024: target->memory_size = Target::MemorySize::OneMegabyte; break;
|
|
|
|
case 4096: target->memory_size = Target::MemorySize::FourMegabytes; break;
|
|
|
|
}
|
2020-06-19 03:34:28 +00:00
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2021-01-31 14:49:51 +00:00
|
|
|
- (instancetype)initWithElectronDFS:(BOOL)dfs adfs:(BOOL)adfs ap6:(BOOL)ap6 sidewaysRAM:(BOOL)sidewaysRAM {
|
2018-04-03 02:42:41 +00:00
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
2024-05-14 01:42:38 +00:00
|
|
|
auto target = std::make_unique<Analyser::Static::Acorn::ElectronTarget>();
|
2021-01-31 14:49:51 +00:00
|
|
|
target->has_dfs = dfs;
|
2021-01-31 18:12:59 +00:00
|
|
|
target->has_pres_adfs = adfs;
|
2021-01-31 14:49:51 +00:00
|
|
|
target->has_ap6_rom = ap6;
|
|
|
|
target->has_sideways_ram = sidewaysRAM;
|
2018-04-03 02:42:41 +00:00
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2021-07-08 22:50:37 +00:00
|
|
|
- (instancetype)initWithEnterpriseModel:(CSMachineEnterpriseModel)model speed:(CSMachineEnterpriseSpeed)speed exosVersion:(CSMachineEnterpriseEXOS)exosVersion basicVersion:(CSMachineEnterpriseBASIC)basicVersion dos:(CSMachineEnterpriseDOS)dos {
|
2021-06-15 00:55:39 +00:00
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
|
|
|
using Target = Analyser::Static::Enterprise::Target;
|
|
|
|
auto target = std::make_unique<Target>();
|
2021-06-23 01:39:07 +00:00
|
|
|
|
|
|
|
switch(model) {
|
|
|
|
case CSMachineEnterpriseModel64: target->model = Target::Model::Enterprise64; break;
|
|
|
|
default:
|
|
|
|
case CSMachineEnterpriseModel128: target->model = Target::Model::Enterprise128; break;
|
|
|
|
case CSMachineEnterpriseModel256: target->model = Target::Model::Enterprise256; break;
|
|
|
|
}
|
|
|
|
|
2021-07-08 22:50:37 +00:00
|
|
|
switch(speed) {
|
|
|
|
case CSMachineEnterpriseSpeed6MHz: target->speed = Target::Speed::SixMHz; break;
|
|
|
|
default:
|
|
|
|
case CSMachineEnterpriseSpeed4MHz: target->speed = Target::Speed::FourMHz; break;
|
|
|
|
}
|
|
|
|
|
2021-06-23 01:39:07 +00:00
|
|
|
switch(exosVersion) {
|
|
|
|
case CSMachineEnterpriseEXOSVersion21: target->exos_version = Target::EXOSVersion::v21; break;
|
|
|
|
default:
|
|
|
|
case CSMachineEnterpriseEXOSVersion20: target->exos_version = Target::EXOSVersion::v20; break;
|
|
|
|
case CSMachineEnterpriseEXOSVersion10: target->exos_version = Target::EXOSVersion::v10; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(basicVersion) {
|
|
|
|
case CSMachineEnterpriseBASICNone: target->basic_version = Target::BASICVersion::None; break;
|
|
|
|
default:
|
|
|
|
case CSMachineEnterpriseBASICVersion21: target->basic_version = Target::BASICVersion::v21; break;
|
|
|
|
case CSMachineEnterpriseBASICVersion11: target->basic_version = Target::BASICVersion::v11; break;
|
|
|
|
case CSMachineEnterpriseBASICVersion10: target->basic_version = Target::BASICVersion::v10; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(dos) {
|
|
|
|
case CSMachineEnterpriseDOSEXDOS: target->dos = Target::DOS::EXDOS; break;
|
|
|
|
default:
|
|
|
|
case CSMachineEnterpriseDOSNone: target->dos = Target::DOS::None; break;
|
|
|
|
}
|
|
|
|
|
2021-06-15 00:55:39 +00:00
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-06-19 03:34:28 +00:00
|
|
|
- (instancetype)initWithMacintoshModel:(CSMachineMacintoshModel)model {
|
2018-04-03 02:42:41 +00:00
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
2020-06-19 03:34:28 +00:00
|
|
|
using Target = Analyser::Static::Macintosh::Target;
|
2019-12-22 04:52:04 +00:00
|
|
|
auto target = std::make_unique<Target>();
|
2020-06-19 03:34:28 +00:00
|
|
|
|
|
|
|
using Model = Target::Model;
|
2018-04-03 02:42:41 +00:00
|
|
|
switch(model) {
|
2020-06-19 03:34:28 +00:00
|
|
|
default:
|
|
|
|
case CSMachineMacintoshModel128k: target->model = Model::Mac128k; break;
|
|
|
|
case CSMachineMacintoshModel512k: target->model = Model::Mac512k; break;
|
|
|
|
case CSMachineMacintoshModel512ke: target->model = Model::Mac512ke; break;
|
|
|
|
case CSMachineMacintoshModelPlus: target->model = Model::MacPlus; break;
|
2018-04-03 02:42:41 +00:00
|
|
|
}
|
2020-06-19 03:34:28 +00:00
|
|
|
|
2018-04-03 02:42:41 +00:00
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2023-05-14 02:25:50 +00:00
|
|
|
- (instancetype)initWithMSXModel:(CSMachineMSXModel)model region:(CSMachineMSXRegion)region hasDiskDrive:(BOOL)hasDiskDrive hasMSXMUSIC:(BOOL)hasMSXMUSIC {
|
2018-04-03 02:42:41 +00:00
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
|
|
|
using Target = Analyser::Static::MSX::Target;
|
2019-12-22 04:52:04 +00:00
|
|
|
auto target = std::make_unique<Target>();
|
2023-05-14 02:25:50 +00:00
|
|
|
target->has_disk_drive = hasDiskDrive;
|
|
|
|
target->has_msx_music = hasMSXMUSIC;
|
2019-03-01 01:54:43 +00:00
|
|
|
switch(region) {
|
2020-06-19 03:34:28 +00:00
|
|
|
case CSMachineMSXRegionAmerican: target->region = Target::Region::USA; break;
|
|
|
|
case CSMachineMSXRegionEuropean: target->region = Target::Region::Europe; break;
|
|
|
|
case CSMachineMSXRegionJapanese: target->region = Target::Region::Japan; break;
|
2019-03-01 01:54:43 +00:00
|
|
|
}
|
2023-03-22 00:05:10 +00:00
|
|
|
switch(model) {
|
|
|
|
case CSMachineMSXModelMSX1: target->model = Target::Model::MSX1; break;
|
|
|
|
case CSMachineMSXModelMSX2: target->model = Target::Model::MSX2; break;
|
|
|
|
}
|
2018-04-03 02:42:41 +00:00
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2018-05-09 02:05:43 +00:00
|
|
|
- (instancetype)initWithOricModel:(CSMachineOricModel)model diskInterface:(CSMachineOricDiskInterface)diskInterface {
|
2018-04-03 02:42:41 +00:00
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
|
|
|
using Target = Analyser::Static::Oric::Target;
|
2019-12-22 04:52:04 +00:00
|
|
|
auto target = std::make_unique<Target>();
|
2018-05-09 02:05:43 +00:00
|
|
|
switch(model) {
|
|
|
|
case CSMachineOricModelOric1: target->rom = Target::ROM::BASIC10; break;
|
|
|
|
case CSMachineOricModelOricAtmos: target->rom = Target::ROM::BASIC11; break;
|
|
|
|
case CSMachineOricModelPravetz: target->rom = Target::ROM::Pravetz; break;
|
|
|
|
}
|
|
|
|
switch(diskInterface) {
|
|
|
|
case CSMachineOricDiskInterfaceNone: target->disk_interface = Target::DiskInterface::None; break;
|
|
|
|
case CSMachineOricDiskInterfaceMicrodisc: target->disk_interface = Target::DiskInterface::Microdisc; break;
|
|
|
|
case CSMachineOricDiskInterfacePravetz: target->disk_interface = Target::DiskInterface::Pravetz; break;
|
2020-01-06 02:57:33 +00:00
|
|
|
case CSMachineOricDiskInterfaceJasmin: target->disk_interface = Target::DiskInterface::Jasmin; break;
|
2020-01-16 04:56:56 +00:00
|
|
|
case CSMachineOricDiskInterfaceBD500: target->disk_interface = Target::DiskInterface::BD500; break;
|
2018-05-09 02:05:43 +00:00
|
|
|
}
|
2018-04-03 02:42:41 +00:00
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2023-12-08 19:23:27 +00:00
|
|
|
- (instancetype)initWithPCCompatibleSpeed:(CSPCCompatibleSpeed)speed videoAdaptor:(CSPCCompatibleVideoAdaptor)adaptor {
|
2023-11-15 19:27:04 +00:00
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
2023-12-05 20:19:58 +00:00
|
|
|
using Target = Analyser::Static::PCCompatible::Target;
|
|
|
|
auto target = std::make_unique<Target>();
|
|
|
|
switch(adaptor) {
|
|
|
|
case CSPCCompatibleVideoAdaptorMDA: target->adaptor = Target::VideoAdaptor::MDA; break;
|
|
|
|
case CSPCCompatibleVideoAdaptorCGA: target->adaptor = Target::VideoAdaptor::CGA; break;
|
|
|
|
}
|
2023-12-08 19:23:27 +00:00
|
|
|
switch(speed) {
|
|
|
|
case CSPCCompatibleSpeedOriginal: target->speed = Target::Speed::ApproximatelyOriginal; break;
|
|
|
|
case CSPCCompatibleSpeedTurbo: target->speed = Target::Speed::Fast; break;
|
|
|
|
}
|
2023-11-15 19:27:04 +00:00
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2021-03-22 01:50:50 +00:00
|
|
|
- (instancetype)initWithSpectrumModel:(CSMachineSpectrumModel)model {
|
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
|
|
|
using Target = Analyser::Static::ZXSpectrum::Target;
|
|
|
|
auto target = std::make_unique<Target>();
|
|
|
|
switch(model) {
|
2021-04-15 01:37:10 +00:00
|
|
|
case CSMachineSpectrumModelSixteenK: target->model = Target::Model::SixteenK; break;
|
|
|
|
case CSMachineSpectrumModelFortyEightK: target->model = Target::Model::FortyEightK; break;
|
|
|
|
case CSMachineSpectrumModelOneTwoEightK: target->model = Target::Model::OneTwoEightK; break;
|
|
|
|
case CSMachineSpectrumModelPlus2: target->model = Target::Model::Plus2; break;
|
|
|
|
case CSMachineSpectrumModelPlus2a: target->model = Target::Model::Plus2a; break;
|
|
|
|
case CSMachineSpectrumModelPlus3: target->model = Target::Model::Plus3; break;
|
2021-03-22 01:50:50 +00:00
|
|
|
}
|
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2018-04-03 02:42:41 +00:00
|
|
|
- (instancetype)initWithVic20Region:(CSMachineVic20Region)region memorySize:(Kilobytes)memorySize hasC1540:(BOOL)hasC1540 {
|
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
|
|
|
using Target = Analyser::Static::Commodore::Target;
|
2019-12-22 04:52:04 +00:00
|
|
|
auto target = std::make_unique<Target>();
|
2018-04-03 02:42:41 +00:00
|
|
|
switch(region) {
|
|
|
|
case CSMachineVic20RegionDanish: target->region = Target::Region::Danish; break;
|
|
|
|
case CSMachineVic20RegionSwedish: target->region = Target::Region::Swedish; break;
|
|
|
|
case CSMachineVic20RegionAmerican: target->region = Target::Region::American; break;
|
|
|
|
case CSMachineVic20RegionEuropean: target->region = Target::Region::European; break;
|
|
|
|
case CSMachineVic20RegionJapanese: target->region = Target::Region::Japanese; break;
|
|
|
|
}
|
2019-12-27 03:49:48 +00:00
|
|
|
auto memory_model = Target::MemoryModel::Unexpanded;
|
2018-04-03 02:42:41 +00:00
|
|
|
switch(memorySize) {
|
2019-12-27 03:49:48 +00:00
|
|
|
default: break;
|
|
|
|
case 8: memory_model = Target::MemoryModel::EightKB; break;
|
|
|
|
case 32: memory_model = Target::MemoryModel::ThirtyTwoKB; break;
|
2018-04-03 02:42:41 +00:00
|
|
|
}
|
2019-12-27 03:49:48 +00:00
|
|
|
target->set_memory_model(memory_model);
|
2018-04-03 02:42:41 +00:00
|
|
|
target->has_c1540 = !!hasC1540;
|
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Analyser::Static::ZX8081::Target::MemoryModel ZX8081MemoryModelFromSize(Kilobytes size) {
|
|
|
|
using MemoryModel = Analyser::Static::ZX8081::Target::MemoryModel;
|
|
|
|
switch(size) {
|
|
|
|
default: return MemoryModel::Unexpanded;
|
|
|
|
case 16: return MemoryModel::SixteenKB;
|
|
|
|
case 64: return MemoryModel::SixtyFourKB;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (instancetype)initWithZX80MemorySize:(Kilobytes)memorySize useZX81ROM:(BOOL)useZX81ROM {
|
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
|
|
|
using Target = Analyser::Static::ZX8081::Target;
|
2019-12-22 04:52:04 +00:00
|
|
|
auto target = std::make_unique<Target>();
|
2018-04-03 02:42:41 +00:00
|
|
|
target->is_ZX81 = false;
|
|
|
|
target->ZX80_uses_ZX81_ROM = !!useZX81ROM;
|
|
|
|
target->memory_model = ZX8081MemoryModelFromSize(memorySize);
|
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (instancetype)initWithZX81MemorySize:(Kilobytes)memorySize {
|
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
|
|
|
using Target = Analyser::Static::ZX8081::Target;
|
2019-12-22 04:52:04 +00:00
|
|
|
auto target = std::make_unique<Target>();
|
2018-04-03 02:42:41 +00:00
|
|
|
target->is_ZX81 = true;
|
|
|
|
target->memory_model = ZX8081MemoryModelFromSize(memorySize);
|
|
|
|
_targets.push_back(std::move(target));
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-06-19 03:34:28 +00:00
|
|
|
// MARK: - NIB mapping
|
2019-12-18 04:04:12 +00:00
|
|
|
|
2021-07-13 23:04:24 +00:00
|
|
|
- (NSString *)optionsNibName {
|
2018-01-25 03:35:54 +00:00
|
|
|
switch(_targets.front()->machine) {
|
2021-03-15 15:37:23 +00:00
|
|
|
case Analyser::Machine::AmstradCPC: return @"CompositeOptions";
|
2024-05-27 02:02:40 +00:00
|
|
|
case Analyser::Machine::Archimedes: return @"QuickLoadOptions";
|
2019-02-13 00:52:32 +00:00
|
|
|
case Analyser::Machine::AppleII: return @"AppleIIOptions";
|
2018-10-24 02:30:24 +00:00
|
|
|
case Analyser::Machine::Atari2600: return @"Atari2600Options";
|
2019-12-21 01:49:14 +00:00
|
|
|
case Analyser::Machine::AtariST: return @"CompositeOptions";
|
2019-03-03 03:59:40 +00:00
|
|
|
case Analyser::Machine::ColecoVision: return @"CompositeOptions";
|
2018-10-24 02:30:24 +00:00
|
|
|
case Analyser::Machine::Electron: return @"QuickLoadCompositeOptions";
|
2021-07-03 01:42:09 +00:00
|
|
|
case Analyser::Machine::Enterprise: return @"CompositeOptions";
|
2019-09-20 02:32:12 +00:00
|
|
|
case Analyser::Machine::Macintosh: return @"MacintoshOptions";
|
2018-10-24 02:30:24 +00:00
|
|
|
case Analyser::Machine::MasterSystem: return @"CompositeOptions";
|
|
|
|
case Analyser::Machine::MSX: return @"QuickLoadCompositeOptions";
|
|
|
|
case Analyser::Machine::Oric: return @"OricOptions";
|
2023-12-06 19:49:34 +00:00
|
|
|
case Analyser::Machine::PCCompatible: return @"CompositeOptions";
|
2018-10-24 02:30:24 +00:00
|
|
|
case Analyser::Machine::Vic20: return @"QuickLoadCompositeOptions";
|
|
|
|
case Analyser::Machine::ZX8081: return @"ZX8081Options";
|
2021-03-20 02:17:20 +00:00
|
|
|
case Analyser::Machine::ZXSpectrum: return @"QuickLoadCompositeOptions"; // TODO: @"ZXSpectrumOptions";
|
2016-10-11 11:39:48 +00:00
|
|
|
default: return nil;
|
2016-10-02 20:31:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-14 23:46:15 +00:00
|
|
|
- (Analyser::Static::TargetList &)targets {
|
2018-01-25 01:14:15 +00:00
|
|
|
return _targets;
|
|
|
|
}
|
|
|
|
|
2016-09-01 00:43:29 +00:00
|
|
|
@end
|
2017-08-17 15:00:08 +00:00
|
|
|
|
|
|
|
@implementation CSMediaSet {
|
2018-01-25 02:48:44 +00:00
|
|
|
Analyser::Static::Media _media;
|
2017-08-17 15:00:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (instancetype)initWithFileAtURL:(NSURL *)url {
|
|
|
|
self = [super init];
|
|
|
|
if(self) {
|
2018-01-25 02:48:44 +00:00
|
|
|
_media = Analyser::Static::GetMedia([url fileSystemRepresentation]);
|
2017-08-17 15:00:08 +00:00
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)applyToMachine:(CSMachine *)machine {
|
|
|
|
[machine applyMedia:_media];
|
|
|
|
}
|
|
|
|
|
2021-05-01 01:37:41 +00:00
|
|
|
- (BOOL)empty {
|
|
|
|
return _media.empty();
|
|
|
|
}
|
|
|
|
|
2017-08-17 15:00:08 +00:00
|
|
|
@end
|