openMSX
XSADiskImage.cc
Go to the documentation of this file.
1#include "XSADiskImage.hh"
2
3#include "DiskExceptions.hh"
4#include "XSAExtractor.hh"
5
6#include "File.hh"
7
8namespace openmsx {
9
11 : SectorBasedDisk(DiskName(filename))
12{
13 XSAExtractor extractor(file.mmap());
14 data = std::move(extractor).extractData();
15 setNbSectors(data.size());
16}
17
18void XSADiskImage::readSectorsImpl(
19 std::span<SectorBuffer> buffers, size_t startSector)
20{
21 ranges::copy(std::span{&data[startSector], buffers.size()}, buffers);
22}
23
24void XSADiskImage::writeSectorImpl(size_t /*sector*/, const SectorBuffer& /*buf*/)
25{
26 throw WriteProtectedException("Write protected");
27}
28
29bool XSADiskImage::isWriteProtectedImpl() const
30{
31 return true;
32}
33
34} // namespace openmsx
std::span< const uint8_t > mmap()
Map file in memory.
Definition File.cc:102
This class represents a filename.
Definition Filename.hh:20
Abstract class for disk images that only represent the logical sector information (so not the raw tra...
void setNbSectors(size_t num)
XSADiskImage(const Filename &filename, File &file)
This file implemented 3 utility functions:
Definition Autofire.cc:11
constexpr auto copy(InputRange &&range, OutputIter out)
Definition ranges.hh:252