Open gdampf opened 3 years ago
I think, this could be optimized, but seams to work: `void Mits88Disk::sendDiskImageToStream(int drive, Stream * stream) { const int prevDrive = m_drive; const bool prev_enabled = m_enabled; const int prevTrack = m_track[drive]; const int prevLoaded = m_headLoaded[drive];
m_headLoaded[drive] = 0; m_enabled = true; setDrive(drive);
int len = 0; int notz = 0; for (int t = 0; t < m_tracksCount; ++t) { m_track[m_drive] = t; for (int s = 0; s < m_trackSize; ++s) { m_sector[m_drive] = s; m_pos[m_drive] = 0; for (int b = 0; b < SECTOR_SIZE; ++b) { int v = readByteFromDisk(); stream->write(v); len++; } } }
setDrive(prevDrive); m_enabled = prev_enabled; m_headLoaded[drive] = prevLoaded; m_track[drive] = prevTrack;
}`
Just start a fresh Altair8800, press Pause S A and you will get a stream of zeros in the length of the disk. One of the pre-conditions is not initialized for the selected disk (m_enabled or m_headLoaded). By saving and initializing m_enabled = true and m_headLoaded = 0 and restore it at the end, Mits88Disk::sendDiskImageToStream will work correctly. I guess, it is the same for Mits88Disk::receiveDiskImageFromStream.