I have recently fixed an old IBM Clone, which has an MFM hard drive. The PC booted up fine, but then I saw, that a few years back, I have deleted a few important files (probably by mistake). The computer runs DOS 3.2, so there is no 'UNDELETE' command. I think I should just image the drive, and then mount the image on my main computer, and recover the files this way. The only problem is, that I cannot write any files onto the drive of this machine, as it would likely damage the deleted files, so I need to be working off of a 360K floppy. I think I need to write a program that would just read the disk in segments and send them over to my new computer with RS-232. I have written multiple x86 ASM applications for DOS, but I cannot find an interrupt function that would allow me to read the drive, and not just the file. I know of the 13h interrupt, which would allow me to read raw data off of the drive, but I don't know how to get the parameters in order to call this function(sector, cylinder, head, drive).
You seem to be proposing a custom HDD "driver" that would image the HDD block-by-block by sending those blocks across a serial port to some sort of process running on your modern computer that assembles the blocks into an image file. This could be error prone and time consuming to implement.
An alternative suggestion is to use a legacy DOS Utility, such as PC Tools 1.x, that includes an Undelete utility. If you can just image a floppy with PC Tools, or similar utility, then you can boot from the floppy and try to recover your files in the same way you would have "back in the day".
You also state that you have 25MiB of potentially recoverable files. Once you have successfully restored them on your HDD, you then have lots of options to copy them, file-by-file, over the serial port to a modern computer. Again, legacy DOS utilities can do the trick, just as was done "back in the day" to move files between PCs with a null-modem cable.
I'm actually attempting to do this right now, so I figured I'd add what I found so far.
Looks like one attempt to do this was https://github.com/tschak909/disk-xfer. It supports a Xmodem-style CRC16 on each sector, but it doesn't appear to support working around bad sectors like
ddrescue does. It also doesn't have much of a user interface on the DOS side, and it uses INT 14H for serial I/O, which is probably not that fast (although a FOSSIL driver seems to fix this). Since I'm pretty sure my ancient hard drive has at least one bad sector, I won't be able to use this as-is.
Another person posted an account of using the XD driver (that was removed in Linux 3.9-rc1) to image the drive directly on a Linux machine that has an ISA slot. Doing some more digging, I found one more person working on some bug fixes for that driver right before it got purged, so these fixes might need to be applied. He was able to create an image that could boot off of floppies, but slightly more modern machines should be able to boot directly off a CD or DVD.
I'm going to attempt to do the serial port approach first (since I don't want to move that drive any more than I need to), then I might give the Linux approach a try.
I actually wrote a program a while back to image a hard drive in DOS and send the result over serial. However, It uses "new" extended BIOS methods based on LBA adresses rather than traditional C/H/S sectors, so I doubt it will work with an MFM-era machine.
The data is sent using run length encoding on 0s to speed up the process a bit, so you need to run the received data through the
I know of the 13h interrupt, which would allow me to read raw data off of the drive, but I don't know how to get the parameters in order to call this function(sector, cylinder, head, drive).
INT 13h is actually a set of routines; which one is called is determined by AH. (That list on Wikipedia covers various extensions as well, you won't have all of those on older machines. This list covers what's available from the ROM BIOS on early PCs.)
You can get the C/H/S parameters for the drive using AH=08h: Read Drive Parameters. (More details here.) That will give you the parameters you need to use [AH=02h: Read Sectors from Drive] to read what you need.
You can also determine the parameters by calling AH=02h with increasing sector, head and cylinder numbers until you get an error, and then checking error code (with AH=01h: Get Status of Last Drive Operation) to confirm it was something indicating a bad parameter for cylinder/track or sector. You may need to do this anyway if AH=08h returned the wrong parameters; IIRC the parameters were set "manually" and not read from the drive.