Notes RDMS23 - a program to read MS-DOS disks under CP/M. John Hastwell-Batten SYSOP Tesseract RCPM+ P.O. Box 242 Dural, NSW 2158 AUSTRALIA RDMS23 is a program which uses the CP/M BIOS to read files from MS-DOS diskettes and the CP/M BDOS to write the files to a CP/M disk. RDMS23 is derived from RDMSDOS.C which was written by Bob Alverson. The version released into the public domain was 1.1 written for compilation with small-C and for operation under CP/M 2.2. Since then I have done a lot of work on this program. Apart from fixing a few significant bugs, the major changes have been to make it run under CP/M version 3.1 which is the operating system that I now use. I also added a stack of comments including some notes on implementation. Hopefully, the latest revision can also run under CP/M 2.2. RDMS23 is written in Hi-Tech C but just about any "K&R" C compiler can be used providing it supports the malloc() function or equivalent. Even that is no real obstacle; you could make the dynamically allocated memory static instead at the cost of increased program size. (The program was originally written that way.) The operation of the program is somewhat dependent on the way that the BIOS of the host CP/M system handles double- sided diskettes. Although I have tried to cater for some of the more commonly used methods you may have to modify the program. In some cases you may have to modify your BIOS if you really want to use this program. Some notes on adapting the program appear later in this documentation. Pre-requisites: --------------- There are some absolute requirements which must be met before you can use this program: 1. Your system must have a 40-track 5.25" disk drive which can read double-sided, double-density diskettes. 2. The BIOS must be capable of reading at least nine 512- byte sectors from each track. Future development: ------------------- v2.x Preserve CRC integrity (maybe). v3.x Allow writing to MS-DOS disks. ============================================================ How to use RDMS23 ================= Activating the program ---------------------- Park RDMS23.COM on any convenient disk. On my system I put it on drive A: in user area 0 and made it a system file so that I can run it from any disk & user area. ZCPR users will be able to do the same trick. It is probably worthwhile renaming the program to something like RDMS.COM to save unnecesary typing. These notes assume that name from now on. Now log into the disk/user where you want to put the files which you are going to copy from the MS-DOS disk. Activate the program by typing its name. RDMS needs to be told the disk drive where the MS-DOS diskette is loaded. You can include the drive letter on the command line if you wish, otherwise RDMS will prompt for it. The command-line forms are: rdms -or- rdms d where 'd' is the MS-DOS drive letter. [Other command-line options are discussed later.] RDMS will read the File Allocation Table and the root directory from the MS-DOS disk and will display the root directory. You are then in a position to copy files from the MS-DOS diskette to a CP/M disk. Copying files ------------- All that is required to copy a file from the MS-DOS diskette to the logged-in CP/M disk/user is to type the name of one of the files displayed from the MS-DOS directory. Multiple files can be copied by using the usual "wildcard" naming conventions. At any time you may get a new directory display by supplying no file name at all, i.e. by just pressing the key. Subdirectories -------------- In the directory listing, subdirectory files are identified with a "type" of ".dir". If you type the name of a subdirectory (without the ".dir") then instead of copying the file, RDMS switches to that subdirectory and displays its contents. You can then continue copying files, but be a little bit careful because there might be two different files on the MS-DOS diskette with the same name in different directories. If you copy a second file it will overwrite the first. In any subdirectory the first two entries will themselves be directories. One will be identified with a single dot, another with two dots. The double-dot entry is the only interesting one. If you enter ".." as a file name then RDMS will switch back to the previous MS-DOS directory level. This gives you the ability to traverse the entire MS-DOS directory heirarchy. Ending the program ------------------ By far the cleanest way to end the program is to respond to an "Enter filename: " prompt with ^Z (i.e. control-Z and carriage return). If you do that then the program will properly re-log the CP/M disk. On some systems it MAY be OK to terminate the program with control-C but don't complain to me if you have to cold-boot your computer after doing that. ============================================================ Technical notes =============== MS-DOS disks come in four flavours; single- and double-sided disks with either eight or nine sectors of 512 bytes each per track. Double-sided MS-DOS disks are recorded in "cylinder" mode. Sectors 1 to 8/9 are written on side 0, then sectors 1 to 8/9 are written on side 1 before stepping to the next track. There is no standard way to tell a CP/M BIOS which side of the disk should be accessed. All you can do is to set the track and sector numbers before doing a disk I/O operation. You have to make the program calculate the track and sector such that your BIOS will access the right part of the disk. You may even have to modify your BIOS! In the simplest case, your BIOS may also assume/use "cylinder" mode recording and decode the side number from the low-order bit of the track number. BIOS TRACK CYLINDER SIDE 0 0 0 1 0 1 2 1 0 3 1 1 4 2 0 . . . 77 38 1 78 39 0 79 39 1 Another common method of telling the BIOS which side of the disk to access is that of setting the high-order bit of the sector number so that requesting a sector in the range 1 to 8/9 accesses side 0, requesting a sector in the range 129 to 136/137 accesses side 1. The program is currently set up to use this method. Some BIOS's assume that all tracks below the number of cylinders on the disk are on side 0, all higher-numbered tracks are on side 1. None of the above presents any real problem. If your BIOS uses any of those methods then you can modify the program to cope. You will be in real trouble if your BIOS uses the "long track" method of handling double sideded setors where 1- 8/9 are, as usual, on side 0 but where the sectors on side 1 are assumed to be physically recorded with different numbers from the corresponding sectors on side 0. There is NO WAY OUT except to change your BIOS! Likewise your BIOS must either expect the sector id bytes on side 1 to actually have side 1 encoded, or NOT action a side-select verify when seeking to a sector on side 1. I hope all that makes sense. There are some command-line options which actually tell RDMS23 which method to use on two-sided diskettes. You might like to try these before attempting to recompile the program. -h (for "high bit) tells RDMS23 that your BIOS uses the high-order bit of the sector number to signal a read from side 1. -c (for "cylinder mode") tells RDMS23 that your BIOS regards all even-numbered tracks of a double-sided diskette as being on side 0 and all odd-numbered tracks as being on side 1. -x (for "extended surface") tells RDMS23 that your BIOS regards tracks 0-39 as being on side 0 and tracks 40-79 as being on side 1. Just include the appropriate option somewhere on the command line if your BIOS uses one of the above methods, e.g. rdms23 d -x -or- rdms23 -x d Remember, if you don't tell RDMS which method to use, it assumes "-c". You may wish to change that assumption once you know which method is used by your own BIOS so that you don't have to keep telling RDMS the same thing every time you run it. You can recompile the program if you have an appropriate C compiler but you can also patch RDMS.COM with DDT, ZSID or whatever. To do that, load RDMS.COM under ZSID and use the ASCII/HEX "dump" command to scan through the program. Look for the string of characters "Method=H", change the "H" to "C" or "X" and save the modified program. The string will be a fair way into the program and to save time I suggest you start looking at around 3000h. ============================================================ Known bugs ---------- A CRC calculated under MS-DOS will not be the same as the CRC calculated for the file once it has been copied to CP/M. The file itself is OK and I think the difference arises from the mechanisms for detecting end-of-file under the two operating systems. Under CP/M+ and CCP/M there is a mechanism for saving the exact file length so this problem may yet be solved. ============================================================= Copyright --------- (C)1984 Bob Alverson (C)1985 John Hastwell-Batten This is a PUBLIC DOMAIN program. You are free to distribute, copy and use this program for non-commercial purposes. We didn't charge you anything for it. It is not fair for you to make money or to steal the credit for our efforts. If you fix any bugs or make any enhancements please re-submit the modified SOURCE code to the public domain.