summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Examples/DskImg.HC43
1 files 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 <yoshi128k@gmail.com>.
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);