1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-28 22:30:30 +00:00

Merge pull request #632 from TomHarte/BINSwitch

Eliminates the crutch of PlusToo BIN files.
This commit is contained in:
Thomas Harte 2019-07-28 16:08:54 -04:00 committed by GitHub
commit 0dc6f08deb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 109 deletions

View File

@ -43,7 +43,6 @@
#include "../../Storage/Disk/DiskImage/Formats/MSXDSK.hpp"
#include "../../Storage/Disk/DiskImage/Formats/NIB.hpp"
#include "../../Storage/Disk/DiskImage/Formats/OricMFMDSK.hpp"
#include "../../Storage/Disk/DiskImage/Formats/PlusTooBIN.hpp"
#include "../../Storage/Disk/DiskImage/Formats/SSD.hpp"
#include "../../Storage/Disk/DiskImage/Formats/WOZ.hpp"
@ -92,8 +91,7 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform::
Format("81", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // 81
Format("a26", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Atari2600) // A26
Format("adf", result.disks, Disk::DiskImageHolder<Storage::Disk::AcornADF>, TargetPlatform::Acorn) // ADF
// Format("bin", result.cartridges, Cartridge::BinaryDump, TargetPlatform::AllCartridge) // BIN (cartridge dump)
Format("bin", result.disks, Disk::DiskImageHolder<Storage::Disk::PlusTooBIN>, TargetPlatform::Macintosh) // BIN (PlusToo disk image)
Format("bin", result.cartridges, Cartridge::BinaryDump, TargetPlatform::AllCartridge) // BIN (cartridge dump)
Format("cas", result.tapes, Tape::CAS, TargetPlatform::MSX) // CAS
Format("cdt", result.tapes, Tape::TZX, TargetPlatform::AmstradCPC) // CDT
Format("col", result.cartridges, Cartridge::BinaryDump, TargetPlatform::ColecoVision) // COL

View File

@ -110,7 +110,6 @@
4B08A2751EE35D56008B7065 /* Z80InterruptTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B08A2741EE35D56008B7065 /* Z80InterruptTests.swift */; };
4B08A2781EE39306008B7065 /* TestMachine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B08A2771EE39306008B7065 /* TestMachine.mm */; };
4B08A56920D72BEF0016CE5A /* Activity.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B08A56720D72BEF0016CE5A /* Activity.xib */; };
4B0C956E22A7109A0015A8F6 /* PlusTooBIN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0C956C22A7109A0015A8F6 /* PlusTooBIN.cpp */; };
4B0CCC451C62D0B3001CAC5F /* CRT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0CCC421C62D0B3001CAC5F /* CRT.cpp */; };
4B0E04EA1FC9E5DA00F43484 /* CAS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E04E81FC9E5DA00F43484 /* CAS.cpp */; };
4B0E04EB1FC9E78800F43484 /* CAS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E04E81FC9E5DA00F43484 /* CAS.cpp */; };
@ -245,7 +244,6 @@
4B8318B822D3E566006DB630 /* IWM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEE1498227FC0EA00133682 /* IWM.cpp */; };
4B8318B922D3E56D006DB630 /* MemoryPacker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCE005B227D30CC000CA200 /* MemoryPacker.cpp */; };
4B8318BA22D3E579006DB630 /* MacintoshIMG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB4BFAE22A42F290069048D /* MacintoshIMG.cpp */; };
4B8318BB22D3E57C006DB630 /* PlusTooBIN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0C956C22A7109A0015A8F6 /* PlusTooBIN.cpp */; };
4B8318BC22D3E588006DB630 /* DisplayMetrics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B622AE3222E0AD5008B59F2 /* DisplayMetrics.cpp */; };
4B8334821F5D9FF70097E338 /* PartialMachineCycle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8334811F5D9FF70097E338 /* PartialMachineCycle.cpp */; };
4B8334841F5DA0360097E338 /* Z80Storage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8334831F5DA0360097E338 /* Z80Storage.cpp */; };
@ -756,8 +754,6 @@
4B08A2771EE39306008B7065 /* TestMachine.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestMachine.mm; sourceTree = "<group>"; };
4B08A2791EE3957B008B7065 /* TestMachine+ForSubclassEyesOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TestMachine+ForSubclassEyesOnly.h"; sourceTree = "<group>"; };
4B08A56820D72BEF0016CE5A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/Activity.xib"; sourceTree = SOURCE_ROOT; };
4B0C956C22A7109A0015A8F6 /* PlusTooBIN.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PlusTooBIN.cpp; sourceTree = "<group>"; };
4B0C956D22A7109A0015A8F6 /* PlusTooBIN.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = PlusTooBIN.hpp; sourceTree = "<group>"; };
4B0CCC421C62D0B3001CAC5F /* CRT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CRT.cpp; sourceTree = "<group>"; };
4B0CCC431C62D0B3001CAC5F /* CRT.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CRT.hpp; sourceTree = "<group>"; };
4B0E04E81FC9E5DA00F43484 /* CAS.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CAS.cpp; sourceTree = "<group>"; };
@ -2014,7 +2010,6 @@
4BEBFB4B2002C4BF000708CC /* MSXDSK.cpp */,
4B0F94FC208C1A1600FE41D9 /* NIB.cpp */,
4B4518971F75FD1B00926311 /* OricMFMDSK.cpp */,
4B0C956C22A7109A0015A8F6 /* PlusTooBIN.cpp */,
4B4518991F75FD1B00926311 /* SSD.cpp */,
4B6ED2EE208E2F8A0047B343 /* WOZ.cpp */,
4B45188E1F75FD1B00926311 /* AcornADF.hpp */,
@ -2029,7 +2024,6 @@
4BEBFB4C2002C4BF000708CC /* MSXDSK.hpp */,
4B0F94FD208C1A1600FE41D9 /* NIB.hpp */,
4B4518981F75FD1B00926311 /* OricMFMDSK.hpp */,
4B0C956D22A7109A0015A8F6 /* PlusTooBIN.hpp */,
4B45189A1F75FD1B00926311 /* SSD.hpp */,
4B6ED2EF208E2F8A0047B343 /* WOZ.hpp */,
4BFDD7891F7F2DB4008579B9 /* Utility */,
@ -3953,7 +3947,6 @@
4B055AEE1FAE9BBF0060FFFF /* Keyboard.cpp in Sources */,
4B055AED1FAE9BA20060FFFF /* Z80Storage.cpp in Sources */,
4B1B88BC202E2EC100B67DFF /* MultiKeyboardMachine.cpp in Sources */,
4B8318BB22D3E57C006DB630 /* PlusTooBIN.cpp in Sources */,
4BF437EF209D0F7E008CBD6B /* SegmentParser.cpp in Sources */,
4B055AD11FAE9B030060FFFF /* Video.cpp in Sources */,
4BB4BFBA22A4372F0069048D /* StaticAnalyser.cpp in Sources */,
@ -4195,7 +4188,6 @@
4B30512D1D989E2200B4FED8 /* Drive.cpp in Sources */,
4BCE005D227D30CC000CA200 /* MemoryPacker.cpp in Sources */,
4BCE0051227CE8CA000CA200 /* Video.cpp in Sources */,
4B0C956E22A7109A0015A8F6 /* PlusTooBIN.cpp in Sources */,
4B894536201967B4007DE474 /* Z80.cpp in Sources */,
4BCA6CC81D9DD9F000C2D7B2 /* CommodoreROM.cpp in Sources */,
4BEA52661DF3472B007E74F2 /* TIASound.cpp in Sources */,

View File

@ -1,58 +0,0 @@
//
// PlusTooBIN.cpp
// Clock Signal
//
// Created by Thomas Harte on 04/06/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#include "PlusTooBIN.hpp"
#include "../../Track/PCMTrack.hpp"
#include "../../Encodings/AppleGCR/Encoder.hpp"
using namespace Storage::Disk;
namespace {
const long sector_size = 1024;
}
PlusTooBIN::PlusTooBIN(const std::string &file_name) :
file_(file_name) {
// BIN isn't really meant to be an emulator file format, it's primarily
// a convenience for the PlusToo Macintosh clone. So validation is
// fairly light.
if(file_.stats().st_size != 1638400)
throw Error::InvalidFormat;
}
HeadPosition PlusTooBIN::get_maximum_head_position() {
return HeadPosition(80);
}
int PlusTooBIN::get_head_count() {
return 2;
}
std::shared_ptr<Track> PlusTooBIN::get_track_at_position(Track::Address address) {
if(address.position >= get_maximum_head_position()) return nullptr;
if(address.head >= get_head_count()) return nullptr;
const auto start_position = Encodings::AppleGCR::Macintosh::sectors_in_track(address.position.as_int());
const long file_offset = long(start_position.start * 2 + address.head * start_position.length) * sector_size;
file_.seek(file_offset, SEEK_SET);
const auto track_contents = file_.read(std::size_t(sector_size * start_position.length));
// Split up the data that comes out per encoded sector, prefixing proper sync bits.
Storage::Disk::PCMSegment segment;
for(size_t c = 0; c < size_t(start_position.length); ++c) {
segment += Storage::Encodings::AppleGCR::six_and_two_sync(5);
size_t data_start = 0;
while(track_contents[c*1024 + data_start] == 0xff) ++data_start;
segment += PCMSegment((1024 - data_start) * 8, &track_contents[c*1024 + data_start]);
}
return std::make_shared<PCMTrack>(segment);
}

View File

@ -1,40 +0,0 @@
//
// PlusTooBIN.hpp
// Clock Signal
//
// Created by Thomas Harte on 04/06/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#ifndef PlusTooBIN_hpp
#define PlusTooBIN_hpp
#include "../DiskImage.hpp"
#include "../../../FileHolder.hpp"
#include <string>
namespace Storage {
namespace Disk {
/*!
Provides a @c DiskImage capturing the raw bitstream contained in a PlusToo-style BIN file.
*/
class PlusTooBIN: public DiskImage {
public:
PlusTooBIN(const std::string &file_name);
// Implemented to satisfy @c DiskImage.
HeadPosition get_maximum_head_position() override;
int get_head_count() override;
std::shared_ptr<Track> get_track_at_position(Track::Address address) override;
private:
Storage::FileHolder file_;
};
}
}
#endif /* PlusTooBIN_hpp */