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 | ;---------------------------------------------------------------------------
|
---|
20 | ; AiR-BOOT / MAIN-CODE
|
---|
21 | ;---------------------------------------------------------------------------
|
---|
22 | ;
|
---|
23 |
|
---|
24 | ; If ReleaseCode is not defined, it will produce debug-able code...
|
---|
25 | ReleaseCode equ -1
|
---|
26 |
|
---|
27 | JUMPS
|
---|
28 |
|
---|
29 | ; All Special Equs for this project
|
---|
30 |
|
---|
31 | IFDEF ReleaseCode
|
---|
32 | StartBaseSeg equ 00000h
|
---|
33 | StartBasePtr equ 07C00h ; BIOS starts our MBR at 0:7C00
|
---|
34 | ELSE
|
---|
35 | StartBaseSeg equ 03A98h ; Adjust to DOS segment
|
---|
36 | StartBasePtr equ 00100h
|
---|
37 | ENDIF
|
---|
38 | BootBaseSeg equ 8000h
|
---|
39 | BootBasePtr equ 0h ; We put our MBR to this location
|
---|
40 | BootBaseExec equ BootBasePtr+offset MBR_RealStart
|
---|
41 | StackSeg equ 7000h
|
---|
42 |
|
---|
43 | VideoIO_Page0 equ 0B800h
|
---|
44 | VideoIO_Page1 equ 0B900h
|
---|
45 | VideoIO_Page2 equ 0BA00h
|
---|
46 | VideoIO_Page4 equ 0BC00h
|
---|
47 | VideoIO_FXSegment equ 0A000h
|
---|
48 |
|
---|
49 | Include ..\INCLUDE\asm.inc
|
---|
50 | ;Include ..\INCLUDE\DOS\airboot.inc
|
---|
51 |
|
---|
52 | TextChar_WinLineRight equ 0C4h ; 'Ä'
|
---|
53 | TextChar_WinLineDown equ 0B3h ; '³'
|
---|
54 | TextChar_WinRep1 equ 0D1h ; 'Ñ'
|
---|
55 | TextChar_WinRep2 equ 0C5h ; 'Å'
|
---|
56 | TextChar_WinRep3 equ 0CFh ; 'Ï'
|
---|
57 | TextChar_WinRep4 equ 0B5h ; 'µ'
|
---|
58 | TextChar_WinRep5 equ 0C6h ; 'Æ'
|
---|
59 | TextChar_WinRep6 equ 0D8h ; 'Ø'
|
---|
60 |
|
---|
61 | ; Offsets for Partition-Entries in MBR/EPRs
|
---|
62 | LocBRPT_LenOfEntry equ 16
|
---|
63 | LocBRPT_Flags equ 0
|
---|
64 | LocBRPT_BeginCHS equ 1
|
---|
65 | LocBRPT_BeginHead equ 1
|
---|
66 | LocBRPT_BeginSector equ 2
|
---|
67 | LocBRPT_BeginCylinder equ 3
|
---|
68 | LocBRPT_SystemID equ 4
|
---|
69 | LocBRPT_EndCHS equ 5
|
---|
70 | LocBRPT_EndHead equ 5
|
---|
71 | LocBRPT_EndSector equ 6
|
---|
72 | LocBRPT_EndCylinder equ 7
|
---|
73 | LocBRPT_RelativeBegin equ 8
|
---|
74 | LocBRPT_AbsoluteLength equ 12
|
---|
75 |
|
---|
76 | LocBR_Magic equ 510
|
---|
77 |
|
---|
78 | ; Offsets for LVM Information Sector
|
---|
79 | LocLVM_SignatureStart equ 0
|
---|
80 | LocLVM_SignatureByte0 equ 2
|
---|
81 | LocLVM_CRC equ 8 ; CRC is a DWORD
|
---|
82 | LocLVM_MaxEntries equ 4
|
---|
83 | LocLVM_StartOfEntries equ 60 ; (contains maximum of 4 entries)
|
---|
84 | LocLVM_LenOfEntry equ 60
|
---|
85 | LocLVM_VolumeID equ 0 ; is DWORD
|
---|
86 | LocLVM_PartitionID equ 4 ; is DWORD
|
---|
87 | LocLVM_PartitionSize equ 8 ; is DWORD
|
---|
88 | LocLVM_PartitionStart equ 12 ; is DWORD
|
---|
89 | LocLVM_VolumeLetter equ 18 ; is BYTE (Letter C-Z or 0)
|
---|
90 | LocLVM_VolumeName equ 20 ; 20 bytes
|
---|
91 | LocLVM_PartitionName equ 40 ; 20 bytes
|
---|
92 |
|
---|
93 | ; Offsets for IPT (Internal Partition Table)
|
---|
94 | LocIPT_MaxPartitions equ 30 ; Maximum LocIPT_MaxPartitions
|
---|
95 | LocIPT_LenOfSizeElement equ 6 ; Size of one Size-Element
|
---|
96 | LocIPT_LenOfIPT equ 34
|
---|
97 | LocIPT_Serial equ 0
|
---|
98 | LocIPT_Name equ 4
|
---|
99 | LocIPT_Drive equ 15 ; Drive-ID
|
---|
100 | LocIPT_SystemID equ 16 ; Partition-Type
|
---|
101 | LocIPT_Flags equ 17 ; AiR-BOOT Flags for partition
|
---|
102 | LocIPT_BootRecordCRC equ 18 ; CRC of Boot-Record
|
---|
103 | LocIPT_LocationBegin equ 20 ; Begin of Partition
|
---|
104 | LocIPT_LocationPartTable equ 23 ; PartitionTable of Partition
|
---|
105 | LocIPT_AbsoluteBegin equ 26 ; Absolute Sector of Begin
|
---|
106 | LocIPT_AbsolutePartTable equ 30 ; Absolute Sector of PartTable
|
---|
107 |
|
---|
108 | LocIPT_DefaultFlags equ 00000011b ; Don't know if boot-able :)
|
---|
109 | LocIPT_DefaultNonBootFlags equ 00000010b ; ...VIBR Detection is always on
|
---|
110 |
|
---|
111 | Flags_BootAble equ 00000001b
|
---|
112 | Flags_VIBR_Detection equ 00000010b
|
---|
113 | Flags_HideFeature equ 00000100b
|
---|
114 | Flags_DriveLetter equ 00001000b ; OS/2 FAT16/HPFS only
|
---|
115 | Flags_ExtPartMShack equ 00010000b ; Extended Partition M$-Hack req ?
|
---|
116 | Flags_NoPartName equ 01000000b
|
---|
117 | Flags_NowFound equ 10000000b ; temp only in OldPartTable
|
---|
118 | Flags_SpecialMarker equ 10000000b ; temp only for HiddenSetup
|
---|
119 |
|
---|
120 | FileSysFlags_BootAble equ 00000001b ; Is this Partition boot-able ?
|
---|
121 | FileSysFlags_FAT32 equ 00010000b ; FAT 32 specific name getting
|
---|
122 | FileSysFlags_NoName equ 00100000b ; No Name - use PartitionName
|
---|
123 | FileSysFlags_DriveLetter equ 01000000b ; DriveLetter Feature possible
|
---|
124 |
|
---|
125 | Keys_Up equ 48h
|
---|
126 | Keys_Down equ 50h
|
---|
127 | Keys_Left equ 4Bh
|
---|
128 | Keys_Right equ 4Dh
|
---|
129 | Keys_PageUp equ 49h
|
---|
130 | Keys_PageDown equ 51h
|
---|
131 | Keys_GrayPlus equ 4Eh
|
---|
132 | Keys_GrayMinus equ 4Ah
|
---|
133 | Keys_Plus equ 1Bh
|
---|
134 | Keys_Minus equ 35h
|
---|
135 | Keys_Enter equ 1Ch
|
---|
136 | Keys_ESC equ 1h
|
---|
137 | Keys_F1 equ 3Bh
|
---|
138 | Keys_F10 equ 44h
|
---|
139 | Keys_C equ 2Eh ; Add. Check auf Ctrl!
|
---|
140 | Keys_Y equ 2Ch
|
---|
141 | Keys_Z equ 15h
|
---|
142 | Keys_N equ 31h
|
---|
143 | Keys_TAB equ 0Fh
|
---|
144 | Keys_Delete equ 53h
|
---|
145 | Keys_Backspace equ 0Eh
|
---|
146 | Keys_Space equ 20h
|
---|
147 |
|
---|
148 | Keys_Flags_EnterSetup equ 1100b ; Strg+Alt (AL)
|
---|
149 |
|
---|
150 | .386p
|
---|
151 | model large, basic
|
---|
152 |
|
---|
153 | code_seg segment public use16
|
---|
154 | assume cs:code_seg, ds:code_seg, es:nothing, ss:nothing
|
---|
155 |
|
---|
156 | org 00000h ; Sector 1
|
---|
157 | ;---------------------------------------------------------------------------
|
---|
158 | AiR_BOOT: cli ; Some M$ operating systems need a CLI
|
---|
159 | ; here otherwise they will go beserk
|
---|
160 | ; and will do funny things during
|
---|
161 | ; boot phase, it's laughable!
|
---|
162 | db 0EBh ; JMP-Short -> MBR_Start
|
---|
163 | db 'AiRBOOT', 13h, 03h, 20h, 06h, 01h, 06h, TXT_LanguageID
|
---|
164 | ; ID String, Date and Version Number, U for US version
|
---|
165 | db 1 ; Total Sectors Count,
|
---|
166 | ; Will get overwritten by FIXBSET.exe
|
---|
167 | MBR_CheckCode dw 0 ; Check-Sum for Code
|
---|
168 |
|
---|
169 | MBR_Start: sti ; This opcode is dedicated to:
|
---|
170 | cld ; =MICROSOFT JUMP DEPARTMENT=
|
---|
171 | mov ax, StartBaseSeg
|
---|
172 | mov ds, ax
|
---|
173 | mov si, StartBasePtr
|
---|
174 | mov ax, BootBaseSeg
|
---|
175 | mov es, ax
|
---|
176 | mov di, BootBasePtr
|
---|
177 | IFDEF ReleaseCode
|
---|
178 | mov cx, 256
|
---|
179 | ELSE
|
---|
180 | mov cx, 32700
|
---|
181 | ENDIF
|
---|
182 | rep movsw
|
---|
183 | db 0EAh
|
---|
184 | dw BootBaseExec
|
---|
185 | dw BootBaseSeg
|
---|
186 | ; jmp far ptr BootBaseSeg:BootBaseExec
|
---|
187 |
|
---|
188 | MBR_HaltSystem:
|
---|
189 | mov ax, 8600h
|
---|
190 | xor cx, cx
|
---|
191 | mov dx, 500
|
---|
192 | int 15h ; Wait to display the whole screen :]
|
---|
193 | MBR_HaltSys: cli
|
---|
194 | jmp MBR_HaltSys
|
---|
195 |
|
---|
196 | db 'FUCKMS:>'
|
---|
197 | jmp MBR_Start ; We jump here, because I needed to
|
---|
198 | ; insert a CLI on start and did not
|
---|
199 | ; want to change AiR-BOOT detection
|
---|
200 | ; because of Microsoft inventions...
|
---|
201 |
|
---|
202 | db 'LOAD ERROR!', 0
|
---|
203 | MBR_LoadError Proc Near Uses
|
---|
204 | mov si, offset $-12
|
---|
205 | push cs
|
---|
206 | pop ds
|
---|
207 | call MBR_Teletype
|
---|
208 | MBRLE_Halt:
|
---|
209 | jmp MBRLE_Halt
|
---|
210 | MBR_LoadError EndP
|
---|
211 |
|
---|
212 | db 'SAVE ERROR!', 0
|
---|
213 | MBR_SaveError Proc Near Uses
|
---|
214 | mov si, offset $-12
|
---|
215 | push cs
|
---|
216 | pop ds
|
---|
217 | call MBR_Teletype
|
---|
218 | MBRSE_Halt:
|
---|
219 | jmp MBRSE_Halt
|
---|
220 | MBR_SaveError EndP
|
---|
221 |
|
---|
222 | ; In: SI - Pointer to begin of string (EOS is 0)
|
---|
223 | ; Destroyed: SI
|
---|
224 | MBR_Teletype Proc Near Uses ax bx cx
|
---|
225 | mov ah, 0Eh
|
---|
226 | mov bx, 7
|
---|
227 | MBRT_Loop:
|
---|
228 | lodsb
|
---|
229 | or al, al
|
---|
230 | jz MBRT_End
|
---|
231 | int 10h
|
---|
232 | jmp MBRT_Loop
|
---|
233 | MBRT_End:
|
---|
234 | ret
|
---|
235 | MBR_Teletype EndP
|
---|
236 |
|
---|
237 | ; In: BX - Base Check, DS:SI - Pointer to 512-byte-area to be included
|
---|
238 | ; Out: BX - Base Check Result
|
---|
239 | ; Destroyed: SI will get updated (+512)
|
---|
240 | MBR_GetCheckOfSector Proc Near Uses ax cx
|
---|
241 | mov cx, 256
|
---|
242 | MBRGCOS_Loop:
|
---|
243 | lodsw
|
---|
244 | xor ax, 0BABEh
|
---|
245 | xor bx, ax
|
---|
246 | loop MBRGCOS_Loop
|
---|
247 | or bx, bx
|
---|
248 | jnz MBRGCOS_NoFixUp
|
---|
249 | mov bx, 1 ; dont allow 0, cause 0 == empty
|
---|
250 | MBRGCOS_NoFixUp:
|
---|
251 | ret
|
---|
252 | MBR_GetCheckOfSector EndP
|
---|
253 |
|
---|
254 | ;---------------------------------------------------------------------------
|
---|
255 | MBR_RealStart:
|
---|
256 | mov ax, StackSeg
|
---|
257 | mov ss, ax
|
---|
258 | mov sp, 7FFFh
|
---|
259 | mov ax, es
|
---|
260 | mov ds, ax ; Set DS==ES to Code Segment
|
---|
261 | IFNDEF ReleaseCode
|
---|
262 | jmp AiR_BOOT_Start
|
---|
263 | ENDIF
|
---|
264 | ; Load missing parts from harddrive...
|
---|
265 | mov ax, cs
|
---|
266 | mov es, ax
|
---|
267 | mov bx, offset Configuration
|
---|
268 | mov dx, 0080h ; First harddrive, Sector 55
|
---|
269 | mov cx, 0037h
|
---|
270 | mov ax, 0205h ; Read 5 sectors
|
---|
271 | int 13h
|
---|
272 | jnc MBR_ConfigCopy_NoError
|
---|
273 | MBR_ConfigCopy_LoadError:
|
---|
274 | call MBR_LoadError ; Will Abort BootUp
|
---|
275 | MBR_ConfigCopy_NoError:
|
---|
276 | mov bx, offset FurtherMoreLoad
|
---|
277 | mov dx, 0080h ; First harddrive, Sector 2
|
---|
278 | mov cx, 0002h
|
---|
279 | mov ah, 02h
|
---|
280 | mov al, ds:[10h]
|
---|
281 | int 13h
|
---|
282 | jnc MBR_RealStart_NoError
|
---|
283 | jmp MBR_ConfigCopy_LoadError
|
---|
284 | ; [v1.05+]
|
---|
285 | ; Signature for IBM's LVM to detect our "powerful" features ;)
|
---|
286 | db 'I13X'
|
---|
287 | MBR_RealStart_NoError:
|
---|
288 | ; Now Check Code with CheckSum
|
---|
289 | mov si, offset FurtherMoreLoad
|
---|
290 | movzx cx, bptr ds:[10h]
|
---|
291 | xor bx, bx
|
---|
292 | MBR_RealStart_CheckCodeLoop:
|
---|
293 | call MBR_GetCheckOfSector
|
---|
294 | loop MBR_RealStart_CheckCodeLoop
|
---|
295 | cmp MBR_CheckCode, bx
|
---|
296 | je MBR_RealStart_CheckSuccess
|
---|
297 | mov si, offset TXT_ERROR_Attention
|
---|
298 | call MBR_Teletype
|
---|
299 | mov si, offset TXT_ERROR_CheckCode
|
---|
300 | call MBR_Teletype
|
---|
301 | mov si, offset TXT_ERROR_CheckFailed
|
---|
302 | call MBR_Teletype
|
---|
303 | jmp MBR_HaltSystem
|
---|
304 | MBR_RealStart_CheckSuccess:
|
---|
305 | jmp AiR_BOOT_Start
|
---|
306 |
|
---|
307 | ;---------------------------------------------------------------------------
|
---|
308 | Include TEXT\TXTMBR.asm ; All translateable Text in MBR
|
---|
309 | ;---------------------------------------------------------------------------
|
---|
310 | org 00200h ; Sector 2
|
---|
311 | ; Everything beyond this point is loaded on startup and is NOT existant at first
|
---|
312 | FurtherMoreLoad:
|
---|
313 | ; first Normal-Partition-ID, Hidden-Partition-ID
|
---|
314 | ; and Default-Partition-Flags.
|
---|
315 | ; 01h -> Boot-Able
|
---|
316 | ; 10h -> FAT32 - Name Getting Scheme
|
---|
317 | ; 20h -> No Name To Get (use Partition Name)
|
---|
318 | ; 40h -> 'L' flag possible
|
---|
319 | db 'AiRSYS-TABLE'
|
---|
320 | FileSysIDs: db 01h, 11h,01h, 04h,014h,01h, 06h,016h,41h, 0Eh,00Eh,01h
|
---|
321 | db 07h, 17h,41h, 08h,017h,21h, 35h,035h,20h,0FCh,017h,41h
|
---|
322 | db 09h, 19h,11h, 0Bh,01Bh,11h, 0Ch,01Ch,11h,0EBh,0EBh,01h
|
---|
323 | db 63h, 63h,21h, 81h,081h,21h, 83h,083h,21h, 40h,040h,21h
|
---|
324 | db 0A5h,0A5h,21h,0A6h,0A6h,21h, 82h,082h,20h,0A7h,0A7h,21h
|
---|
325 | db 63h, 63h,21h, 4Dh,04Dh,21h, 4Eh,04Eh,21h, 4Fh,04Fh,21h
|
---|
326 | db 01h, 01h,01h, 01h,001h,01h, 01h,001h,01h, 01h,001h,01h
|
---|
327 | db 01h, 01h,01h, 01h,001h,01h, 01h,001h,01h, 01h,001h,01h
|
---|
328 | db 01h, 01h,01h, 01h,001h,01h, 01h,001h,01h, 01h,001h,01h
|
---|
329 | db 01h, 01h,01h,0FDh,0FDh,20h, 84h,084h,20h,0A0h,0A0h,20h
|
---|
330 | db 0Ah, 0Ah,20h,0FEh,0FEh,21h,0FFh,0FFh,21h, 00h,000h,21h
|
---|
331 | db 16 dup (0)
|
---|
332 |
|
---|
333 | FileSysNames: db 'FAT12 ', 'FAT16 ', 'FAT16Big', 'FAT16Big'
|
---|
334 | db 'HPFS ', 'NTFS ', 'LVM-Data', 'JFS '
|
---|
335 | db 'FAT32 ', 'FAT32 ', 'FAT32 ', 'BeOS '
|
---|
336 | db 'Unix ', 'Minix ', 'Linux ', 'Venix ' ; x row ;)
|
---|
337 | db 'BSD/386 ', 'OpenBSD ', 'LinuxSwp', 'NeXTSTEP'
|
---|
338 | db 'GNU HURD', 'QNX ', 'QNX ', 'QNX '
|
---|
339 | db ' ', ' ', ' ', ' '
|
---|
340 | db ' ', ' ', ' ', ' '
|
---|
341 | db ' ', ' ', ' ', ' '
|
---|
342 | db ' ', 'Kernel ', ' ', '0V-Award'
|
---|
343 | db 'OS/2 Man', 'via BIOS', 'Floppy ', 'Unknown '
|
---|
344 | ; -> 44 Partition-Types
|
---|
345 |
|
---|
346 | ;---------------------------------------------------------------------------
|
---|
347 | org 00400h ; Sector 3
|
---|
348 | AiR_BOOT_Start: mov ax, VideoIO_Page1
|
---|
349 | call VideoIO_BackUpTo ; Copy BIOS POST to Second Page
|
---|
350 | mov si, offset Copyright
|
---|
351 | call MBR_Teletype
|
---|
352 | ; Initialize Variable-Tables, Detections, etc.
|
---|
353 | call PRECRAP_Main
|
---|
354 | call PARTSCAN_ScanForPartitions
|
---|
355 | MBR_Main_ReEnterSetup:
|
---|
356 | call SETUP_CheckEnterSETUP
|
---|
357 | call AFTERCRAP_Main
|
---|
358 |
|
---|
359 | ; [Linux support removed since v1.02]
|
---|
360 | ; ; Now get FAT16-Linux Kernel Partition, If requested
|
---|
361 | ; cmp [CFG_LinuxKrnlPartition], 0FFh
|
---|
362 | ; je MBR_Main_NoLinuxKrnlPartition
|
---|
363 | ; call LINUX_InitFAT16access
|
---|
364 | ; MBR_Main_NoLinuxKrnlPartition:
|
---|
365 |
|
---|
366 | ; SetUp PartitionPointers for BootMenu (filter non-bootable)
|
---|
367 | call PART_CalculateMenuPartPointers
|
---|
368 |
|
---|
369 | ; ...and count that one...
|
---|
370 | cmp PartitionPointerCount, 0
|
---|
371 | jne MBR_Main_SomethingBootAble
|
---|
372 | mov si, offset TXT_NoBootAble
|
---|
373 | call MBR_Teletype
|
---|
374 | jmp MBR_HaltSystem
|
---|
375 |
|
---|
376 | MBR_Main_SomethingBootAble:
|
---|
377 | ; FixUp Values, define Timed Setup booting, etc.
|
---|
378 | call PART_FixUpDefaultPartitionValues
|
---|
379 |
|
---|
380 | ; -------------------------------------------------- BOOT-MENU
|
---|
381 | MBR_Main_ReEnterBootMenu:
|
---|
382 | call BOOTMENU_ResetMenuVars ; reset has to be done
|
---|
383 | test CFG_AutomaticBoot, 1
|
---|
384 | jz MBR_Main_NoAutomaticBooting
|
---|
385 | ; ------------------------------------------ AUTOMATIC BOOTING
|
---|
386 | ; Select automatic partition, disable automatic booting for
|
---|
387 | ; next time and boot system...
|
---|
388 | mov CFG_AutomaticBoot, 0
|
---|
389 | call PASSWORD_AskSystemPwd
|
---|
390 | mov al, Menu_EntryAutomatic
|
---|
391 | mov Menu_EntrySelected, al
|
---|
392 | jmp MBR_Main_NoBootMenu
|
---|
393 |
|
---|
394 | MBR_Main_NoAutomaticBooting:
|
---|
395 | test CFG_BootMenuActive, 0FFh
|
---|
396 | jnz MBR_Main_GotBootMenu
|
---|
397 | ; ----------------------------------------------- NO BOOT-MENU
|
---|
398 | ; Select default partition and boot system...
|
---|
399 | call PASSWORD_AskSystemPwd
|
---|
400 | mov al, Menu_EntryDefault
|
---|
401 | mov Menu_EntrySelected, al
|
---|
402 | jmp MBR_Main_NoBootMenu
|
---|
403 |
|
---|
404 | MBR_Main_GotBootMenu:
|
---|
405 | ; ------------------------------------------ BOOT-MENU VISUALS
|
---|
406 | call FX_StartScreen
|
---|
407 | call BOOTMENU_BuildBackground
|
---|
408 | call BOOTMENU_BuildMain
|
---|
409 | call FX_EndScreenRight
|
---|
410 | call PASSWORD_AskSystemPwd
|
---|
411 | call BOOTMENU_ResetTimedBoot
|
---|
412 | call BOOTMENU_Execute
|
---|
413 | jc MBR_Main_ReEnterSetup
|
---|
414 | call BOOTMENU_SetVarsAfterMenu
|
---|
415 | ; ------------------------------------------------- BOOTING...
|
---|
416 | MBR_Main_NoBootMenu:
|
---|
417 | call FX_StartScreen
|
---|
418 | call BOOTMENU_BuildGoodBye
|
---|
419 | call FX_EndScreenRight
|
---|
420 | call PASSWORD_AskChangeBootPwd
|
---|
421 |
|
---|
422 | IFNDEF ReleaseCode
|
---|
423 | ; Debug Code to terminate DOS .COM program - used for
|
---|
424 | ; testing AiR-BOOT
|
---|
425 | int 3
|
---|
426 | mov ax, 6200h
|
---|
427 | int 21h
|
---|
428 | mov es, bx
|
---|
429 | mov ax, 4C00h ; Quit program
|
---|
430 | int 21h
|
---|
431 | ENDIF
|
---|
432 | call ANTIVIR_SaveBackUpMBR
|
---|
433 | mov dl, Menu_EntrySelected
|
---|
434 | call PART_StartPartition
|
---|
435 |
|
---|
436 | Include REGULAR\STD_TEXT.asm ; Standard (non-translateable text)
|
---|
437 | Include REGULAR\DRIVEIO.asm ; Drive I/O, Config Load/Save
|
---|
438 | Include REGULAR\ViDEOIO.asm ; Video I/O
|
---|
439 | Include REGULAR\TIMER.asm ; Timer
|
---|
440 | Include REGULAR\PARTMAIN.asm ; Regular Partition Routines
|
---|
441 | Include REGULAR\PARTSCAN.asm ; Partition Scanning
|
---|
442 | Include REGULAR\BOOTMENU.asm ; Boot-Menu
|
---|
443 | Include REGULAR\PASSWORD.asm ; Password related
|
---|
444 | Include REGULAR\OTHER.asm ; Other Routines
|
---|
445 |
|
---|
446 | Include SETUP\MAiN.ASM ; The whole AiR-BOOT SETUP
|
---|
447 | Include SPECiAL\ViRUS.asm ; Virus Detection / Anti-Virus
|
---|
448 | ; [Linux support removed since v1.02]
|
---|
449 | ;Include SPECiAL\FAT16.asm ; FAT-16 Support
|
---|
450 | ;Include SPECiAL\LINUX.asm ; Linux Kernel Support
|
---|
451 | Include SPECiAL\F00K\BILLSUXX.asm ; Extended Partition - Microsoft-Hack
|
---|
452 | Include SPECiAL\SOUND.asm ; Sound
|
---|
453 | Include SPECiAL\APM.asm ; Power Managment Support
|
---|
454 | Include SPECiAL\FX.asm ; l33t Cooper-Bars/Scrolling <bg>
|
---|
455 | Include SPECiAL\LVM.asm ; LVM-specific code
|
---|
456 | IFDEF TXT_IncludeCyrillic
|
---|
457 | Include SPECiAL\CHARSET.asm ; Charset Support (e.g. Cyrillic)
|
---|
458 | ENDIF
|
---|
459 |
|
---|
460 | ;---------------------------------------------------------------------------
|
---|
461 | org 04600h ; Sector 36-37
|
---|
462 | MBR_Protection: db 'AiR-BOOT MBR-Protection Image'
|
---|
463 | ; Hardcoded to 1k (1024 bytes)
|
---|
464 |
|
---|
465 | ;---------------------------------------------------------------------------
|
---|
466 | org 04A00h ; Sector 38-x
|
---|
467 | Include TEXT\TXTOTHER.asm ; All translateable Text-Strings
|
---|
468 | Include TEXT\TXTMENUS.asm ; All translateable Menu-text
|
---|
469 | Include TEXT\CHARSET.asm ; Special Video Charsets (if needed)
|
---|
470 |
|
---|
471 | ;---------------------------------------------------------------------------
|
---|
472 | org 06C00h ; Sector 55
|
---|
473 | Configuration:
|
---|
474 | db 'AiRCFG-TABLE'
|
---|
475 | db 01h, 02h, 'U' ; "Compressed" ID String
|
---|
476 | ; This is still version 1.02, because nothing got
|
---|
477 | ; changed...
|
---|
478 |
|
---|
479 | CFG_LastTimeEditLow dw 0 ; Last Time Edited Stamp (will incr every setup)
|
---|
480 | CFG_LastTimeEditHi dw 0 ; second 16 bit part...
|
---|
481 |
|
---|
482 | CFG_CheckConfig dw 0 ; Check-Sum for Configuration
|
---|
483 |
|
---|
484 | CFG_Partitions db 0 ; Count of partitions in IPT
|
---|
485 | db 0 ; Was BootParts - Removed since v0.28b
|
---|
486 | CFG_PartDefault db 0 ; Default-Partition (Base=0)
|
---|
487 |
|
---|
488 | CFG_PartLast db 0 ; Which Partition was booted last time ? (Base=0)
|
---|
489 | CFG_TimedBoot db 1 ; Timed Boot Enable (for REAL Enable look TimedBootEnable)
|
---|
490 | CFG_TimedSecs db 15 ; Timed Boot - How Many Seconds Till Boot
|
---|
491 | CFG_TimedDelay dw 123 ; Timed Boot - Delay
|
---|
492 | CFG_TimedBootLast db 0 ; Timed Boot - Boot From Last Drive Booted From
|
---|
493 | CFG_RememberBoot db 1 ; Remember Manual Boot Choice
|
---|
494 | CFG_RememberTimed db 0 ; Remember if Timed Boot (if both disabled: Boot Default)
|
---|
495 | CFG_IncludeFloppy db 1 ; Include Floppy Drives in Boot-Menu
|
---|
496 | CFG_BootMenuActive db 1 ; Display Boot-Menu (if Disabled: Boot Default)
|
---|
497 | ; v0.29+ -> 2 - Detailed Bootmenu
|
---|
498 | CFG_PartitionsDetect db 1 ; Autodetect New Partitions (Auto-Add!)
|
---|
499 | CFG_PasswordSetup db 0 ; Ask Password when entering Setup
|
---|
500 | CFG_PasswordSystem db 0 ; Ask Password when booting System
|
---|
501 | CFG_PasswordChangeBoot db 0 ; Ask Password when changing boot partition
|
---|
502 | CFG_ProtectMBR db 0 ; Protect MBR via TSR ?
|
---|
503 | CFG_IgnoreWriteToMBR db 0 ; Just ignore writes to MBR, otherwise crash
|
---|
504 | CFG_FloppyBootGetName db 0 ; Gets floppy name for display purposes
|
---|
505 | CFG_DetectVirus db 1 ; Detect Virus ?
|
---|
506 | CFG_DetectStealth db 1 ; Detect Stealth-Virus ?
|
---|
507 | CFG_DetectVIBR db 1 ; Detect BootRecord-Virus ?
|
---|
508 | CFG_AutoEnterSetup db 1 ; Automatic Enter Setup (first install!)
|
---|
509 | CFG_MasterPassword dw 0101Fh ; Encoded Password (this is just CR)
|
---|
510 | dw 07A53h
|
---|
511 | dw 0E797h
|
---|
512 | dw 0A896h
|
---|
513 | CFG_BootPassword dw 0101Fh ; Another CR... ;-)
|
---|
514 | dw 07A53h
|
---|
515 | dw 0E797h
|
---|
516 | dw 0A896h
|
---|
517 | db 0 ; Rude-Protection - Removed since v0.28b
|
---|
518 | CFG_LinuxRootPartition db 0 ; Linux Root Partition (Base=0)
|
---|
519 | CFG_TimedKeyHandling db 0 ; Timed Key Handling (for Timed Boot)
|
---|
520 | ; 0 - Do Nothing
|
---|
521 | ; 1 - Reset Time
|
---|
522 | ; 2 - Stop Time
|
---|
523 | CFG_MakeSound db 0 ; Should be clear ;)
|
---|
524 | CFG_FloppyBootGetTimer db 0 ; Floppy Name will get updated every 2 secs
|
---|
525 | CFG_ResumeBIOSbootSeq db 0 ; If BIOS Boot Sequence should be resumed
|
---|
526 | ; 0 - Disabled
|
---|
527 | ; 1 - CD-ROM
|
---|
528 | ; 2 - Network
|
---|
529 | ; 3 - ZIP/LS120
|
---|
530 | CFG_CooperBars db 0 ; If Cooper Bars should be shown
|
---|
531 | CFG_LinuxCommandLine db 75 dup (0) ; Linux Command Line
|
---|
532 | CFG_LinuxKrnlPartition db 0FFh ; FAT-16 Linux Kernel Partition (Base=0)
|
---|
533 | ; FFh -> Disabled
|
---|
534 | CFG_LinuxDefaultKernel db 'DEFAULT', 4 dup (32), 0 ; Default Kernel Name
|
---|
535 | CFG_LinuxLastKernel db 11 dup (32), 0 ; Last-Booted Kernel Name
|
---|
536 | CFG_ExtPartitionMShack db 0 ; Extended Partition M$-Hack Global Enable
|
---|
537 | CFG_AutomaticBoot db 0 ; Automatic Booting (only one bootup)
|
---|
538 | CFG_PartAutomatic db 0 ; Partition-No for automatic booting
|
---|
539 | CFG_ForceLBAUsage db 0 ; LBA-BIOS-API forced on any HDD I/O
|
---|
540 | CFG_IgnoreLVM db 0 ; Ignores any LVM-Information
|
---|
541 |
|
---|
542 | ; VIR variables are for the AiR-BOOT Anti Virus Code
|
---|
543 | ; Most of them are backups of Interrupt Points, so we can check, if a
|
---|
544 | ; stealth virus is on-line, we can intercept its call.
|
---|
545 | ; Normal (non stealth) virus are trapped simply by rereading the MBR sector.
|
---|
546 | ; If a virus is found, we will restore MBR from Sektor 60 and stop the system
|
---|
547 | ; from working, so the user has to press reset. That's saver than a Reboot.
|
---|
548 | ;
|
---|
549 | ; If a virus is found on the partition to boot, the system will ONLY halt,
|
---|
550 | ; nothing more, because we can not remove it. The user shall do it :)
|
---|
551 | ; Those viruses are detected via a real nasty method...Checksum-Checking of the
|
---|
552 | ; boot-record, which is to be executed. If it does not match the one in our
|
---|
553 | ; internal partition table, we will stop. You may however switch this detection
|
---|
554 | ; off or just reset it by switching 'VIBR Detection'.
|
---|
555 |
|
---|
556 | org 06DABh ; 427 Boundry
|
---|
557 | AutoDrvLetter db 0
|
---|
558 | AutoDrvLetterSerial dd 0
|
---|
559 |
|
---|
560 | BIOScontIPTentry:
|
---|
561 | db 0, 0, 0, 0, ' '
|
---|
562 | db 0, 0FEh, Flags_BootAble
|
---|
563 | dw 0 ; No Checksum :)
|
---|
564 | db 0, 1, 0
|
---|
565 | db 0, 1, 0 ; Location of Partition/Boot Record
|
---|
566 | dd 0, 0
|
---|
567 |
|
---|
568 | ; 466 Sub-Part
|
---|
569 | CFG_VIR_INT08 dd 0 ; pointer to saved 08h entry point
|
---|
570 | CFG_VIR_INT13 dd 0 ; pointer to saved 13h entry point
|
---|
571 | CFG_VIR_INT1C dd 0 ; pointer to saved 1Ch entry point
|
---|
572 |
|
---|
573 | ; 478 Boundry
|
---|
574 | FloppyIPTentry: db 0, 0, 0, 0, 'FloppyDrive'
|
---|
575 | db 0, 0FFh, Flags_BootAble
|
---|
576 | dw 0 ; No Checksum :)
|
---|
577 | db 0, 1, 0
|
---|
578 | db 0, 1, 0 ; Location of Partition/Boot Record
|
---|
579 | dd 0, 0
|
---|
580 | ;---------------------------------------------------------------------------
|
---|
581 | org 06E00h ; Sector 56-57
|
---|
582 | PartitionTable: ; no-partitions detected... :]
|
---|
583 | ; db 1, 0, 0, 0, 'Harddisc 1'
|
---|
584 | ; db 0, 0FFh, Flags_BootAble
|
---|
585 | ; dw 0 ; No Checksum :)
|
---|
586 | ; db 0, 0, 1
|
---|
587 | ; db 0, 0, 1 ; Location of Partition/Boot Record
|
---|
588 | ; dd 0, 0
|
---|
589 |
|
---|
590 | ; Format is:
|
---|
591 | ;============
|
---|
592 | ; SerialNumber * 4
|
---|
593 | ; PartitionName * 11
|
---|
594 | ; Drive * 1
|
---|
595 | ; SystemID * 1 (means the partition type)
|
---|
596 | ; Flags * 1
|
---|
597 | ; Checksum * 2 (for virus checking)
|
---|
598 | ; LocationBegin * 3 (where the partition begins)
|
---|
599 | ; LocationPartTab * 3 (where the partition table is)
|
---|
600 | ; AbsoluteBegin * 4 (where the partition begins, in absolute sectors)
|
---|
601 | ; AbsolutePartTab * 4 (where the partition table is, in absolute sectors)
|
---|
602 | ; --------------------> 34 Bytes (total maximum = 30)
|
---|
603 |
|
---|
604 | org 071F6h
|
---|
605 | db 'AiRBOOTPAR' ; 1K internal partition table
|
---|
606 | ;---------------------------------------------------------------------------
|
---|
607 | org 07200h ; Sector 58
|
---|
608 | HidePartitionTable: db 900 dup (0FFh)
|
---|
609 | ; Format is:
|
---|
610 | ;============
|
---|
611 | ; PartitionPtr : BYTE * 30
|
---|
612 | ; --------------------> 30 Bytes * 30
|
---|
613 |
|
---|
614 | DriveLetters: db 30 dup (0)
|
---|
615 | ; Format is:
|
---|
616 | ;============
|
---|
617 | ; Drive-Letter : BYTE (80h-C:, 81h-D:)
|
---|
618 | ; --------------------> 1 Byte * 30
|
---|
619 |
|
---|
620 | org 075F6h
|
---|
621 | db 'AiRBOOTHID' ; 1K internal Hide-partition table
|
---|
622 | ;---------------------------------------------------------------------------
|
---|
623 | org 07600h ; Sector 60
|
---|
624 | MBR_BackUpMBR db 'AiR-BOOT MBR-BackUp - Just to fill this sector with something'
|
---|
625 |
|
---|
626 | org 077FFh
|
---|
627 | db 0
|
---|
628 | ;---------------------------------------------------------------------------
|
---|
629 | org 0A000h ; Uninitialized
|
---|
630 | ; This space actually gets initialized in PreCrap to NUL (till EndOfVariables)
|
---|
631 | BeginOfVariables:
|
---|
632 | PartitionSector db 512 dup (?) ; Temporary Sector for Partition
|
---|
633 | LVMSector: db 512 dup (?) ; Temporary Sector for LVM
|
---|
634 | TmpSector: db 512 dup (?) ; Temporary Sector
|
---|
635 | TmpSector2:
|
---|
636 | ; Everything used to build a new IPT and reference it to the old one
|
---|
637 | NewPartTable: db 1024 dup (?) ; New Partition Table
|
---|
638 | NewHidePartTable: db 900 dup (?) ; New Hide-Partition Table
|
---|
639 | NewDriveLetters: db 30 dup (?) ; Logical Drive-Letters
|
---|
640 |
|
---|
641 | PartitionSizeTable: db 180 dup (?) ; Size-Table (6 bytes per partition)
|
---|
642 | PartitionPointers dw 52 dup (?) ; Maximum is 52 entries till now
|
---|
643 | PartitionPointerCount db ? ; Count of total Partition Pointers
|
---|
644 | PartitionXref db 30 dup (?) ; X-Reference Table
|
---|
645 | PartitionVolumeLetters db 30 dup (?) ; Volume-Letters
|
---|
646 | ; 0 - no LVM support
|
---|
647 | ; 1 - LVM support, but no letter
|
---|
648 | ; 'C'-'Z' - assigned drive letter
|
---|
649 |
|
---|
650 | TotalHarddiscs db ? ; Total harddrives (by POST)
|
---|
651 | LBASwitchTable db 128 dup (?) ; Bit 25-18 for CHS/LBA Switching
|
---|
652 | NewPartitions db ? ; Freshly found partitions
|
---|
653 |
|
---|
654 | VideoIO_Segment dw ? ; Segment for Video I/O
|
---|
655 |
|
---|
656 | ExtendedAbsPos dd ? ; Extended Partition Absolute Position
|
---|
657 | ExtendedAbsPosSet db ? ; If Absolute Position set
|
---|
658 |
|
---|
659 | CurPartition_Location dw 4 dup (?) ; Where did current partition came from?
|
---|
660 | CurIO_UseExtension db ? ; 1-Use INT 13h EXTENSIONS
|
---|
661 | ; (filled out by PreCrap)
|
---|
662 | CurIO_Scanning db ? ; 1-AiR-BOOT is scanning partitions
|
---|
663 | ; (for detailed error message)
|
---|
664 |
|
---|
665 | ; [Linux support removed since v1.02]
|
---|
666 | ;GotLinux db ? ; 1-Linux found
|
---|
667 |
|
---|
668 | Menu_EntrySelected db ? ; Which partition we boot this time...
|
---|
669 | Menu_UpperPart db ? ; Which number (Base=0) is the partition upper pos
|
---|
670 | Menu_AbsoluteX db ? ; Pos where Menu stuff starts
|
---|
671 | Menu_TotalParts db ? ; Copy of CFG_BootParts
|
---|
672 | Menu_TotalLines db ? ; Total Lines on Screen used for BootMenu
|
---|
673 | Menu_EntryDefault db ? ; Default Entry in filtered View
|
---|
674 | Menu_EntryLast db ? ; LastBooted Entry in filtered View
|
---|
675 | Menu_EntryAutomatic db ? ; Automatic Entry in filtered View
|
---|
676 | ; - All adjusted to menu locations
|
---|
677 |
|
---|
678 | PartSetup_UpperPart db ? ; Partition-Setup (like Menu_UpperPart)
|
---|
679 | PartSetup_ActivePart db ? ; Active Partition
|
---|
680 | PartSetup_HiddenUpper db ? ; (like Menu_UpperPart)
|
---|
681 | PartSetup_HiddenX db ? ; Pos for Hidden-Setup
|
---|
682 | PartSetup_HiddenAdd db ? ; Adjust for Hidden-Setup
|
---|
683 |
|
---|
684 | TimedBootEnable db ? ; Local Enable/Disable for timed boot
|
---|
685 | TimedTimeOut dd ? ; TimeOut Timer for TimedBoot (too much time here ;)
|
---|
686 | TimedSecondLeft db ? ; How many seconds are left till boom ?
|
---|
687 | TimedSecondBack db ? ; To get a modification noticed
|
---|
688 | TimedBootUsed db ? ; Timed Boot used for bootup ?
|
---|
689 | FloppyGetNameTimer dd ? ; Timer for Floppy-Get-Name
|
---|
690 | SETUP_KeysOnEntry db ? ; which Shift Status was there, when booting ?
|
---|
691 | SETUP_ExitEvent db ? ; Exit Event to end SETUP
|
---|
692 | TempPasswordEntry db 17 dup (?)
|
---|
693 | SETUP_OldPwd db 17 dup (?)
|
---|
694 | SETUP_NewPwd db 17 dup (?)
|
---|
695 | SETUP_VerifyPwd db 17 dup (?)
|
---|
696 | StartSoundPlayed db ?
|
---|
697 | ChangePartNameSave db ?
|
---|
698 |
|
---|
699 | FX_UseCount dw ?
|
---|
700 | FX_OverallTimer dw ?
|
---|
701 | FX_WideScrollerTimer dw ?
|
---|
702 | FX_WideScrollerCurPos dw ?
|
---|
703 | FX_WideScrollerSpeed db ?
|
---|
704 | FX_WideScrollerSpeedState db ?
|
---|
705 | FX_WideScrollerDirection db ?
|
---|
706 | FX_WideScrollerAbsDirection db ?
|
---|
707 | FX_WideScrollerBounceSpeed db ?
|
---|
708 | FX_CooperBarsTimer dw ?
|
---|
709 |
|
---|
710 | ; [Linux support removed since v1.02]
|
---|
711 | ;FAT16_Drive db ? ; FAT-16: Drive of FAT16-partition
|
---|
712 | ;FAT16_AbsPartitionBegin dd ? ; FAT-16: LBA Begin of Partition
|
---|
713 | ;FAT16_SecsPerCluster db ? ; FAT-16: Sectors Per Cluster
|
---|
714 | ;FAT16_NumOfRootEntries dw ? ; FAT-16: Number of Root Entries
|
---|
715 | ;FAT16_SecsPerFAT dw ? ; FAT-16: Sectors Per FAT
|
---|
716 | ;FAT16_AbsFATBegin dd ? ; FAT-16: LBA Begin of FAT
|
---|
717 | ;FAT16_AbsRootBegin dd ? ; FAT-16: LBA Begin of Root
|
---|
718 | ;FAT16_AbsClusterBegin dd ? ; FAT-16: LBA Begin of Clusters
|
---|
719 | ;FAT16_FATCacheSector db ? ; FAT-16: FAT-Sector No in Cache
|
---|
720 | ;FAT16_FATCache db 512 dup (?) ; FAT-16: FAT-Area Cache
|
---|
721 | ;
|
---|
722 | ;LINUX_KernelEntries db 680 dup (?) ; 34*20 -> Space for Kernel-Entries
|
---|
723 | ;LINUX_KernelNo db ? ; Total of Kernels in KernelEntries
|
---|
724 | ;LINUX_KernelSizeTable db 120 dup (?) ; Size-Table (6 bytes per kernel)
|
---|
725 | EndOfVariables:
|
---|
726 |
|
---|
727 | ; Dynamically Generated Tables - do not need to get initialized with NUL
|
---|
728 | FX_CooperColors db 672 dup (?) ; 7 cooper bars*96 - runtime calculated
|
---|
729 | FX_CooperState: db 7 dup (?)
|
---|
730 | FX_SinusPos: db 7 dup (?)
|
---|
731 | FX_CooperPos: dw 7 dup (?)
|
---|
732 | CharsetTempBuffer db 4096 dup (?) ; Uninitialized Charset buffer
|
---|
733 | LVM_CRCTable: dd 256 dup (?) ; LVM-CRC (->SPECiAL\LVM.asm)
|
---|
734 |
|
---|
735 | code_seg ends
|
---|
736 | end air_boot
|
---|