Skip to content

Commit 6b7e81d

Browse files
committed
Move requiredSectors() to the base class.
1 parent dce6248 commit 6b7e81d

File tree

10 files changed

+2
-78
lines changed

10 files changed

+2
-78
lines changed

arch/amiga/decoder.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@ class AmigaDecoder : public Decoder
6868
_sector->status = (gotdatachecksum == wanteddatachecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
6969
}
7070

71-
std::set<unsigned> requiredSectors(const Location&) const override
72-
{
73-
static std::set<unsigned> sectors = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
74-
return sectors;
75-
}
76-
7771
private:
7872
const AmigaDecoderProto& _config;
7973
nanoseconds_t _clock;

arch/apple2/decoder.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,6 @@ class Apple2Decoder : public Decoder
144144
_sector->status = Sector::BAD_CHECKSUM;
145145
_sector->data = decode_crazy_data(&bytes[0], _sector->status);
146146
}
147-
148-
std::set<unsigned> requiredSectors(const Location& location) const override
149-
{
150-
std::set<unsigned> sectors;
151-
for (int sectorId = 0; sectorId < APPLE2_SECTORS; sectorId++)
152-
sectors.insert(sectorId);
153-
return sectors;
154-
}
155147
};
156148

157149
std::unique_ptr<Decoder> createApple2Decoder(const DecoderProto& config)

arch/c64/c64.cc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@
1313
*
1414
* The clock rate is normalised for a 200ms drive.
1515
*/
16-
unsigned sectorsForC64Track(unsigned track)
17-
{
18-
if (track < 17)
19-
return 21;
20-
if (track < 24)
21-
return 19;
22-
if (track < 30)
23-
return 18;
24-
return 17;
25-
}
2616

2717
nanoseconds_t clockPeriodForC64Track(unsigned track)
2818
{

arch/c64/c64.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
extern std::unique_ptr<Decoder> createCommodore64Decoder(const DecoderProto& config);
3131
extern std::unique_ptr<Encoder> createCommodore64Encoder(const EncoderProto& config);
3232

33-
extern unsigned sectorsForC64Track(unsigned track);
3433
extern nanoseconds_t clockPeriodForC64Track(unsigned track);
3534

3635
#endif

arch/c64/decoder.cc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,6 @@ class Commodore64Decoder : public Decoder
9494
_sector->status =
9595
(wantChecksum == gotChecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
9696
}
97-
98-
std::set<unsigned> requiredSectors(const Location& location) const override
99-
{
100-
unsigned count = sectorsForC64Track(location.logicalTrack);
101-
std::set<unsigned> sectors;
102-
for (int sectorId = 0; sectorId < count; sectorId++)
103-
sectors.insert(sectorId);
104-
return sectors;
105-
}
10697
};
10798

10899
std::unique_ptr<Decoder> createCommodore64Decoder(

arch/ibm/decoder.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,6 @@ class IbmDecoder : public Decoder
207207
(wantCrc == gotCrc) ? Sector::OK : Sector::BAD_CHECKSUM;
208208
}
209209

210-
std::set<unsigned> requiredSectors(const Location& location) const override
211-
{
212-
auto& trackLayout =
213-
Layout::getLayoutOfTrack(location.logicalTrack, location.head);
214-
return std::set<unsigned>(trackLayout.logicalSectorOrder.begin(),
215-
trackLayout.logicalSectorOrder.end());
216-
}
217-
218210
private:
219211
void getTrackFormat(IbmDecoderProto::TrackdataProto& trackdata,
220212
unsigned track,

arch/macintosh/decoder.cc

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -182,28 +182,6 @@ class MacintoshDecoder : public Decoder
182182
_sector->data.clear();
183183
_sector->data.writer().append(userData.slice(12, 512)).append(userData.slice(0, 12));
184184
}
185-
186-
std::set<unsigned> requiredSectors(const Location& location) const override
187-
{
188-
unsigned track = location.logicalTrack;
189-
190-
int count;
191-
if (track < 16)
192-
count = 12;
193-
else if (track < 32)
194-
count = 11;
195-
else if (track < 48)
196-
count = 10;
197-
else if (track < 64)
198-
count = 9;
199-
else
200-
count = 8;
201-
202-
std::set<unsigned> sectors;
203-
while (count--)
204-
sectors.insert(count);
205-
return sectors;
206-
}
207185
};
208186

209187
std::unique_ptr<Decoder> createMacintoshDecoder(const DecoderProto& config)

arch/micropolis/decoder.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,6 @@ class MicropolisDecoder : public Decoder
173173
_sector->status = (wantChecksum == gotChecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
174174
}
175175

176-
std::set<unsigned> requiredSectors(const Location& location) const override
177-
{
178-
static std::set<unsigned> sectors = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
179-
return sectors;
180-
}
181-
182176
private:
183177
const MicropolisDecoderProto& _config;
184178
MicropolisDecoderProto_ChecksumType _checksumType; /* -1 = auto, 1 = Micropolis, 2=MZOS */

arch/northstar/decoder.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,6 @@ class NorthstarDecoder : public Decoder
164164
_sector->status = (wantChecksum == gotChecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
165165
}
166166

167-
std::set<unsigned> requiredSectors(const Location&) const override
168-
{
169-
static std::set<unsigned> sectors = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
170-
return sectors;
171-
}
172-
173167
private:
174168
const NorthstarDecoderProto& _config;
175169
uint8_t _hardSectorId;

lib/decoders/decoders.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ uint64_t Decoder::readRaw64()
225225

226226
std::set<unsigned> Decoder::requiredSectors(const Location& location) const
227227
{
228-
static std::set<unsigned> set;
229-
return set;
228+
const auto& trackLayout = Layout::getLayoutOfTrack(location.logicalTrack, location.head);
229+
return std::set(trackLayout.logicalSectorOrder.begin(), trackLayout.logicalSectorOrder.end());
230230
}
231231

0 commit comments

Comments
 (0)