1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-13 07:30:21 +00:00

Minor tidying of PCMSegment and Oric MFM DSK.

This commit is contained in:
Thomas Harte 2018-01-09 22:12:34 -05:00
parent 9f97fb738e
commit 4ef583813a
2 changed files with 8 additions and 5 deletions

View File

@ -8,10 +8,10 @@
#include "OricMFMDSK.hpp"
#include "../../Track/PCMTrack.hpp"
#include "../../Encodings/MFM/Constants.hpp"
#include "../../Encodings/MFM/Shifter.hpp"
#include "../../Encodings/MFM/Encoder.hpp"
#include "../../Track/PCMTrack.hpp"
#include "../../Track/TrackSerialiser.hpp"
using namespace Storage::Disk;
@ -109,9 +109,7 @@ std::shared_ptr<Track> OricMFMDSK::get_track_at_position(Track::Address address)
}
segment.number_of_bits = static_cast<unsigned int>(segment.data.size() * 8);
std::shared_ptr<PCMTrack> track(new PCMTrack(segment));
return track;
return std::make_shared<PCMTrack>(segment);
}
void OricMFMDSK::set_tracks(const std::map<Track::Address, std::shared_ptr<Track>> &tracks) {

View File

@ -26,7 +26,7 @@ namespace Disk {
*/
struct PCMSegment {
Time length_of_a_bit;
unsigned int number_of_bits;
unsigned int number_of_bits = 0;
std::vector<uint8_t> data;
PCMSegment(Time length_of_a_bit, unsigned int number_of_bits, std::vector<uint8_t> data)
@ -36,6 +36,11 @@ struct PCMSegment {
int bit(std::size_t index) const {
return (data[index >> 3] >> (7 ^ (index & 7)))&1;
}
void clear() {
number_of_bits = 0;
data.clear();
}
};
/*!