/* Copyright (C) 2025-2026 Harley Travis . This software (including source code) is licensed under the BSD Zero Clause License. See the Copying.TXT file for details. */ // PURPOSE: Demonstration of floppy driver // TO USE: #include this file at the cmd prompt or run it with F5. U8 DskImg() { // Replace W with the letter you mounted your floppy as. CDrv *dv=Let2Drv('W'); CBlkDev *bd=dv->blkdev; U8 *buf=NULL; U64 cyl,blk=0,cyl_len=bd->heads*bd->spt; // Open image file for writing CFile *img = FOpen("Floppy.IMG.C","wc",dv->size); // Allocate a buffer for the cylinders buf=MAlloc(cyl_len*bd->blk_size) xfer_blk: // If we are past the last blk, stop. if (blk>bd->max_blk) goto done; //Read in the cylinder BlkRead(dv,buf,blk,cyl_len); // Write it to the file FBlkWrite(img,buf,blk,cyl_len); // Move to the next cylinder blk+=cyl_len; done: // Close the image file and release the buffer FClose(img); Free(buf); return 0; } DskImg;