diff --git a/Components/1770/1770.hpp b/Components/1770/1770.hpp index 3d36b6d5e..32941fc1d 100644 --- a/Components/1770/1770.hpp +++ b/Components/1770/1770.hpp @@ -9,6 +9,19 @@ #ifndef _770_hpp #define _770_hpp -#include +#include "../../Storage/Disk/DiskDrive.hpp" + +namespace WD { + +class WD1770 { + public: + + void set_drive(std::shared_ptr drive); + void set_is_double_density(bool is_double_density); + void set_register(int address, uint8_t value); + void get_register(int address); +}; + +} #endif /* _770_hpp */ diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index ef1d6073c..f0b7f1e0a 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -355,6 +355,7 @@ 4BEF6AAA1D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BEF6AA91D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm */; }; 4BEF6AAC1D35D1C400E73575 /* DPLLTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEF6AAB1D35D1C400E73575 /* DPLLTests.swift */; }; 4BF1354C1D6D2C300054B2EA /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF1354A1D6D2C300054B2EA /* StaticAnalyser.cpp */; }; + 4BF8295D1D8F048B001BAE39 /* MFM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8295B1D8F048B001BAE39 /* MFM.cpp */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -805,6 +806,8 @@ 4BEF6AAB1D35D1C400E73575 /* DPLLTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DPLLTests.swift; sourceTree = ""; }; 4BF1354A1D6D2C300054B2EA /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = ../../StaticAnalyser/StaticAnalyser.cpp; sourceTree = ""; }; 4BF1354B1D6D2C300054B2EA /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/StaticAnalyser.hpp; sourceTree = ""; }; + 4BF8295B1D8F048B001BAE39 /* MFM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MFM.cpp; path = Encodings/MFM.cpp; sourceTree = ""; }; + 4BF8295C1D8F048B001BAE39 /* MFM.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = MFM.hpp; path = Encodings/MFM.hpp; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1400,6 +1403,8 @@ children = ( 4BB697CC1D4BA44400248BDF /* CommodoreGCR.cpp */, 4BB697CD1D4BA44400248BDF /* CommodoreGCR.hpp */, + 4BF8295B1D8F048B001BAE39 /* MFM.cpp */, + 4BF8295C1D8F048B001BAE39 /* MFM.hpp */, ); name = Encodings; sourceTree = ""; @@ -2091,6 +2096,7 @@ 4BC830D11D6E7C690000A26F /* Tape.cpp in Sources */, 4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */, 4B4DC8211D2C2425003C5BF8 /* Vic20.cpp in Sources */, + 4BF8295D1D8F048B001BAE39 /* MFM.cpp in Sources */, 4BE77A2E1D84ADFB00BC3827 /* File.cpp in Sources */, 4BAB62B51D327F7E00DF5BA0 /* G64.cpp in Sources */, 4BD468F71D8DF41D0084958B /* 1770.cpp in Sources */, diff --git a/OSBindings/Mac/Clock Signal/Info.plist b/OSBindings/Mac/Clock Signal/Info.plist index cd2e9b763..412ff4196 100644 --- a/OSBindings/Mac/Clock Signal/Info.plist +++ b/OSBindings/Mac/Clock Signal/Info.plist @@ -130,6 +130,20 @@ NSDocumentClass $(PRODUCT_MODULE_NAME).Vic20Document + + CFBundleTypeExtensions + + ssd + dsd + adf + adl + adm + + CFBundleTypeName + Electron/BBC Disk Image + CFBundleTypeRole + Viewer + CFBundleExecutable $(EXECUTABLE_NAME) diff --git a/Storage/Disk/Encodings/CommodoreGCR.hpp b/Storage/Disk/Encodings/CommodoreGCR.hpp index 34346e253..9b8a0c055 100644 --- a/Storage/Disk/Encodings/CommodoreGCR.hpp +++ b/Storage/Disk/Encodings/CommodoreGCR.hpp @@ -6,8 +6,8 @@ // Copyright © 2016 Thomas Harte. All rights reserved. // -#ifndef CommodoreGCR_hpp -#define CommodoreGCR_hpp +#ifndef Storage_Disk_Encodings_CommodoreGCR_hpp +#define Storage_Disk_Encodings_CommodoreGCR_hpp #include "../../Storage.hpp" #include diff --git a/Storage/Disk/Encodings/MFM.cpp b/Storage/Disk/Encodings/MFM.cpp new file mode 100644 index 000000000..efb0797b2 --- /dev/null +++ b/Storage/Disk/Encodings/MFM.cpp @@ -0,0 +1,50 @@ +// +// MFM.cpp +// Clock Signal +// +// Created by Thomas Harte on 18/09/2016. +// Copyright © 2016 Thomas Harte. All rights reserved. +// + +#include "MFM.hpp" + +using namespace Storage::Encodings; + +void Shifter::add_sync() +{ + // i.e. 0100 0100 1000 1001 + output = (uint16_t)((output << 15) | 0x4489); +} + +void MFMShifter::shift(uint8_t input) +{ + uint16_t spread_value = + (uint16_t)( + ((input & 0x01) << 0) | + ((input & 0x02) << 1) | + ((input & 0x04) << 2) | + ((input & 0x08) << 3) | + ((input & 0x10) << 4) | + ((input & 0x20) << 5) | + ((input & 0x40) << 6) | + ((input & 0x80) << 7) + ); + uint16_t or_bits = (uint16_t)((spread_value << 1) | (spread_value >> 1) | (output << 15)); + output = spread_value | ((~or_bits) & 0xaaaa); +} + +void FMShifter::shift(uint8_t input) +{ + output = + (uint16_t)( + ((input & 0x01) << 0) | + ((input & 0x02) << 1) | + ((input & 0x04) << 2) | + ((input & 0x08) << 3) | + ((input & 0x10) << 4) | + ((input & 0x20) << 5) | + ((input & 0x40) << 6) | + ((input & 0x80) << 7) | + 0xaaaa + ); +} diff --git a/Storage/Disk/Encodings/MFM.hpp b/Storage/Disk/Encodings/MFM.hpp new file mode 100644 index 000000000..2e3c8f2c4 --- /dev/null +++ b/Storage/Disk/Encodings/MFM.hpp @@ -0,0 +1,37 @@ +// +// MFM.hpp +// Clock Signal +// +// Created by Thomas Harte on 18/09/2016. +// Copyright © 2016 Thomas Harte. All rights reserved. +// + +#ifndef Storage_Disk_Encodings_MFM_hpp +#define Storage_Disk_Encodings_MFM_hpp + +#include + +namespace Storage { +namespace Encodings { + +class Shifter { + public: + virtual void shift(uint8_t input) = 0; + void add_sync(); + uint16_t output; +}; + +class MFMShifter: public Shifter { + public: + void shift(uint8_t input); +}; + +class FMShifter: public Shifter { + public: + void shift(uint8_t input); +}; + +} +} + +#endif /* MFM_hpp */