openMSX
RamDSKDiskImage.cc
Go to the documentation of this file.
1#include "RamDSKDiskImage.hh"
2#include "DiskImageUtils.hh"
3#include "ranges.hh"
4
5namespace openmsx {
6
8 : SectorBasedDisk(DiskName(Filename(), "ramdsk"))
9 , data(size / sizeof(SectorBuffer))
10{
11 setNbSectors(size / sizeof(SectorBuffer));
12
14}
15
16void RamDSKDiskImage::readSectorsImpl(
17 std::span<SectorBuffer> buffers, size_t startSector)
18{
19 ranges::copy(std::span{&data[startSector], buffers.size()}, buffers);
20}
21
22void RamDSKDiskImage::writeSectorImpl(size_t sector, const SectorBuffer& buf)
23{
24 data[sector] = buf;
25}
26
27bool RamDSKDiskImage::isWriteProtectedImpl() const
28{
29 return false;
30}
31
32} // namespace openmsx
This class represents a filename.
Definition Filename.hh:18
RamDSKDiskImage(size_t size=720 *1024)
Abstract class for disk images that only represent the logical sector information (so not the raw tra...
void setNbSectors(size_t num)
void format(SectorAccessibleDisk &disk, MSXBootSectorType bootType)
Format the given disk (= a single partition).
This file implemented 3 utility functions:
Definition Autofire.cc:9
auto copy(InputRange &&range, OutputIter out)
Definition ranges.hh:250