| 1 | ; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
|
|---|
| 2 | ;
|
|---|
| 3 | ; This file is part of AiR-BOOT
|
|---|
| 4 | ;
|
|---|
| 5 | ; AiR-BOOT is free software: you can redistribute it and/or modify it under
|
|---|
| 6 | ; the terms of the GNU General Public License as published by the Free
|
|---|
| 7 | ; Software Foundation, either version 3 of the License, or (at your option)
|
|---|
| 8 | ; any later version.
|
|---|
| 9 | ;
|
|---|
| 10 | ; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
|
|---|
| 11 | ; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
|
|---|
| 12 | ; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|---|
| 13 | ; details.
|
|---|
| 14 | ;
|
|---|
| 15 | ; You should have received a copy of the GNU General Public License along with
|
|---|
| 16 | ; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
|
|---|
| 17 | ;
|
|---|
| 18 | ;---------------------------------------------------------------------------
|
|---|
| 19 | ; AiR-BOOT / EXTENDED PARTITION - M$ HACK-IN
|
|---|
| 20 | ;---------------------------------------------------------------------------
|
|---|
| 21 |
|
|---|
| 22 | ; AiR-BOOT is compatible to the pseudo standard that's is used by an OS on a
|
|---|
| 23 | ; 32-bit processor, being actually a 16-bit extension that is outperformed
|
|---|
| 24 | ; by any 8-bit software running on a 4-bit microprocessor, written by a 2-bit
|
|---|
| 25 | ; company that can't stand 1-bit of competition.
|
|---|
| 26 |
|
|---|
| 27 | ; Here is code to change Extended Partition to Type 05h or 0Fh depending
|
|---|
| 28 | ; on the partition's P-flag including the overall M$hack-Enable Flag.
|
|---|
| 29 |
|
|---|
| 30 | IFDEF MODULE_NAMES
|
|---|
| 31 | DB 'BILLSUXX',0
|
|---|
| 32 | ENDIF
|
|---|
| 33 |
|
|---|
| 34 | MSHACK_ProcessPartTables Proc Near Uses ax dx di
|
|---|
| 35 | ; Check Overall M$-Hack Enable
|
|---|
| 36 | test byte ptr [CFG_ExtPartitionMShack], 1
|
|---|
| 37 | jz MSHPPT_NoMShack
|
|---|
| 38 |
|
|---|
| 39 | ; Now check Boot-Entry's flags...
|
|---|
| 40 | mov ax, 050Fh
|
|---|
| 41 | test bptr [si+LocIPT_Flags], Flags_ExtPartMShack
|
|---|
| 42 | jz MSHPPT_ChangeToStandard
|
|---|
| 43 | mov ax, 0F05h
|
|---|
| 44 | MSHPPT_ChangeToStandard:
|
|---|
| 45 |
|
|---|
| 46 | ; Now process every Primary Partition Table (PPT) for Extended Partition
|
|---|
| 47 | ; Search for ID *AL* and replace with ID *AH*
|
|---|
| 48 | mov dl, 80h
|
|---|
| 49 | mov dh, [TotalHarddiscs]
|
|---|
| 50 | or dh, dh
|
|---|
| 51 | jz MSHPPT_NoMShack
|
|---|
| 52 | MSHPPT_HarddriveLoop:
|
|---|
| 53 | push ax
|
|---|
| 54 | push bx
|
|---|
| 55 | push cx
|
|---|
| 56 | push dx
|
|---|
| 57 | xor ax, ax
|
|---|
| 58 | xor bx, bx ; Location Absolute Sector 0
|
|---|
| 59 | mov cx, 0001h
|
|---|
| 60 | xor dh, dh ; Location Cylinder 0, Head 0, Sector 1 MBR/PPT
|
|---|
| 61 | call DriveIO_LoadPartition
|
|---|
| 62 | pop dx
|
|---|
| 63 | pop cx
|
|---|
| 64 | pop bx
|
|---|
| 65 | pop ax
|
|---|
| 66 | jc MSHPPT_Failure
|
|---|
| 67 |
|
|---|
| 68 | ; Search for ID in AL and exchange with ID in AH
|
|---|
| 69 | mov di, offset PartitionSector+446 ; ES:DI - 1st partition entry
|
|---|
| 70 | MSHPPT_ScanLoop:
|
|---|
| 71 | cmp al, bptr es:[di+4]
|
|---|
| 72 | je MSHPPT_GotHit
|
|---|
| 73 | add di, LocBRPT_LenOfEntry ; 16 Bytes per Partition-Entry
|
|---|
| 74 | cmp di, 500+offset PartitionSector
|
|---|
| 75 | jb MSHPPT_ScanLoop
|
|---|
| 76 | jmp MSHPPT_Failure
|
|---|
| 77 |
|
|---|
| 78 | MSHPPT_GotHit:
|
|---|
| 79 | mov bptr es:[di+4], ah
|
|---|
| 80 | IFDEF ReleaseCode
|
|---|
| 81 | call DriveIO_SavePartition
|
|---|
| 82 | ENDIF
|
|---|
| 83 | MSHPPT_Failure:
|
|---|
| 84 | inc dl
|
|---|
| 85 | dec dh
|
|---|
| 86 | jnz MSHPPT_HarddriveLoop
|
|---|
| 87 |
|
|---|
| 88 | MSHPPT_NoMShack:
|
|---|
| 89 | ret
|
|---|
| 90 | MSHACK_ProcessPartTables EndP
|
|---|