1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-19 08:31:11 +00:00

Fix types, introduce Apple II mapper.

This commit is contained in:
Thomas Harte 2022-08-24 12:00:03 -04:00
parent 91e9248ecc
commit 722e3a141d
4 changed files with 44 additions and 5 deletions

View File

@ -1366,6 +1366,7 @@
4B4C81C828B56CF800F84AE9 /* MacintoshVolume.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = MacintoshVolume.hpp; sourceTree = "<group>"; };
4B4C81C928B56CF800F84AE9 /* MacintoshVolume.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacintoshVolume.cpp; sourceTree = "<group>"; };
4B4C81CC28B56DD400F84AE9 /* ApplePartitionMap.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ApplePartitionMap.hpp; sourceTree = "<group>"; };
4B4C81CD28B67FCD00F84AE9 /* AppleIIVolume.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = AppleIIVolume.hpp; sourceTree = "<group>"; };
4B4DC81F1D2C2425003C5BF8 /* Vic20.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Vic20.cpp; sourceTree = "<group>"; };
4B4DC8201D2C2425003C5BF8 /* Vic20.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Vic20.hpp; sourceTree = "<group>"; };
4B4DC8271D2C2470003C5BF8 /* C1540.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = C1540.hpp; sourceTree = "<group>"; };
@ -2927,6 +2928,7 @@
4B4C81C928B56CF800F84AE9 /* MacintoshVolume.cpp */,
4B4C81CC28B56DD400F84AE9 /* ApplePartitionMap.hpp */,
4B4C81C828B56CF800F84AE9 /* MacintoshVolume.hpp */,
4B4C81CD28B67FCD00F84AE9 /* AppleIIVolume.hpp */,
);
path = Encodings;
sourceTree = "<group>";

View File

@ -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<VolumeProvider>;
}
}
}
}
#endif /* AppleIIVolume_h */

View File

@ -46,7 +46,7 @@ template <typename VolumeProvider> 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 <typename VolumeProvider> 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 <typename VolumeProvider> 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 {

View File

@ -12,7 +12,6 @@
#include <cstddef>
#include <cstdint>
#include <sys/types.h>
#include <vector>
#include "ApplePartitionMap.hpp"