> Does anyone know an algorithum, or just have some ideas, on how to write
> and Enchanced IDE interface for a hard drive to access beyond the DOS
> limit?
This is from Opher Szichman and is in regards to his not having
a type #47 (custom) drive definition and I've often wondered if
it could be used for large drives. I don't use it, but the docs
for my drive manager imply that a custom MBR will be written. The
following shows how to customize your own MBR.
-+---- Quoting -------
-
First, I assume you have an AT class computer (equipped with a CMOS) &
running a DOS Version 4.0+ & that your problematic drive has an IDE
interface.
Now, there are three steps to do this:
1. Select a drive type (in CMOS) closest to your drive's
parameters, noting the number of sectors per cylinder
(usually 17). Then run FDISK and allocate all/some of the
HD space to a DOS Primary Partition so that a MBR is placed
on the HD. Your computer reboots.
2. Use DOS's FORMAT on the drive. Then, Patch the MBR code
& Partition Table to reflect your drive parameters
(explained later). Copy the Boot-Record located
at Sectors_Per_Cylinder + 1 or 1/1/0 (S/H/C, usually sector
18) to absolute sector 2 (the one following the MBR).
Reboot from your HD (remove your DOS diskette in drive A)...
3. You get the 'Non system disk...' message. Place a DOS diskette in
drive A and strike any key. Run DOS's FORMAT on your HD again (format
c:/s - make system disk). If you did everything correctly Format
should show the correct capacity ('Formatting 204 MB...').
Patching the MBR: The following is a portion of my MBR...
-----------------
cs:7C00 FA cli ; The bootstrap loader loads
cs:7C01 33C0 xor ax,ax ; the MBR at 0:7c00
cs:7C03 8ED0 mov ss,ax
cs:7C05 BC007C mov sp,7C00
cs:7C08 8BF4 mov si,sp ; si = 7c00, save a byte
cs:7C0A 50 push ax
cs:7C0B 07 pop es ; es = 0
cs:7C0C 50 push ax
cs:7C0D 1F pop ds ; ds = 0
cs:7C0E FB sti
cs:7C0F FC cld
cs:7C10 BF0006 mov di,0600 ; Setup si, es, ds, di
cs:7C13 B90001 mov cx,0100 ; & cx to...
cs:7C16 F2A5 repnz movsw ; move the MBR to 0:0600.
cs:7C18 EAF0060000 jmp 0000:06F0 <- My modification.
riginally
. jmp 0000:061D.
. (next instruction)
.
. ----Code to change disk
aram.
cs:7CF0 BF0003 mov di,0300
cs:7CF3 BE0401 mov si,0104 ; Have INT 41h (HD Param.
cs:7CF6 893C mov [si],di ; Table) point to new param.
cs:7CF8 894402 mov [si+02],ax ; table.
cs:7CFB BEE006 mov si,06E0
cs:7CFE B90800 mov cx,0008
cs:7D01 FC cld
cs:7D02 F3A5 rep movsw ; Copy HDPT to 0:0300
; (safe location)
cs:7D04 B409 mov ah,09
cs:7D06 B280 mov dl,80
cs:7D08 CD13 int 13 ; Inform BIOS of new HDPT.
cs:7D0A E910FF jmp 7C1D <- Continue with original
code.
To make the patching easy you need a disk-editor (Norton Utilities,
PCTOOLS etc.) Use the DE (disk-editor) to view the MBR in hex mode.
If you used DOS 5.0 you should read:
00000000: FA 33 C0 8E D0 BC 00 7C 8B F4 50 07 50 1F FB FC
00000010: BF 00 06 B9 00 01 F2 A5 EA 1D 06 00 00 BE BE 07
^^
Change the pointed byte (1D) to F0. Then change the following:
000000F0: BF 00 03 BE 04 01 89 3C 89 44 02 BE E0 06 B9 08
00000100: 00 FC F3 A5 B4 09 B2 80 CD 13 E9 10 FF
Next at 000000E0 enter 16 bytes where...
000000E0: 00 04 0C 00 00 FF FF 00 08 00 00 00 01 04 22 00
\ / | \ / | \ / |
A B C D E F
A. Number of cylinders (0400h = 1024)
B. Number of heads (0Ch = 12)
C. Starting write precompensation cylinder - If not known use FFFF
D. Control byte - Bit 3 = 1 if more than eight heads
E. Landing zone - If not known use Number_of_cylinders + 1
F. Number of sectors (22h = 34)
Having done that the only thing left to do is patch the Partition Table:
Enter the partition editor and update the following:
A. System = BIGDOS (06h)
B. Starting Head = 0
Starting Cylinder = 0
Starting Sector = 2
C. Relative Sectors = 1
D. Number of Sectors = The number of sectors allocated to that partition - If
it's all of the HD space then that's:
Sectors_per_cylinder * Heads * Cylinders - 1.
All Done!
If you haven't got a disk editor, the following instructions
are for DEBUG/SYMDEB:
Enter the debugger & assemble the following instructions at CS:0100:
** all numbers are hex.
mov bx,200 ; ES:BX->Location of buffer to place read sectors
mov dx,80 ; Phisical HD number
mov cx,1 ; Starting sector number, S/H/C = 1/0/0
mov ax,201 ; AH=Read sectors, AL=Num. of sectors to read
int 13
int 1 ; Debugger regains control!
mov bx,400 ; ES:BX->Following MBR
mov dh,1 ; S/H/C = 1/1/0
mov ax,201
int 13 ; Read Boot-Record
xor dh,dh ; DH=0, S/H/C = 1/0/0
mov ax,302 ; Write 2 sectors: MBR then Boot-Record
int 13
int 1
Press `r` (=the enter key) and make sure the
instruction listed is `mov bx,200`. Press `g`...
Patch the MBR as I explained, noting:
1. Offset of MBR start is DS:0200 (not 00000000).
2. You change a byte's content by typing `e ...`.
3. The partition table is at DS:03BE.
Again press `r` & make sure the insruction listed is `mov bx,400`.
Press `g`... You're done.
Exit the debugger.
--- ifmail-tx (i386 Linux)
---------------
* Origin: 300 miles East of Seattle, WA (1:346/15.1)
|