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(data.size());
12 
14 }
15 
17 {
18 }
19 
20 void RamDSKDiskImage::readSectorImpl(size_t sector, SectorBuffer& buf)
21 {
22  memcpy(&buf, &data[sector], sizeof(buf));
23 }
24 
25 void RamDSKDiskImage::writeSectorImpl(size_t sector, const SectorBuffer& buf)
26 {
27  memcpy(&data[sector], &buf, sizeof(buf));
28 }
29 
30 bool RamDSKDiskImage::isWriteProtectedImpl() const
31 {
32  return false;
33 }
34 
35 } // namespace openmsx
void format(SectorAccessibleDisk &disk, bool dos1)
Abstract class for disk images that only represent the logical sector information (so not the raw tra...
size_t size() const
Returns size of the memory buffer.
Definition: MemBuffer.hh:113
RamDSKDiskImage(size_t size=720 *1024)
This class represents a filename.
Definition: Filename.hh:17
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:7
size_t size(string_ref utf8)
void setNbSectors(size_t num)