From 96230429425b787842ab64816a23cf1feb33ca7c Mon Sep 17 00:00:00 2001 From: Harley Travis Date: Sat, 4 Jul 2026 16:01:34 -0500 Subject: Update DskImg.HC DskImg has finally been updated to use BlkRead instead of the now-deprecated low-level read routines. --- Examples/DskImg.HC | 43 +++++-------------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/Examples/DskImg.HC b/Examples/DskImg.HC index c63f216..f5fc1f5 100644 --- a/Examples/DskImg.HC +++ b/Examples/DskImg.HC @@ -1,8 +1,3 @@ -#define CYLINDERS 80 -#define SECTORS 18 -#define BASE 0x03F0 -#define IMG_SIZE 1474560 - /* Copyright (C) 2025-2026 Harley Travis . This software (including source code) is licensed under the BSD Zero Clause @@ -12,45 +7,17 @@ // PURPOSE: Demonstration of floppy driver // TO USE: #include this file at the cmd prompt or run it with F5. -/* - - Make sure IRQ6 is on and - pointed to the correct handler! - -*/ - U8 DskImg() { U64 i; + // Replace W with the letter you mounted your floppy as. + CDrv *dv=Let2Drv('W'); // Open image file for writing - CFile *img = FOpen("Floppy.IMG","w",IMG_SIZE/BLK_SIZE); - - // Initialize the controller - FDCReset(BASE); - Sleep(100); - - /* - - Loop through each sector, - reading each into the buffer, - then writing it into the file - - */ - - for (i = 0; i < CYLINDERS; i++) { - "Track %d\n", i; - FDCReadMulti(BASE, i, 0, 1, 18); - FBlkWrite(img, &FDC_DMA, 36 * i, 36); - } + CFile *img = FOpen("Floppy.IMG","w",dv->size*dv->bd->blk_size); - // Return to track 0 - "Returning to track 0...\n"; - if (FDCSeek(BASE, 0, 0)) { - FDCReset(BASE); - FClose(img); - return 1; - } + //Read every sector on the disk to the file + BlkRead(dv,img,0,bd->max_blk); // Close the image file FClose(img); -- cgit v1.2.3