diff options
| author | Harley Travis <harleytravis123@outlook.com> | 2026-07-04 16:01:34 -0500 |
|---|---|---|
| committer | Harley Travis <harleytravis123@outlook.com> | 2026-07-04 16:01:34 -0500 |
| commit | 96230429425b787842ab64816a23cf1feb33ca7c (patch) | |
| tree | 31434d718f91cad20e5389a7a3ec00ccf0559672 /Examples | |
| parent | 326f77c5c3d461fd86eb540a26d29ca271a37d1f (diff) | |
| download | templeos-floppy-driver-96230429425b787842ab64816a23cf1feb33ca7c.tar.gz | |
Update DskImg.HC
DskImg has finally been updated to use BlkRead instead of the now-deprecated low-level read routines.
Diffstat (limited to 'Examples')
| -rw-r--r-- | Examples/DskImg.HC | 43 |
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); |
