2017-06-04 21:04:06 +00:00
|
|
|
//
|
|
|
|
// StaticAnalyser.cpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 04/06/2017.
|
|
|
|
// Copyright © 2017 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "StaticAnalyser.hpp"
|
|
|
|
|
2017-06-07 21:30:53 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "../../Storage/Tape/Parsers/ZX8081.hpp"
|
|
|
|
|
2017-06-08 23:09:51 +00:00
|
|
|
static std::vector<Storage::Data::ZX8081::File> GetFiles(const std::shared_ptr<Storage::Tape::Tape> &tape) {
|
|
|
|
std::vector<Storage::Data::ZX8081::File> files;
|
2017-06-07 21:30:53 +00:00
|
|
|
Storage::Tape::ZX8081::Parser parser;
|
|
|
|
|
|
|
|
while(!tape->is_at_end()) {
|
2017-06-08 23:09:51 +00:00
|
|
|
std::shared_ptr<Storage::Data::ZX8081::File> next_file = parser.get_next_file(tape);
|
2017-06-07 21:30:53 +00:00
|
|
|
if(next_file != nullptr) {
|
|
|
|
files.push_back(*next_file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return files;
|
|
|
|
}
|
|
|
|
|
2017-06-04 21:04:06 +00:00
|
|
|
void StaticAnalyser::ZX8081::AddTargets(
|
|
|
|
const std::list<std::shared_ptr<Storage::Disk::Disk>> &disks,
|
|
|
|
const std::list<std::shared_ptr<Storage::Tape::Tape>> &tapes,
|
|
|
|
const std::list<std::shared_ptr<Storage::Cartridge::Cartridge>> &cartridges,
|
|
|
|
std::list<StaticAnalyser::Target> &destination) {
|
2017-06-07 21:30:53 +00:00
|
|
|
|
|
|
|
if(!tapes.empty()) {
|
2017-06-08 23:09:51 +00:00
|
|
|
std::vector<Storage::Data::ZX8081::File> files = GetFiles(tapes.front());
|
2017-06-07 21:30:53 +00:00
|
|
|
if(!files.empty()) {
|
|
|
|
StaticAnalyser::Target target;
|
2017-06-11 23:12:20 +00:00
|
|
|
target.machine = Target::ZX8081;
|
|
|
|
target.zx8081.isZX81 = files.front().isZX81;
|
|
|
|
if(files.front().data.size() > 16384) {
|
|
|
|
target.zx8081.memory_model = ZX8081MemoryModel::SixtyFourKB;
|
|
|
|
} else if(files.front().data.size() > 1024) {
|
|
|
|
target.zx8081.memory_model = ZX8081MemoryModel::SixteenKB;
|
|
|
|
} else {
|
|
|
|
target.zx8081.memory_model = ZX8081MemoryModel::Unexpanded;
|
|
|
|
}
|
2017-06-07 21:30:53 +00:00
|
|
|
target.tapes = tapes;
|
|
|
|
destination.push_back(target);
|
|
|
|
}
|
|
|
|
}
|
2017-06-04 21:04:06 +00:00
|
|
|
}
|