MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / ReadTrack

Method ReadTrack

source/Disk.cpp:304–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302//===========================================================================
303
304void Disk2InterfaceCard::ReadTrack(const int drive, ULONG uExecutedCycles)
305{
306 if (!IsDriveValid( drive ))
307 return;
308
309 FloppyDrive* pDrive = &m_floppyDrive[ drive ];
310 FloppyDisk* pFloppy = &pDrive->m_disk;
311
312 if (ImagePhaseToTrack(pFloppy->m_imagehandle, pDrive->m_phasePrecise, false) >= ImageGetNumTracks(pFloppy->m_imagehandle))
313 {
314 if (ImageIsZeroTracksValidForThisType(pFloppy->m_imagehandle))
315 return;
316
317 _ASSERT(0); // What can cause this? Add a comment to replace this assert.
318 // Boot with DOS 3.3 Master in D1
319 // Create a blank disk in D2
320 // INIT HELLO,D2
321 // RUN HELLO
322 // F2 to reboot DOS 3.3 Master
323 // RUN HELLO,D2
324 pFloppy->m_trackimagedata = false;
325 return;
326 }
327
328 if (!pFloppy->m_trackimage)
329 AllocTrack( drive );
330
331 if (pFloppy->m_trackimage && pFloppy->m_imagehandle)
332 {
333 if (ImageIsWOZ(pFloppy->m_imagehandle))
334 {
335 // Update bitStream position for *current* track before re-calc'ing position for new track
336 UINT bitCellDelta = GetBitCellDelta(uExecutedCycles);
337 UpdateBitStreamPosition(*pFloppy, bitCellDelta);
338 }
339
340 if (ImageIsWOZ(pFloppy->m_imagehandle) && (pFloppy->m_bitCount == 0))
341 {
342 // WOZ: m_bitCount only ever 0 on initial power on
343 pFloppy->m_bitOffset = 0;
344 pFloppy->m_bitCount = 8;
345 }
346
347 const UINT32 currentBitPosition = pFloppy->m_bitOffset;
348 const UINT32 currentBitTrackLength = pFloppy->m_bitCount;
349
350 ImageReadTrack(
351 pFloppy->m_imagehandle,
352 pDrive->m_phasePrecise,
353 pFloppy->m_trackimage,
354 &pFloppy->m_nibbles,
355 &pFloppy->m_bitCount,
356 m_enhanceDisk);
357
358 if (!ImageIsWOZ(pFloppy->m_imagehandle))
359 {
360 pFloppy->m_byte = 0;
361 }

Callers

nothing calls this directly

Calls 5

ImagePhaseToTrackFunction · 0.85
ImageGetNumTracksFunction · 0.85
ImageIsWOZFunction · 0.85
ImageReadTrackFunction · 0.85

Tested by

no test coverage detected