diff --git a/doc/using.md b/doc/using.md index 87930e33..69c3336b 100644 --- a/doc/using.md +++ b/doc/using.md @@ -291,6 +291,29 @@ FluxEngine also supports a number of file system image formats. When using the circumstances as it can represent arbitrary sector layouts as read from the floppy. + - `` + + Read from a [imd image file](http://dunfield.classiccmp.org/img/index.htm), + imd images are entire diskette images read into a file (type .IMD), + it's purpose is to recreate a copy of the diskette from that image. A detailed analysis + is performed on the diskette, and information about the formatting is recorded + in the image file. This allows ImageDisk to work with virtually any soft- + sectored diskette format that is compatible with the PC's type 765 floppy + diskette controller and drives. + + FluxEngine is able to read from and write to an imd image file. + + The imd reader should mostly be used with the `ibm` profile or ibm deratives + and will override most encoding parameters on a track-by-track basis. + + The imd writer should likewise mostly be used with the `ibm` profile in most + circumstances as it can represent arbitrary sector layouts as read + from the floppy. + + With options it is possible to add a comment for the resulting image when archiving + floppies. By default imd images assume MFM encoding, but this can by changed + by suppling the option RECMODE_FM. + - `` Read from a [NFD r0 image file](https://www.pc98.org/project/doc/nfdr0.html), diff --git a/lib/imagewriter/imdimagewriter.cc b/lib/imagewriter/imdimagewriter.cc index 41e0cbcd..492c7e05 100644 --- a/lib/imagewriter/imdimagewriter.cc +++ b/lib/imagewriter/imdimagewriter.cc @@ -135,23 +135,19 @@ public: void writeImage(const Image& image) { const Geometry& geometry = image.getGeometry(); - unsigned numCylinders; unsigned numHeads; unsigned numSectors; unsigned numBytes; std::ofstream outputFile(_config.filename(), std::ios::out | std::ios::binary); if (!outputFile.is_open()) Error() << "IMD: cannot open output file"; - uint32_t offset = 0; +// uint32_t offset = 0; unsigned numSectorsinTrack = 0; numHeads = geometry.numSides; numSectors = geometry.numSectors; numBytes = geometry.sectorSize; - size_t headSize = geometry.numSectors * geometry.sectorSize; - size_t trackSize = headSize * geometry.numSides; - Bytes imagenew; ByteWriter bw(imagenew); @@ -421,10 +417,9 @@ public: } } } - numCylinders = geometry.numTracks; //-emptyCylinders; //calculate the cylinders with sectors and hence data. Otherwise the calculation of kB goes wrong imagenew.writeTo(outputFile); Logger() << fmt::format("IMD: Written {} tracks, {} heads, {} sectors, {} bytes per sector, {} kB total", - numCylinders, numHeads, + geometry.numTracks, numHeads, numSectors, numBytes, outputFile.tellp() / 1024); }