openMSX
Disk.hh
Go to the documentation of this file.
1 #ifndef DISK_HH
2 #define DISK_HH
3 
5 #include "DiskName.hh"
6 #include "openmsx.hh"
7 
8 namespace openmsx {
9 
10 class RawTrack;
11 
12 class Disk : public SectorAccessibleDisk
13 {
14 public:
15  virtual ~Disk() {}
16 
17  const DiskName& getName() const { return name; }
18 
20  void writeTrack(byte track, byte side, const RawTrack& input);
21 
23  virtual void readTrack (byte track, byte side, RawTrack& output) = 0;
24 
25  bool isDoubleSided();
26 
27 protected:
28  explicit Disk(DiskName name);
29  size_t physToLog(byte track, byte side, byte sector);
30  void logToPhys(size_t log, byte& track, byte& side, byte& sector);
31 
32  virtual void detectGeometry();
33  virtual void detectGeometryFallback();
34 
35  void setSectorsPerTrack(unsigned num) { sectorsPerTrack = num; }
36  unsigned getSectorsPerTrack();
37  void setNbSides(unsigned num) { nbSides = num; }
38 
39  virtual void writeTrackImpl(byte track, byte side, const RawTrack& input) = 0;
40 
41 private:
42  const DiskName name;
43  unsigned sectorsPerTrack;
44  unsigned nbSides;
45 };
46 
47 } // namespace openmsx
48 
49 #endif
void setSectorsPerTrack(unsigned num)
Definition: Disk.hh:35
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
void logToPhys(size_t log, byte &track, byte &side, byte &sector)
Definition: Disk.cc:46
virtual void readTrack(byte track, byte side, RawTrack &output)=0
Read a full track from this disk image.
size_t physToLog(byte track, byte side, byte sector)
Definition: Disk.cc:36
Disk(DiskName name)
Definition: Disk.cc:8
virtual void writeTrackImpl(byte track, byte side, const RawTrack &input)=0
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
const DiskName & getName() const
Definition: Disk.hh:17
void setNbSides(unsigned num)
Definition: Disk.hh:37
unsigned getSectorsPerTrack()
Definition: Disk.cc:62
void writeTrack(byte track, byte side, const RawTrack &input)
Replace a full track in this image with the given track.
Definition: Disk.cc:13
bool isDoubleSided()
Definition: Disk.cc:22
virtual void detectGeometryFallback()
Definition: Disk.cc:70
virtual void detectGeometry()
Definition: Disk.cc:78
virtual ~Disk()
Definition: Disk.hh:15