ROLAND  0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
track.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Fred Klaus *
3  * frednet@web.de *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 #ifndef CPC_DISKTRACK_H
21 #define CPC_DISKTRACK_H
22 
23 #include "types.h"
24 #include "sector.h"
25 #include "fdcconst.h"
26 
27 #include <cstring>
28 
29 namespace cpcx
30 {
32  class Track final
33  {
34  public:
35  Track() {std::memset(this, 0, sizeof(*this));}
37 
38  tUBYTE* data() const {return mData;}
39  uint sectors() const {return mSectors;}
40  uint size() const {return mSize;}
41  Sector & sector(int num) {return mSector[num];}
42 
44  void setSize(uint size) {mSize = size;}
45  void setData(tUBYTE* data) {mData = data;}
46  void set(tUBYTE num, int size) {memset(mData, num, size);}
47 
48  void clear() {delete [] mData; mData = nullptr;}
49 
50  private:
55  };
56 } // namespace cpcx
57 
58 #endif // CPC_DISKTRACK_H
void clear()
Definition: track.h:48
void setSize(uint size)
Definition: track.h:44
uint size() const
Definition: track.h:40
Namespace for all CPC components.
Definition: colours.cpp:22
tUBYTE * mData
track size in bytes
Definition: track.h:53
Sector mSector[29]
pointer to track data
Definition: track.h:54
void setData(tUBYTE *data)
Definition: track.h:45
#define DSK_SECTORMAX
Definition: fdcconst.h:27
A track of a disk.
Definition: track.h:32
uint mSize
sector count for this track
Definition: track.h:52
A sector of a disk.
Definition: sector.h:29
void setSectors(uint sectors)
Definition: track.h:43
Track()
Definition: track.h:35
uint sectors() const
Definition: track.h:39
Sector & sector(int num)
Definition: track.h:41
#define ROLAND_DEFAULT
Definition: compspec.h:46
uint8_t tUBYTE
Definition: types.h:74
unsigned int uint
Definition: types.h:121
uint mSectors
Definition: track.h:51
~Track() ROLAND_DEFAULT tUBYTE *data() const
Definition: track.h:36