Path: utzoo!utgpu!water!watmath!clyde!rutgers!gatech!hao!oddjob!gargoyle!ihnp4!ihlpf!nevin1 From: nevin1@ihlpf.ATT.COM (00704a-Liber) Newsgroups: comp.sys.ibm.pc Subject: Booting a hard drive with old ROMs Message-ID: <3578@ihlpf.ATT.COM> Date: 2 Feb 88 00:09:04 GMT Reply-To: nevin1@ihlpf.UUCP (00704a-Ivan Phillips) Followup-To: comp.sys.ibm.pc Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 141 Recently, there was a posting from a person who needed to boot his hard drive but he had old ROMs. I am posting a solution from a friend of mine (w/o network access) because I feel that although the problem is not of general interest, the solution might be. This product is shareware with the asking price of 39 cents (a penny per byte). For those you worried about viruses, where could he hide it? :-) (Besides, he gives the source, not the executables.) Send responses to this directly to him (his name and address are near the end of the article) or email to me (or post it). =============================================================================== HBOOT.COM and INTS.COM ---------------------- (includes listings) The HBOOT.COM program boots the hard disk on IBM-PCs with 1981 IBM BIOS. The INTS.COM program enables the hardware interrupts. HOW IT WORKS (THEORETICALLY) ---------------------------- The original BIOS in the IBM-PC did not acknowledge hard drives in disk calls. Different types of hard drive have their own internal configuration and command scheme, and, therefore, they contain their own ROMs. The ROMs are located at segment C800H or segment D800H. They contain substitute disk interrupt handlers which call BIOS if the disk call is intended for floppy drives. The problem with the old BIOS is that the new interrupt vectors for these hard disk interrupt handlers are not automatically installed. HBOOT.COM calls the hard drive's ROM to install the interrupt vectors, then loads the boot record from the hard disk. In effect, the PC boots twice, once from the floppy to call HBOOT.COM, and once from the hard disk. This means you can have two valid AUTOEXEC.BAT files! There is a side effect. All the hardware interrupts are masked off. Because the floppy disk system uses the timer interrupt to tell it when to turn off the motor, the floppy disk motor continues to run. So I created INTS.COM, a 6 byte program, to re-enable these interrupts. The AUTOEXEC.BAT file on my hard disk calls INTS.COM. BIOS NOTES & MODIFICATIONS -------------------------- BIOS interrupt 13H selects the drive by a number in the DL register. The drives are limited to A=0, B=1, C=2, and D=3. All disk commands act on the floppy disk controller. To access hard disks the drive numbers are HardDisk1=80H, HardDisk2=81H etc. When a single hard disk is fully installed, disk calls are checked for drive number; if the call is for floppies, then the old BIOS is called, otherwise, the hard disk services the call: Before HBOOT INT 13H VECTOR -> BIOS Floppy disk handler. After HBOOT INT 13H VECTOR -> Hard drive ROM -> BIOS Floppy disk handler. If a second hard drive is used, it is usually controlled from the same card (i.e., the same ROM) as the first. HBOOT.COM was written for an IBM-PC with a Seagate 10MB hard disk. Other hard disks possibly use different entry points and ROM segments, e.g., C800:0030 or D800:0023 etc. If HBOOT doesn't work the first time, try changing the ROM segment. If this fails, use DEBUG to examine the ROM. N.B. After the call to the hard drive ROM, the boot sector of the hard disk must be executed. If this is not done, and the program simply returned to DOS, references to the hard disk do not work. I believe this is because the hard disk parameter blocks are not set up. LISTINGS -------- listing of HBOOT.COM: CS:0100 31C0 XOR AX,AX ;BIOS INT 13H function 00H CS:0102 CD13 INT 13 ;Reset disk system CS:0104 9A230000C8 CALL C800:0023 ;Call ROM on Hdisk card CS:0109 B80000 MOV AX,0000 ;Set segment for disk load CS:010C 8EC0 MOV ES,AX CS:010E B80102 MOV AX,0201 ;Disk function READ sector 1 CS:0111 B90100 MOV CX,0001 ;Read single boot sector CS:0114 BA8000 MOV DX,0080 ;Hard disk number 0 (+80H) CS:0117 BB007C MOV BX,7C00 ;Offset for disk load CS:011A CD13 INT 13 ;BIOS disk call CS:011C EA007C0000 JMP 0000:7C00 ;Jump to loaded boot sector listing of INTS.COM: CS:0100 B000 MOV AL,00 ;Clear AL CS:0102 E621 OUT 21,AL ;Send null mask to interrupt ;controller. Enable all hardware ;interrupts CS:0104 CD20 INT 20 ;Terminate program The opcodes or mnemonics in the listings may be entered into a file using DEBUG.COM as follows (further information is available in the DOS user manual) 1) at the DOS prompt type >debug 2) EITHER use the E command to enter the opcodes: -e100 0100 00.31 00.c0 00.cd etc. or use the A command to enter the mnemonics: -a100 0100 xor ax,ax 0102 int 13 3) choose a filename with the N command: -nhboot.com 4) set BX:CX to 20H bytes: -RBX BX=0000: 0000 -RCX CX=0000: 0020 5) save using the W command -w 6) quit -q ----------------------------------------------------------------------------- I would appreciate any replies to this article concerning results other users have achieved, and/or any inaccuracies I may have presented. Ivan Phillips, 2112E St. Johns Ave., Highland Park, IL 60035, USA =============================================================================== -- _ __ NEVIN J. LIBER ..!ihnp4!ihlpf!nevin1 (312) 510-6194 ' ) ) "The secret compartment of my ring I fill / / _ , __o ____ with an Underdog super-energy pill." / (_