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::readSectorImpl(size_t sector, SectorBuffer& buf)
17 {
18  memcpy(&buf, &data[sector], sizeof(buf));
19 }
20 
21 void RamDSKDiskImage::writeSectorImpl(size_t sector, const SectorBuffer& buf)
22 {
23  memcpy(&data[sector], &buf, sizeof(buf));
24 }
25 
26 bool RamDSKDiskImage::isWriteProtectedImpl() const
27 {
28  return false;
29 }
30 
31 } // namespace openmsx
Abstract class for disk images that only represent the logical sector information (so not the raw tra...
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:5
size_t size() const
uint8_t * data()
void format(SectorAccessibleDisk &disk, bool dos1)
Format the given disk (= a single partition).
void setNbSectors(size_t num)