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
openmsx::DiskImageUtils::format
void format(SectorAccessibleDisk &disk, bool dos1)
Format the given disk (= a single partition).
Definition: DiskImageUtils.cc:188
openmsx::SectorBuffer
Definition: DiskImageUtils.hh:90
utf8::unchecked::size
size_t size(std::string_view utf8)
Definition: utf8_unchecked.hh:227
RamDSKDiskImage.hh
DiskImageUtils.hh
openmsx::DiskName
Definition: DiskName.hh:9
openmsx::SectorBasedDisk::setNbSectors
void setNbSectors(size_t num)
Definition: SectorBasedDisk.cc:147
openmsx::RamDSKDiskImage::RamDSKDiskImage
RamDSKDiskImage(size_t size=720 *1024)
Definition: RamDSKDiskImage.cc:7
openmsx::SectorBasedDisk
Abstract class for disk images that only represent the logical sector information (so not the raw tra...
Definition: SectorBasedDisk.hh:14
openmsx::Filename
This class represents a filename.
Definition: Filename.hh:18
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5