From 722e3a141db71f4f9f58bc016bc0e42328a80ab5 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 24 Aug 2022 12:00:03 -0400 Subject: [PATCH] Fix types, introduce Apple II mapper. --- .../Clock Signal.xcodeproj/project.pbxproj | 2 + .../MassStorage/Encodings/AppleIIVolume.hpp | 38 +++++++++++++++++++ .../Encodings/ApplePartitionMap.hpp | 8 ++-- .../MassStorage/Encodings/MacintoshVolume.hpp | 1 - 4 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 Storage/MassStorage/Encodings/AppleIIVolume.hpp diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index a2ee5e7c5..c7703df21 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -1366,6 +1366,7 @@ 4B4C81C828B56CF800F84AE9 /* MacintoshVolume.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = MacintoshVolume.hpp; sourceTree = ""; }; 4B4C81C928B56CF800F84AE9 /* MacintoshVolume.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacintoshVolume.cpp; sourceTree = ""; }; 4B4C81CC28B56DD400F84AE9 /* ApplePartitionMap.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ApplePartitionMap.hpp; sourceTree = ""; }; + 4B4C81CD28B67FCD00F84AE9 /* AppleIIVolume.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = AppleIIVolume.hpp; sourceTree = ""; }; 4B4DC81F1D2C2425003C5BF8 /* Vic20.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Vic20.cpp; sourceTree = ""; }; 4B4DC8201D2C2425003C5BF8 /* Vic20.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Vic20.hpp; sourceTree = ""; }; 4B4DC8271D2C2470003C5BF8 /* C1540.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = C1540.hpp; sourceTree = ""; }; @@ -2927,6 +2928,7 @@ 4B4C81C928B56CF800F84AE9 /* MacintoshVolume.cpp */, 4B4C81CC28B56DD400F84AE9 /* ApplePartitionMap.hpp */, 4B4C81C828B56CF800F84AE9 /* MacintoshVolume.hpp */, + 4B4C81CD28B67FCD00F84AE9 /* AppleIIVolume.hpp */, ); path = Encodings; sourceTree = ""; diff --git a/Storage/MassStorage/Encodings/AppleIIVolume.hpp b/Storage/MassStorage/Encodings/AppleIIVolume.hpp new file mode 100644 index 000000000..10d921d03 --- /dev/null +++ b/Storage/MassStorage/Encodings/AppleIIVolume.hpp @@ -0,0 +1,38 @@ +// +// AppleIIVolume.hpp +// Clock Signal +// +// Created by Thomas Harte on 24/08/2022. +// Copyright © 2022 Thomas Harte. All rights reserved. +// + +#ifndef AppleIIVolume_h +#define AppleIIVolume_h + +#include "ApplePartitionMap.hpp" + +namespace Storage { +namespace MassStorage { +namespace Encodings { +namespace AppleII { + +struct VolumeProvider { + static constexpr bool HasDriver = false; + + const char *name() const { + return "ProDOS"; + } + + const char *type() const { + return "Apple_PRODOS"; + } +}; + +using Mapper = Storage::MassStorage::Encodings::Apple::PartitionMap; + +} +} +} +} + +#endif /* AppleIIVolume_h */ diff --git a/Storage/MassStorage/Encodings/ApplePartitionMap.hpp b/Storage/MassStorage/Encodings/ApplePartitionMap.hpp index 0683cc08d..846ddba28 100644 --- a/Storage/MassStorage/Encodings/ApplePartitionMap.hpp +++ b/Storage/MassStorage/Encodings/ApplePartitionMap.hpp @@ -46,7 +46,7 @@ template class PartitionMap { size_t get_number_of_blocks() const { return number_of_blocks_ + // Size of the volume. - non_volume_blocks(); // Size of everything else. + size_t(non_volume_blocks()); // Size of everything else. } /*! @@ -226,7 +226,7 @@ template class PartitionMap { VolumeProvider volume_provider_; - size_t predriver_blocks() const { + ssize_t predriver_blocks() const { return 0x40; // Holding: // (i) the driver descriptor; @@ -234,13 +234,13 @@ template class PartitionMap { // (iii) the partition entries. } - size_t non_volume_blocks() const { + ssize_t non_volume_blocks() const { return predriver_blocks() + driver_block_size(); // Size of device driver (if any). } - size_t driver_block_size() const { + ssize_t driver_block_size() const { if constexpr (VolumeProvider::HasDriver) { return (volume_provider_.driver_size() + 511) >> 9; } else { diff --git a/Storage/MassStorage/Encodings/MacintoshVolume.hpp b/Storage/MassStorage/Encodings/MacintoshVolume.hpp index ae8e8e1fa..930c03c84 100644 --- a/Storage/MassStorage/Encodings/MacintoshVolume.hpp +++ b/Storage/MassStorage/Encodings/MacintoshVolume.hpp @@ -12,7 +12,6 @@ #include #include #include -#include #include "ApplePartitionMap.hpp"