source: trunk/TOOLS/DOS/INITHDD/INITHDD.ASM@ 43

Last change on this file since 43 was 37, checked in by Ben Rietbroek, 11 years ago

Reworked Build Environment [2012-02-15]

WARNING!!

All commits upto and including the commit of [2012-05-13] contain
a severe bug!! Building from these sources and then disabling
the 'force LBA' feature while also using the drive-letter feature or
editing the label can DESTROY THE MBR on ALL ATTACHED DISKS!!
DO NOT DISABLE 'FORCE LBA USAGE' WHEN BUILT FROM THE THESE COMMITS!!

Changes

o Reworked build environment
o Start made with coding FIXCODE in C
o Moved MBR protection image
o New overlap macro
o Protect type 0x35 from edit (user popup)
o Protect type 0x35 from adding to menu (user popup)
o More...
! No LVM Label change yet

Note

o Changed license to GPL v3

See file COPYING in trunk.

File size: 7.3 KB
Line 
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;JUMPS
20
21Include ../../../INCLUDE/ASM.INC
22
23 .386p
24 .model large, basic
25
26code_seg segment public use16
27 assume cs:code_seg, ds:nothing, es:nothing, ss:nothing
28 org 100h
29air_boot_setup: jmp INITHDD_Start
30
31Introduction db 'INITHDD - AiR-BOOT Initialize HDD Utility (DOS) - (c) 2004 by M. Kiewitz',13,10
32 db 0
33
34TXT_ERROR_IO db 'Could not access harddrive', 13, 10, 0
35TXT_ERROR_NotNeeded db 'INITHDD: Initialization not needed.', 13, 10, 0
36TXT_Done db 'INITHDD: HDD was successfully initialized.', 13, 10, 0
37TXT_Cleared db 'INITHDD: Reserved Sectors successfully cleared.', 13, 10, 0 ; Rousseau: added
38
39StandardMBR:
40 dw 02BFAh, 08EC0h, 0B8D0h, 07C00h, 0E08Bh, 0FCFBh, 0C02Bh, 0D88Eh, 000BEh
41 dw 0B87Ch, 00060h, 0C08Eh, 0FF2Bh, 000B9h, 0F301h, 0EAA5h, 00024h, 00060h
42 dw 0C88Ch, 0D88Eh, 004B9h, 0BF00h, 001BEh, 0158Bh, 0FA80h, 07480h, 0800Ch
43 dw 000FAh, 05075h, 0C783h, 0E210h, 0CDEFh, 08B18h, 0EBF7h, 0830Dh, 010C7h
44 dw 0058Bh, 0803Ch, 03C74h, 0003Ch, 03875h, 0F1E2h, 005B9h, 0B800h, 00000h
45 dw 0C08Eh, 000BBh, 0B47Ch, 0B002h, 05101h, 04C8Bh, 0CD02h, 05913h, 00B73h
46 dw 000B4h, 013CDh, 0E5E2h, 0C9BEh, 0EB00h, 02616h, 0BF81h, 001FEh, 0AA55h
47 dw 00575h, 000EAh, 0007Ch, 0BE00h, 000B5h, 003EBh, 09DBEh, 0AC00h, 0243Ch
48 dw 0FE74h, 0BB56h, 00007h, 00EB4h, 010CDh, 0EB5Eh, 049F0h, 0766Eh, 06C61h
49 dw 06469h, 07020h, 07261h, 06974h, 06974h, 06E6Fh, 07420h, 06261h, 0656Ch
50 dw 04E24h, 0206Fh, 0706Fh, 07265h, 07461h, 06E69h, 02067h, 07973h, 07473h
51 dw 06D65h, 04F24h, 06570h, 06172h, 06974h, 0676Eh, 07320h, 07379h, 06574h
52 dw 0206Dh, 06F6Ch, 06461h, 06520h, 07272h, 0726Fh, 00024h, 00000h, 00000h
53 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
54 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
55 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
56 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
57 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
58 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
59 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
60 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
61 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
62 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
63 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
64 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
65 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
66 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
67 dw 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h, 00000h
68 dw 00000h, 00000h, 00000h, 0AA55h
69
70; Include ../../../INCLUDE\DOS\CONST.ASM
71
72INITHDD_Start: mov ax, cs
73 mov ds, ax
74 mov es, ax ; DS==ES==CS
75 ; Show Introduction message
76 mov si, offset Introduction
77 call MBR_Teletype
78
79 mov ax, cs
80 mov es, ax
81 mov bx, offset CurMBR
82 mov dx, 0080h ; First harddrive, Sector 1
83 mov cx, 0001h
84 mov ax, 0201h ; Read 1 sector
85 int 13h
86 jnc Clear ; Rousseau: added (only clear)
87 jnc LoadMBR_NoError
88 mov si, offset TXT_ERROR_IO
89 call MBR_Teletype
90 jmp GoByeBye
91 LoadMBR_NoError:
92 ; Check Master-Boot-Record Signature
93 cmp wptr ds:[CurMBR+01FEh], 0AA55h
94 ;;je AlreadyInitialized ; Rousseau: always initialize
95
96 mov ax, cs
97 mov es, ax ; Make sure that ES is right
98 mov bx, offset StandardMBR
99 mov dx, 0080h ; First harddrive, Sector 1...
100 mov cx, 0001h
101 mov ax, 0301h ; Function 03, 1 sector to write
102 int 13h
103 jnc Done
104 mov si, offset TXT_ERROR_IO
105 call MBR_Teletype
106 jmp GoByeBye
107 Done:
108 mov si, offset TXT_Done
109 call MBR_Teletype
110
111 ; Rousseau: added
112 Clear:
113 call MBR_ClearReservedSectors
114 mov si, offset TXT_Cleared
115 call MBR_Teletype
116 ; Rousseau: end added
117
118 jmp GoByeBye
119
120 AlreadyInitialized:
121 mov si, offset TXT_Error_NotNeeded
122 call MBR_Teletype
123
124GoByeBye: mov ax, 4C00h
125 int 21h ; Terminate us...
126 ; End-Of-Code
127
128; In: SI - Pointer to begin of string (EOS is 0)
129; Destroyed: SI
130MBR_Teletype Proc Near Uses ax bx cx
131 mov ah, 0Eh
132 mov bx, 7
133 MBR_Teletype_Loop:
134 lodsb
135 or al, al
136 jz MBR_Teletype_End
137 int 10h
138 jmp MBR_Teletype_Loop
139 MBR_Teletype_End:
140 ret
141MBR_Teletype EndP
142
143
144; Rousseau: added
145MBR_ClearReservedSectors Proc Near
146 mov ax, cs
147 mov es, ax ; Make sure that ES is right
148 mov cx, 2 ; Index of first reserved sector to clear
149 MBR_ClearReservedSectors_loop:
150 push cx ; Put on stack for later use
151 mov bx, offset ZeroSEC ; Block of 0's
152 mov dx, 0080h ; First harddrive, Sector in cx
153 ;mov cx, 0001h
154 mov ax, 0301h ; Function 03, 1 sector to write
155 int 13h
156 pop cx ; Pop sector-index
157 inc cx ; Next sector
158 cmp cx, 62 ; If below 63 (Possible LVM) then...
159 jbe MBR_ClearReservedSectors_loop ; Repeat
160 ret
161MBR_ClearReservedSectors EndP
162
163
164
165CurMBR db 512 dup (?)
166ZeroSEC db 512 dup (0) ; Rousseau: added
167
168code_seg ends
169 end air_boot_setup
Note: See TracBrowser for help on using the repository browser.