MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / command_read

Function command_read

src/blkdev_cdimage.cpp:1248–1280  ·  view source on GitHub ↗

return standard 2048 byte sectors only

Source from the content-addressed store, hash-verified

1246
1247// return standard 2048 byte sectors only
1248static int command_read (int unitnum, uae_u8 *data, int sector, int numsectors)
1249{
1250 struct cdunit *cdu = unitisopen (unitnum);
1251 if (!cdu)
1252 return 0;
1253 struct cdtoc *t = findtoc (cdu, &sector, true);
1254 if (!t)
1255 return 0;
1256 cdda_stop (cdu);
1257 if (t->size == 2048) {
1258 while (numsectors-- > 0) {
1259 do_read (cdu, t, data, sector, 0, 2048, false);
1260 data += 2048;
1261 sector++;
1262 }
1263 } else {
1264 while (numsectors-- > 0) {
1265 if (t->size == 2352) {
1266 uae_u8 b = 0;
1267 do_read (cdu, t, &b, sector, 15, 1, false);
1268 // 2 = MODE2
1269 do_read (cdu, t, data, sector, b == 2 ? 24 : 16, 2048, false);
1270 } else {
1271 // 2336
1272 do_read (cdu, t, data, sector, 8, 2048, false);
1273 }
1274 data += 2048;
1275 sector++;
1276 }
1277 }
1278 cdu->cd_last_pos = sector;
1279 return 1;
1280}
1281
1282static int command_toc (int unitnum, struct cd_toc_head *th)
1283{

Callers

nothing calls this directly

Calls 4

findtocFunction · 0.85
cdda_stopFunction · 0.85
do_readFunction · 0.85
unitisopenFunction · 0.70

Tested by

no test coverage detected