openMSX
RamDSKDiskImage.cc
Go to the documentation of this file.
1 #include "RamDSKDiskImage.hh"
2 #include "DiskImageUtils.hh"
3 #include <cstring>
4 
5 namespace openmsx {
6 
8  : SectorBasedDisk(DiskName(Filename(), "ramdsk"))
9  , data(size / sizeof(SectorBuffer))
10 {
11  setNbSectors(size / sizeof(SectorBuffer));
12 
14 }
15 
16 void RamDSKDiskImage::readSectorsImpl(
17  SectorBuffer* buffers, size_t startSector, size_t num)
18 {
19  memcpy(buffers, &data[startSector], num * sizeof(SectorBuffer));
20 }
21 
22 void RamDSKDiskImage::writeSectorImpl(size_t sector, const SectorBuffer& buf)
23 {
24  memcpy(&data[sector], &buf, sizeof(buf));
25 }
26 
27 bool 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, bool dos1)
Format the given disk (= a single partition).
This file implemented 3 utility functions:
Definition: Autofire.cc:5
size_t size(std::string_view utf8)