gwr@linus.mitre.org (Gordon W. Ross) (09/06/90)
Here is my "msdos-fix" package for using dos on disks with more than 1024 cylinders. The README file below describes this package further. (The README file appears first in the shell archive below.) If you need to split-up this shell archive but don't have a UNIX-compatible shell or unshar program, just use an editor to make a file from each section delimited by: cat << \SHAR_EOF > 'some_file' ... the body of 'some_file' ... SHAR_EOF -- Gordon W. Ross (M/S E095) | internet: gwr@linus.mitre.org The MITRE Corporation | uucp: (backbone-host)!linus!gwr Burlington Road | Day-phone: 617-271-3205 Bedford, MA 01730 (U.S.A.) | #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # README # Instruct.doc # debug_io.cmd # This archive created: Thu Sep 6 12:11:34 1990 # By: Gordon W. Ross (The MITRE Corporation, Bedford, MA.) export PATH; PATH=/bin:$PATH echo shar: extracting "'README'" '(1701 characters)' if test -f 'README' then echo shar: will not over-write existing file "'README'" else cat << \SHAR_EOF > 'README' The "msdos-fix" package contains patches for MSDOS 3.3 to allow it to use the first 1024 cylinders of a hard disk when the disk controller BIOS has installed disk parameters showing more than 1024 cylinders. Note that this patch is designed for use on PC/AT compatible disk controllers that have a BIOS parameter override feature, such as the RLL and ESDI controllers by Adaptec and Western Digital. If the ROM BIOS installs a "disk parameter vector" (addressed by int 0x41) which shows more than 1024 cylinders, then DOS (at least MS DOS 3.3) takes the number of cylinders to be (real_cyls MOD 1024) and, worse yet, gets the number of sectors-per-track wrong as well. Disk controllers by Adaptec and Western Digital may install a disk parameter vector which shows more than 1024 cylinders. In these circumstances, this DOS patch can be used to modify the disk parameter vector such that the number-of-cylinders field is limited to 1024. There is no problem using a disk with more than 1024 cylinders as long as the BIOS installs a disk parameter vector which specifies a number of cylinders not greater than 1024. If the BIOS supports specification of arbitrary disk parameters, one can just lie (if necessary) to make the disk look like it has 1024 cylinders even if it has more, and then the DOS patch is not necessary. The file Instruct.doc contains instructions for applying this patch. The file debug_io.cmd contains debug commands to modify your copy of IO.SYS (as described in the instructions). Gordon W. Ross (M/S E095) | internet: gwr@linus.mitre.org The MITRE Corporation | uucp: (backbone-host)!linus!gwr Burlington Road | Day-phone: 617-271-3205 Bedford, MA 01730 (U.S.A.) | SHAR_EOF if test 1701 -ne "`wc -c < 'README'`" then echo shar: error transmitting "'README'" '(should have been 1701 characters)' fi fi # end of overwriting check echo shar: extracting "'Instruct.doc'" '(7159 characters)' if test -f 'Instruct.doc' then echo shar: will not over-write existing file "'Instruct.doc'" else cat << \SHAR_EOF > 'Instruct.doc' ************************************************************************ Introduction: MS-DOS 3.3 does not work correctly with hard disks having more than 1024 cylinders. The instructions below describe a way to patch MS-DOS so it can use the first 1024 cylinders of these large disks under certain limited conditions. This patch depends on having the disk parameter vectors (pointed at by interrupt vectors 0x41 and 0x46) reside in memory that is writable, as is the case when an auto-configuring disk controller is in use. The RLL and ESDI controllers by Adaptec and Western Digital are known to use writable memory locations for the customized disk parameters installed by the disk controller BIOS at boot-time. The patch works by limiting the "number of cylinders" entry in each disk parameter table to a maximum of 1024. This is done before DOS examines the hard disks, so DOS finds disk parameter vectors indicating at most 1024 cylinders. Note that this patch will not work on most XT disks controllers because these set interrupt vector 0x41 to point at the base of a table of several sets of disk parameters and not at the actual disk parameters as it does on an AT. ************************************************************************ Verifying the version of MS-DOS 3.3: Before making any changes, verify the following features of your copy of the hidden file "IO.SYS" using DEBUG: DEBUG \IO.SYS R CX :577E <- Verify this (size of old_io.sys) <enter> If the file size (value of CX register) was not 577E then you may have a different variant of MS-DOS 3.3 from what I have. If your version is significantly different then these patches may not work. Now (still in debug) dump and verify the area near the end of the file: D 5860 587f XXXX:5860 24 0D 0A 49 6E 76 61 6C-69 64 20 53 54 41 43 4B $..Invalid STACK XXXX:5870 20 70 61 72 61 6D 65 74-65 72 73 0D 0A 24 00 00 parameters..$.. If the dump does not match the above (other than the XXXX segment value) then you probably have a different version of DOS. All bets are off... Now unassemble near the beginning, and check that it looks like: U 100 140 XXXX:0100 FA CLI XXXX:0101 33C0 XOR AX,AX XXXX:0103 8ED0 MOV SS,AX XXXX:0105 BCE27B MOV SP,7BE2 XXXX:0108 BDE27B MOV BP,7BE2 XXXX:010B FB STI XXXX:010C 895E14 MOV [BP+14],BX XXXX:010F 886E1A MOV [BP+1A],CH XXXX:0112 885618 MOV [BP+18],DL XXXX:0115 33C0 XOR AX,AX XXXX:0117 8ED8 MOV DS,AX XXXX:0119 A1187C MOV AX,[7C18] XXXX:011C 894616 MOV [BP+16],AX XXXX:011F A11A7C MOV AX,[7C1A] XXXX:0122 894600 MOV [BP+00],AX XXXX:0125 A1167C MOV AX,[7C16] XXXX:0128 894608 MOV [BP+08],AX XXXX:012B A11C7C MOV AX,[7C1C] XXXX:012E 89460A MOV [BP+0A],AX XXXX:0131 A10E7C MOV AX,[7C0E] XXXX:0134 89460E MOV [BP+0E],AX XXXX:0137 33C0 XOR AX,AX XXXX:0139 8ED8 MOV DS,AX XXXX:013B A10B7C MOV AX,[7C0B] XXXX:013E 33DB XOR BX,BX XXXX:0140 8A1E0D7C MOV BL,[7C0D] Q (Done with debug.) If all of the above matches what you have, then it is safe to proceed. ************************************************************************ Making a patched version of IO.SYS The following procedure will make new copies of the two hidden system files, IO.SYS and MSDOS.SYS and modify the IO.SYS file. First, make copies of the hidden files using the commands: DEBUG \IO.SYS N NEW_IO.SYS W Q DEBUG \MSDOS.SYS N NEW_DOS.SYS W Q Then patch the new file NEW_IO.SYS using debug with input redirection. The commands for debug should be put into a file such as DEBUG_IO.CMD and then used as input with the DOS command: DEBUG NEW_IO.SYS <DEBUG_IO.CMD You should see output from DEBUG saying: "Writing 5880 bytes" The file DEBUG_IO.CMD should have just a 'Q' on the last line. ************************************************************************ Verifying correctness of the patches: If you wish to verify that the patches were applied correctly, you could verify the changes by running debug again and verifying the output of the commands shown below: (commands are indented) DEBUG NEW_IO.SYS U 131 140 XXXX:0131 A10E7C MOV AX,[7C0E] XXXX:0134 89460E MOV [BP+0E],AX XXXX:0137 E84657 CALL 5880 XXXX:013A 90 NOP XXXX:013B A10B7C MOV AX,[7C0B] XXXX:013E 33DB XOR BX,BX 1280:0140 8A1E0D7C MOV BL,[7C0D] D 5860 XXXX:5860 24 0D 0A 49 6E 76 61 6C-69 64 20 53 54 41 43 4B $..Invalid STACK XXXX:5870 20 70 61 72 61 6D 65 74-65 72 73 0D 0A 24 00 00 parameters..$.. XXXX:5880 BB 04 01 E8 07 00 BB 18-01 E8 01 00 C3 1E C5 37 ...............7 XXXX:5890 8B 04 BB 00 04 39 D8 76-02 89 1C 90 0E 1F 76 14 .....9.v......v. XXXX:58A0 BE B8 57 FC AC 3C 00 74-0B 56 BB 07 00 B4 0E CD ..W..<.t.V...... XXXX:58B0 10 5E EB F0 1F C3 90 90-44 69 73 6B 20 73 69 7A .^......Disk siz XXXX:58C0 65 20 66 69 78 65 64 2E-0D 0A 00 00 00 00 00 00 e fixed......... XXXX:58D0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ If the above outputs match then the file NEW_IO.SYS should be fine. ************************************************************************ Making a new system disk: Now that the file "NEW_IO.SYS" is ready, the tricky task remaining is to copy the two system files onto a floppy in the CORRECT place. This can be done using the COPY command, but only if the destination disk contains absolutely no files and no volume label. The two system files must appear in the first two root directory entries, and must be contiguously allocated immediately following the file allocation table. The procedure for creating such a diskette is as follows: (1) Format a diskette without the /s or /v options. (Don't make it a system disk, and don't add a volume label.) Also, be sure that format reports no bad sectors. (2) Copy the first system file onto the diskette, i.e.: COPY NEW_IO.SYS A:IO.SYS (3) Copy the second system file onto the diskette, i.e.: COPY NEW_DOS.SYS A:MSDOS.SYS At this point the diskette is almost as if SYS had just transfered a system onto it. You can now copy other files onto it and add a volume label if you like. Be sure to copy COMMAND.COM onto the new diskette. Try booting the new diskette. If all goes well, you will see a message: "Disk size fixed." followed by the normal MS-DOS boot sequence. If you have no disks larger than 1024 cylinders, then the "Disk size fixed." message will not appear. If you have two large disks then the message will appear twice. ************************************************************************ Installing the patched files on a hard disk: The safest way to transfer the new files onto a hard disk is to boot the machine from the new diskette conatining the patched system files, and then use the SYS command to transfer these to the hard disk. Good luck! Gordon W. Ross (M/S E095) | internet: gwr@linus.mitre.org The MITRE Corporation | uucp: (backbone-host)!linus!gwr Burlington Road | Day-phone: 617-271-3205 Bedford, MA 01730 (U.S.A.) | SHAR_EOF if test 7159 -ne "`wc -c < 'Instruct.doc'`" then echo shar: error transmitting "'Instruct.doc'" '(should have been 7159 characters)' fi fi # end of overwriting check echo shar: extracting "'debug_io.cmd'" '(360 characters)' if test -f 'debug_io.cmd' then echo shar: will not over-write existing file "'debug_io.cmd'" else cat << \SHAR_EOF > 'debug_io.cmd' R CX 5800 F 587E 58FF 0 A 137 CALL 5880 NOP A 5880 MOV BX,0104 CALL 588D MOV BX,0118 CALL 588D RET PUSH DS LDS SI,[BX] MOV AX,[SI] MOV BX,0400 CMP AX,BX JBE 589B MOV [SI],BX NOP PUSH CS POP DS JBE 58B4 MOV SI,57B8 CLD LODSB CMP AL,00 JZ 58B4 PUSH SI MOV BX,0007 MOV AH,0E INT 10 POP SI JMP 58A4 POP DS RET NOP NOP DB "Disk size fixed.",0D,0A,00 W Q SHAR_EOF if test 360 -ne "`wc -c < 'debug_io.cmd'`" then echo shar: error transmitting "'debug_io.cmd'" '(should have been 360 characters)' fi fi # end of overwriting check # End of shell archive exit 0 -- Gordon W. Ross (M/S E095) | internet: gwr@linus.mitre.org The MITRE Corporation | uucp: (backbone-host)!linus!gwr Burlington Road | Day-phone: 617-271-3205 Bedford, MA 01730 (U.S.A.) |