Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Reading floppy disks

Reading floppy disks

Scheduled Pinned Locked Moved The Lounge
4 Posts 3 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brigg Thorp
    wrote on last edited by
    #1

    Does anyone know where I could get some code to read the tracks of a floppy disk? I haven't been able to find an API to do this and I'm not sure how to handle this between Windows 95/98/ME and Windows NT/2000. I would like to create a disk copy program that you can store images on your hard drive and write multiple copies. I think this feature is lacking for Windows (it should be built-in) and I would like to solve this problem. If you know how to do this for Zip drives, I could also use any information anyone has. Brigham W. Thorp Software Engineer Timex Corporation

    N E 2 Replies Last reply
    0
    • B Brigg Thorp

      Does anyone know where I could get some code to read the tracks of a floppy disk? I haven't been able to find an API to do this and I'm not sure how to handle this between Windows 95/98/ME and Windows NT/2000. I would like to create a disk copy program that you can store images on your hard drive and write multiple copies. I think this feature is lacking for Windows (it should be built-in) and I would like to solve this problem. If you know how to do this for Zip drives, I could also use any information anyone has. Brigham W. Thorp Software Engineer Timex Corporation

      N Offline
      N Offline
      NormDroid
      wrote on last edited by
      #2

      Brigham I found this if it helps... #include #include #include /***** WARNING!!!!! ******/ /* If you change the following line so that DRIVE_A is assigned a 2 or above, you could destroy data on your hard drive. This test program segment was written to read and write from the floppy disk A: */ #define DRIVE_A 0 /* 0=A, 1=B, 2=C, etc. */ #define ONE_SECTOR 1 #define ABS_WRITE 38 /* Decimal value of int call */ #define ABS_READ 37 /* Decimal value of int call */ unsigned int far *out; /* Pointer to Data to be output */ unsigned int far *input; /* Pointer to Data Transfer Area */ unsigned int output; /* Data to be output */ union REGS inregs, outregs; struct SREGS segregs; void main(void) { out = &output; input = (unsigned int far *) malloc(1024 * sizeof(unsigned int)); *out = 11; inregs.h.al = DRIVE_A; /* Write to drive A */ inregs.x.cx = ONE_SECTOR; /* Write one sector only */ inregs.x.dx = 3; /* Logical sector 3 */ segregs.ds = FP_SEG(out); /* Get Seg address of output */ inregs.x.bx = FP_OFF(out); /* Get Offset of output */ outregs.x.ax = 0; /* No error */ int86x (ABS_WRITE, &inregs, &outregs, &segregs); inregs.h.al = DRIVE_A; /* Read to drive A */ inregs.x.cx = ONE_SECTOR; /* Read one sector only */ inregs.x.dx = 3; /* Logical sector 3 */ segregs.ds = FP_SEG(input); /* Get Seg address of buffer */ inregs.x.bx = FP_OFF(input); /* Get Offset of buffer */ outregs.x.ax = 0; /* No error */ int86x (ABS_READ, &inregs, &outregs, &segregs); printf ("%u was read from drive A: \n", *input); } Regards Norm

      B 1 Reply Last reply
      0
      • N NormDroid

        Brigham I found this if it helps... #include #include #include /***** WARNING!!!!! ******/ /* If you change the following line so that DRIVE_A is assigned a 2 or above, you could destroy data on your hard drive. This test program segment was written to read and write from the floppy disk A: */ #define DRIVE_A 0 /* 0=A, 1=B, 2=C, etc. */ #define ONE_SECTOR 1 #define ABS_WRITE 38 /* Decimal value of int call */ #define ABS_READ 37 /* Decimal value of int call */ unsigned int far *out; /* Pointer to Data to be output */ unsigned int far *input; /* Pointer to Data Transfer Area */ unsigned int output; /* Data to be output */ union REGS inregs, outregs; struct SREGS segregs; void main(void) { out = &output; input = (unsigned int far *) malloc(1024 * sizeof(unsigned int)); *out = 11; inregs.h.al = DRIVE_A; /* Write to drive A */ inregs.x.cx = ONE_SECTOR; /* Write one sector only */ inregs.x.dx = 3; /* Logical sector 3 */ segregs.ds = FP_SEG(out); /* Get Seg address of output */ inregs.x.bx = FP_OFF(out); /* Get Offset of output */ outregs.x.ax = 0; /* No error */ int86x (ABS_WRITE, &inregs, &outregs, &segregs); inregs.h.al = DRIVE_A; /* Read to drive A */ inregs.x.cx = ONE_SECTOR; /* Read one sector only */ inregs.x.dx = 3; /* Logical sector 3 */ segregs.ds = FP_SEG(input); /* Get Seg address of buffer */ inregs.x.bx = FP_OFF(input); /* Get Offset of buffer */ outregs.x.ax = 0; /* No error */ int86x (ABS_READ, &inregs, &outregs, &segregs); printf ("%u was read from drive A: \n", *input); } Regards Norm

        B Offline
        B Offline
        Brigg Thorp
        wrote on last edited by
        #3

        This is great for a DOS based application, but the REGS stuff is not supported for Windows based applications. This won't compile in a Windows application. You can do any inp and outp stuff winth NT anyhow. If anyone knows of a way to do this under Windows I would appreciate it. Brigham W. Thorp Software Engineer Timex Corporation

        1 Reply Last reply
        0
        • B Brigg Thorp

          Does anyone know where I could get some code to read the tracks of a floppy disk? I haven't been able to find an API to do this and I'm not sure how to handle this between Windows 95/98/ME and Windows NT/2000. I would like to create a disk copy program that you can store images on your hard drive and write multiple copies. I think this feature is lacking for Windows (it should be built-in) and I would like to solve this problem. If you know how to do this for Zip drives, I could also use any information anyone has. Brigham W. Thorp Software Engineer Timex Corporation

          E Offline
          E Offline
          Erik Funkenbusch
          wrote on last edited by
          #4

          Look at the CreateFile API in the Platform SDK, you can specify a device such as "\\.\A:" to open the floppy disk. This handle can then be used with DeviceIoControl function to read sectors.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups