source: trunk/BOOTCODE/AIR-BOOT.ASM@ 46

Last change on this file since 46 was 46, checked in by Ben Rietbroek, 12 years ago

Various Changes [2012-04-14]

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 Added BLDLEVEL support
o Enhanced Master Make
o Sanitized sources
o Support for Wasm and Masm6 (experimental)
o Renamed MBR_PROT.ASM to MBR-PROT.ASM
o Merged bitfield code Into Installer
o First steps for cross platform Installer
o More...

File size: 69.2 KB
Line 
1;
2; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
3;
4; This file is part of AiR-BOOT
5;
6; AiR-BOOT is free software: you can redistribute it and/or modify it under
7; the terms of the GNU General Public License as published by the Free
8; Software Foundation, either version 3 of the License, or (at your option)
9; any later version.
10;
11; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
12; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
13; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14; details.
15;
16; You should have received a copy of the GNU General Public License along with
17; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
18;
19
20
21;------------------------------------------------------------------------------
22; AiR-BOOT / DEFINITIONS
23;------------------------------------------------------------------------------
24;
25
26;
27; Include AiR-BOOT Version Information.
28;
29Include VERSION.INC
30
31;
32; Include OS/2 BLDLEVEL Information.
33;
34Include BLDLEVEL.INC
35
36
37; -------------------------
38; Rousseau: JUMPS disabled
39; -------------------------
40; We actually don't want to use this directive because it generates extra
41; NOP instructions that we can do without.
42; Relative conditional jumps that are out-of-range are manually reworked by
43; skipping an unconditional jump to the target on base of complementary
44; condition logic and temporary labels.
45; TASM also has a bug in that when the .ERR2 directive is used when
46; the .386 directive is in effect, the JUMPS directive is also active
47; and cannot be turned off.
48; NOJUMPS seems to have no effect in this situation.
49; In this case 4 NOP instructions are generated after forward referencing jump
50; instructions, to allow for automatic recoding by TASM.
51; This seems to be a TASM bug. (v2,v3,v4, dunno v5)
52IFDEF TASM
53 ;~ JUMPS
54ENDIF
55
56;
57; If defined then each module is prefixed with it's name.
58; This is used for debugging purposes.
59; It should be off in release code.
60;
61;ModuleNames equ 1
62
63
64;
65; The first harddisk is BIOS coded 80h.
66; This makes a total of 128 disk could be supported using this coding.
67; This value is used to store disk-information and this info is allocated
68; in the BSS.
69;
70MaxDisks equ 64
71
72
73
74
75;
76; Include Debug Modules and enable COM-port debugging.
77;
78;~ AUX_DEBUG EQU
79
80
81
82
83
84;
85; bits 7-5 = datarate
86; (000=110,001=150,010=300,011=600,100=1200,101=2400,110=4800,111=9600 bps)
87; bits 4-3 = parity
88; (00 or 10 = none, 01 = odd, 11 = even)
89; bit 2 = stop-bits
90; (set = 2 stop-bits, clear = 1 stop-bit)
91; bits 1-0 = data-bits
92; (00 = 5, 01 = 6, 10 = 7, 11 = 8)
93;
94
95; 9600 bps, no parity, 1 stop-bit, 8 bits per char
96AUX_INIT_PARMS EQU 11100011b
97
98; Com-port for debugging, 0 is disabled
99BIOS_COM_PORT EQU 1
100
101; Default word value for BIOS_AuxParms variable
102; Note that is has moved since v1.07
103BIOS_AUXPARMS_DEFAULT EQU (AUX_INIT_PARMS SHL 8) OR BIOS_COM_PORT
104
105
106
107
108;
109; If ReleaseCode is not defined, it will produce debug-able code...
110;
111ReleaseCode equ -1
112
113
114;
115; All Special Equ's for this project
116;
117
118; Use different addresses depending on whether in pre-boot
119; or debug (dos) environment.
120IFDEF ReleaseCode
121 StartBaseSeg equ 00000h ; Pre-boot, we are in low memory
122 StartBasePtr equ 07C00h ; BIOS starts our MBR at 0:7C00
123ELSE
124 ; Rousseau: where does this value come from ?
125 ; Should be CS.
126 ; Rectified in actual code by ignoring this value.
127 StartBaseSeg equ 03A98h ; Adjust to DOS segment
128 StartBasePtr equ 00100h ; We are a .COM file, DOS is active
129ENDIF
130
131; Address labels after code-move
132BootBaseSeg equ 08000h ; Pre-boot, in the low 640K
133BootBasePtr equ 0h ; We put our MBR to this location
134BootBaseExec equ BootBasePtr+offset MBR_RealStart
135StackSeg equ 07000h ; Put the stack below the code
136
137; Video pages, no INT 10h is used for menu-drawing etc.
138VideoIO_Page0 equ 0B800h
139VideoIO_Page1 equ 0B900h
140VideoIO_Page2 equ 0BA00h
141VideoIO_Page4 equ 0BC00h
142VideoIO_FXSegment equ 0A000h
143
144; Include some macro's
145Include ../INCLUDE/ASM.INC
146
147; Special line-drawing characters
148TextChar_WinLineRight equ 0C4h ; 'Ä'
149TextChar_WinLineDown equ 0B3h ; '³'
150TextChar_WinRep1 equ 0D1h ; 'Ñ'
151TextChar_WinRep2 equ 0C5h ; 'Å'
152TextChar_WinRep3 equ 0CFh ; 'Ï'
153TextChar_WinRep4 equ 0B5h ; 'µ'
154TextChar_WinRep5 equ 0C6h ; 'Æ'
155TextChar_WinRep6 equ 0D8h ; 'Ø'
156
157; Offsets for Partition-Entries in MBR/EPRs
158LocBRPT_LenOfEntry equ 16 ; Length of a standard MBR or EPR entry
159LocBRPT_Flags equ 0 ; Bootable, Hidden, etc.
160LocBRPT_BeginCHS equ 1 ; Combined 10-bits cyl with 6 bits
161LocBRPT_BeginHead equ 1 ; Start head (0<=H<255) 255 is invalid !
162LocBRPT_BeginSector equ 2 ; Start sector (1<=S<=255)
163LocBRPT_BeginCylinder equ 3 ; Start cylinder (0<=C<[1024,16384,65536,n])
164LocBRPT_SystemID equ 4 ; Type of system using the partition
165LocBRPT_EndCHS equ 5 ; Same for end of partition
166LocBRPT_EndHead equ 5
167LocBRPT_EndSector equ 6
168LocBRPT_EndCylinder equ 7
169LocBRPT_RelativeBegin equ 8
170LocBRPT_AbsoluteLength equ 12
171
172LocBR_Magic equ 510
173
174
175; Used as a quick compare in LVM.ASM
176LocLVM_SignatureByte0 equ 02h
177
178; Offsets for LVM Information Sector.
179; These are relative to the start of the LVM sector.
180LocLVM_SignatureStart equ 00h ; 02h,'RMBPMFD' (8 bytes)
181LocLVM_CRC equ 08h ; CRC is a DWORD
182LocLVM_Heads equ 1ch ; Number of heads
183LocLVM_Secs equ 20h ; Sectors per Track
184LocLVM_DiskName equ 24h ; Name of the disk
185LocLVM_StartOfEntries equ 3ch ; (contains maximum of 4 entries)
186LocLVM_LenOfEntry equ 3ch ; Length of an LVM-entry
187
188; An LVM info-sector can contain information on max. 4 partitions.
189; All 4 entries will be used when there 4 primary partitions defined.
190; For logical partitions, the LVM info-sector is located below the start
191; of the logical partition and only one LVM entry is used in that logical
192; LVM info-sector.
193LocLVM_MaxEntries equ 4 ; Max entries in an LVM-sector
194
195; Offsets for LVM entry.
196; These are relative to the start of the entry.
197LocLVM_VolumeID equ 00h ; is DWORD
198LocLVM_PartitionID equ 04h ; is DWORD
199LocLVM_PartitionSize equ 08h ; is DWORD
200LocLVM_PartitionStart equ 0ch ; is DWORD
201LocLVM_OnBootMenu equ 10h ; is on IBM BM Bootmenu
202LocLVM_Startable equ 11h ; is Startable (newly installed system)
203LocLVM_VolumeLetter equ 12h ; is Drive Letter for partition (C-Z or 0)
204LocLVM_Unknown equ 13h ; unknown BYTE
205
206; Truncated to 11 chars when displayed in menu.
207; MiniLVM sets both to the same value.
208; Also, MiniLVM uses a 0-byte terminator, so the maximum length is 19d.
209; Same goes for LocLVM_DiskName.
210; These offsets are relative to an LVM entry.
211LocLVM_VolumeName equ 14h ; 20 bytes
212LocLVM_PartitionName equ 28h ; 20 bytes (Used in menu)
213
214; LVM constants.
215LocLVM_LabelLen equ 14h ; Length of an LVM Label (Disk/Part/Vol)
216LocLVM_DiskNameLen equ 14h ; Length of an LVM DiskName
217LocLVM_VolumeNameLen equ 14h ; Length of an LVM VolumeName
218LocLVM_PartitionNameLen equ 14h ; Length of an LVM PartitionName
219
220
221
222; Offsets for IPT (Internal Partition Table)
223LocIPT_MaxPartitions equ partition_count ; 45 in v1.07
224LocIPT_LenOfSizeElement equ 6 ; Size of one Size-Element
225LocIPT_LenOfIPT equ 34 ; Length of an IPT-entry
226LocIPT_Serial equ 0 ; Serial from MBR ?
227LocIPT_Name equ 4 ; Name from FS or LVM (part/vol)
228LocIPT_Drive equ 15 ; Drive-ID (80h,81h)
229LocIPT_SystemID equ 16 ; Partition-Type (06,07,etc)
230LocIPT_Flags equ 17 ; AiR-BOOT Flags for partition (see below)
231LocIPT_BootRecordCRC equ 18 ; CRC of Boot-Record
232LocIPT_LocationBegin equ 20 ; Begin of Partition
233LocIPT_LocationPartTable equ 23 ; PartitionTable of Partition
234LocIPT_AbsoluteBegin equ 26 ; Absolute Sector of Begin
235LocIPT_AbsolutePartTable equ 30 ; Absolute Sector of PartTable
236
237; Hidden Partition Table
238;~ LocHPT_LenOfHPT equ 30 ; Length of an HPT-entry
239; Length of an HPT-entry ((45 * 6 bits-per-part) / 8) * 45
240; Packed table !
241LocHPT_LenOfHPT equ 34
242
243; AiR-BOOT IPT-Flags
244LocIPT_DefaultFlags equ 00000011b ; Don't know if boot-able :)
245LocIPT_DefaultNonBootFlags equ 00000010b ; ...VIBR Detection is always on
246
247Flags_Bootable equ 00000001b
248Flags_VIBR_Detection equ 00000010b
249Flags_HideFeature equ 00000100b
250Flags_DriveLetter equ 00001000b ; OS/2 FAT16/HPFS only
251Flags_ExtPartMShack equ 00010000b ; Ext. Partition M$-Hack req ?
252Flags_NoPartName equ 01000000b
253Flags_NowFound equ 10000000b ; temp only in OldPartTable
254Flags_SpecialMarker equ 10000000b ; temp only for HiddenSetup
255
256FileSysFlags_BootAble equ 00000001b ; Is this Partition boot-able ?
257FileSysFlags_FAT32 equ 00010000b ; FAT 32 specific name getting
258FileSysFlags_NoName equ 00100000b ; No Name - use PartitionName
259FileSysFlags_DriveLetter equ 01000000b ; DriveLetter Feature possible
260
261; Navigation keys
262Keys_Up equ 48h
263Keys_Down equ 50h
264Keys_Left equ 4Bh
265Keys_Right equ 4Dh
266Keys_PageUp equ 49h
267Keys_PageDown equ 51h
268Keys_GrayPlus equ 4Eh
269Keys_GrayMinus equ 4Ah
270Keys_Plus equ 1Bh
271Keys_Minus equ 35h
272Keys_ENTER equ 1Ch
273Keys_ESC equ 1h
274Keys_F1 equ 3Bh
275Keys_F10 equ 44h
276Keys_C equ 2Eh ; Add. Check auf Ctrl!
277Keys_Y equ 2Ch
278Keys_Z equ 15h
279Keys_N equ 31h
280Keys_TAB equ 0Fh
281Keys_Delete equ 53h
282Keys_Backspace equ 0Eh
283Keys_Space equ 20h
284
285Keys_Flags_EnterSetup equ 1100b ; Strg+Alt (AL)
286
287
288
289
290
291
292;------------------------------------------------------------------------------
293; AiR-BOOT / MAIN-CODE
294;------------------------------------------------------------------------------
295
296; ------------------------------------------
297; Rousseau: # Changed this from .386 to .286
298; ------------------------------------------
299; Because of the TASM-bug the processor had to be changed to turn JUMPS
300; off. Existing movzx instructions were replaced with 286 equivalent code.
301; Out of range relative jumps have been recoded.
302; TASM still generates an extra NOP after test [mem],1
303; instructions.
304; JWasm produces tighter code.
305; JWasm:
306; With segment overrides, the address is expanded to the bit-width.
307; So, .386 will generate a 32-bit address, even in a USE16 segment.
308.286
309
310; This influences the uses directive and other stuff,
311; like calling-style and local variables.
312; The model itself,large, has no effect because we generate
313; a binairy image and not a segmented executable.
314
315; Tasm needs a memory model for USES on PROC to work.
316IFDEF TASM
317 ;~ .model large, basic
318 .model tiny,c
319ENDIF
320
321;
322; This is used to switch between the original 1-segment (code_seg) and the
323; 2-segment (code_seg and bss_data).
324; The 2-segment layout was needed for JWasm because it does not treat
325; db ? in a code segment as bss-data, even if at the end of the code segment.
326; Therefore, a true BSS segment is now used.
327; Both the code_seg and the bss_data are grouped to the logical airboot
328; segment.
329; Note that this influences the offsets in the BSS in the list-file and
330; the wdis disassembly file (.WDA).
331; They are now segment-relative. The true offset is resolved at link
332; time.
333;
334SEGMENTED EQU
335
336IFDEF SEGMENTED
337 AIRBOOT GROUP LDRIMAGE,VOLATILE
338ENDIF
339
340; Our code-segment starts here.
341LDRIMAGE SEGMENT USE16 PUBLIC 'CODE'
342
343IFDEF SEGMENTED
344 ASSUME CS:AIRBOOT, DS:AIRBOOT, ES:nothing, SS:nothing
345ELSE
346 ASSUME CS:LDRIMAGE,DS:LDRIMAGE,ES:nothing, SS:nothing
347ENDIF
348
349;==============================================================================
350 ; Sector 1
351
352;##############################################################################
353 ; We are not a .COM file at 100h but a BINARY image
354 ; of which only the 1st sector gets loaded at 0000:07c00h
355 ; by the BIOS. The code in this 1st sector is position
356 ; independent and moves itself to a new location at 8000:0000h.
357 ; Then it jumps to a new entry-point and loads the rest of
358 ; the image to the new location.
359 org 00000h ; Sector 1
360;##############################################################################
361
362
363;
364; Start of sector 1
365; This is the MBR.
366; Note the AiRBOOT signature, it's date, version and language.
367; Version 1.07 was intruduced in 2011, version 1.0.8 in 2012.
368; These new versions fix issues with huge drives, lvm and more.
369; For a detailed description see AIR-BOOT.HIS.
370;
371
372;
373; ---------------------------------------------
374; Rousseau: # Combined letter and jump offset #
375; ---------------------------------------------
376; Martin had a short jump followed by the AiRBOOT signature at first.
377; Then he encountered strange behaviour by some M$ operating-systems
378; if the the first insruction was not a CLI.
379; But there was no room to insert the CLI and of course he did not want to
380; change the location of the AiRBOOT signature.
381; He solved this by inserting the M$ needed CLI at offset 0 followed by a short
382; jump that uses the 'A' of the AiRBOOT signature as the jump displacement.
383;
384
385
386;------------------------------------------------------------------------------
387AiR_BOOT:
388
389 ; Some M$ operating systems need a CLI
390 ; here otherwise they will go beserk
391 ; and will do funny things during
392 ; boot phase, it's laughable!
393 cli
394
395 ; JMP-Short -> MBR_Start
396 ; Uses the 'A' from the signature as the displacement !
397 db 0EBh
398
399 ; ID String, Date (DD,MM,CC,YY), Version Number, Language ID
400 ;~ db 'AiRBOOT', 24h, 02h, 20h, 12h, 01h, 08h, TXT_LanguageID
401 InsertAirbootSignature TXT_LanguageID
402
403 ; Total Sectors Count.
404 ; Will get overwritten by FIXCODE.
405 db 1
406
407 ; Total Sectors Count,
408 ; Dynamic calculation.
409 ;~ db (code_end-$)/512
410
411
412MBR_CheckCode dw 0 ; Check-Sum for Code
413
414;
415; No single instruction below should be changed, added or removed in the code
416; below as this will cause the jump-link to go haywire.
417;
418MBR_Start:
419 sti ; This opcode is dedicated to:
420 cld ; =MICROSOFT JUMP DEPARTMENT=
421
422 ; Setup some base stuff
423 ; AX got loaded wrongly for debug, changed the instructions
424 ; without modifying the number of bytes.
425 ; Don't comment-out the redundant instruction below because this
426 ; *will* change the number of bytes and break the jump-chain.
427 mov ax, StartBaseSeg ; The segment we are moving ourself from (NOT USED)
428 ;mov ds, ax
429 push cs
430 pop ds
431 mov si, StartBasePtr ; The offset we are moving ourself from
432 mov ax, BootBaseSeg ; The target segment we are moving ourself to
433 mov es, ax
434 mov di, BootBasePtr ; The target offset we are moving ourself to
435
436 ; Depending on pre-boot or debug,
437 ; only move first 512 bytes or the whole she-bang++ (65400 bytes)
438 IFDEF ReleaseCode
439 mov cx, 256 ; Pre-boot environment
440 ELSE
441 mov cx, 32700 ; Debug environment (move ~64kB)
442 ENDIF
443
444 ;
445 ; LET's MOVE OURSELVES !
446 ;
447 rep movsw
448
449 ; Code an intersegment jump to the new location
450 db 0EAh
451 dw BootBaseExec ; This is MBR_RealStart + BootBasePtr
452 dw BootBaseSeg ; This is 08000h
453 ;jmp far ptr BootBaseSeg:BootBaseExec
454
455
456;
457; Some MBR-functions to provide absolute minimum functionality.
458;
459
460;
461; Entry-point for halting the system.
462;
463MBR_HaltSystem:
464 mov ax, 8600h
465 xor cx, cx
466 mov dx, 500
467 int 15h ; Wait to display the whole screen :]
468MBR_HaltSys:
469 cli
470 jmp MBR_HaltSys
471;db 100 dup (0)
472
473
474
475 ;
476 ; Some small space for variables.
477 ;
478 ORIGIN 0003Ch
479
480; Comport settings
481; It had to be moved to create room for the double I13X
482; signature.
483; It cannot be in the config-area (sector 55)
484; because that area is crc-protected and would not allow 'poking'.
485BIOS_AuxParms dw BIOS_AUXPARMS_DEFAULT
486
487reserved db 6 dup('X')
488
489
490 ;
491 ; We arrive here after the first jump using the 'A' of the
492 ; AiR-BOOT signature.
493 ; So we ensure the jump is always at this offset.
494 ; We jump here, because Martin needed to
495 ; insert a CLI on start and did not
496 ; want to change the AiR-BOOT signature
497 ; because of Microsoft inventions...
498 ;
499 ORIGIN 00044h
500
501 ; Jump again...
502 ; This time to the setup-code.
503 jmp MBR_Start
504
505;
506; Entry-point when loading fails.
507;
508 db 'LOAD ERROR!', 0
509MBR_LoadError Proc Near
510 mov si, offset $-12
511 push cs
512 pop ds
513 call MBR_Teletype
514 MBRLE_Halt:
515 jmp MBRLE_Halt
516MBR_LoadError EndP
517
518;
519; Entry-point when saving fails.
520;
521 db 'SAVE ERROR!', 0
522MBR_SaveError Proc Near
523 mov si, offset $-12
524 push cs
525 pop ds
526 call MBR_Teletype
527 MBRSE_Halt:
528 jmp MBRSE_Halt
529MBR_SaveError EndP
530
531
532; Put text on the screen using the BIOS tele-type function.
533; No attributes like color are supported.
534; In: SI - Pointer to begin of string (EOS is 0)
535; Destroyed: SI
536MBR_Teletype Proc Near Uses ax bx cx
537 mov ah, 0Eh
538 mov bx, 7
539 MBRT_Loop:
540 lodsb
541 or al, al
542 jz MBRT_End
543 int 10h
544 jmp MBRT_Loop
545 MBRT_End:
546 ret
547MBR_Teletype EndP
548
549;
550; Rousseau: DO NOT ADD CODE TO THIS SECTION !
551;
552
553; In: BX - Base Check, DS:SI - Pointer to 512-byte-area to be included
554; Out: BX - Base Check Result
555; Destroyed: SI will get updated (+512)
556MBR_GetCheckOfSector Proc Near Uses ax cx
557 mov cx, 256
558 MBRGCOS_Loop:
559 lodsw
560 xor ax, 0BABEh
561 xor bx, ax
562 loop MBRGCOS_Loop
563 or bx, bx
564 jnz MBRGCOS_NoFixUp
565 mov bx, 1 ; dont allow 0, cause 0 == empty
566 MBRGCOS_NoFixUp:
567 ret
568MBR_GetCheckOfSector EndP
569
570
571
572
573
574
575;
576; This is where the rest of AiR-BOOT gets loaded.
577;
578
579;------------------------------------------------------------------------------
580MBR_RealStart:
581 mov ax, StackSeg ; 07000h, below the moved code
582 mov ss, ax
583 ;mov sp, 7FFFh ; Odd stack-pointer ??
584 mov sp, 7FFEh ; Even is better
585 mov ax, es ; ES holds segment where we moved to
586 mov ds, ax ; Set DS==ES to Code Segment
587
588
589 ; If we are in debug-mode, all code is moved already,
590 ; so we can directly jump to it.
591 ; One difference is that in debug-mode, the whole .com image is
592 ; loaded by dos while when air-boot is active from the MBR it
593 ; does the loading itself.
594 IFNDEF ReleaseCode
595 jmp AiR_BOOT_Start
596 ENDIF
597
598
599 ; Load missing parts from harddrive...
600 ;mov ax, cs ; actually obsolete
601 ;mov es, ax ; actually obsolete
602
603 ; Load the configuration-sectors from disk.
604 mov bx, offset Configuration
605 mov dx, 0080h ; First harddrive, Sector 55
606 mov cx, 0037h ; Is 55d is config-sector
607
608 ; Call the i/o-part
609 call MBR_LoadConfig
610
611 jnc MBR_ConfigCopy_NoError
612
613 ; Some error occured
614 MBR_ConfigCopy_LoadError:
615 call MBR_LoadError ; Will Abort BootUp
616
617 ; Load the code sectors
618 MBR_ConfigCopy_NoError:
619 mov bx, offset FurtherMoreLoad
620 mov dx, 0080h ; First harddrive
621 mov cx, 0002h ; Second sector
622 mov ah, 02h
623
624 ; This location is in the code-segment.
625 ; When segment overrides are applied, the address is
626 ; expanded to the bit-with.
627 ; So the .286 or .386 directive influences the length
628 ; of the instruction, even with a USE16 segment.
629 mov al, ds:[10h] ; Number of code sectors
630 int 13h
631 jnc MBR_RealStart_NoError
632 jmp MBR_ConfigCopy_LoadError
633
634
635 ; [v1.05+]
636 ; Signature for IBM's LVM to detect our "powerful" features ;)
637 ;
638 ; [v1.0.8+]
639 ; Reworked MBR code to be able to create a
640 ; double 'I13X' signature.
641 ; MBR's created with LVM eCS v1.x have the signature at 0d5h
642 ; MBR's created with LVM eCS v2.x have the signature at 0d0h
643 ; See eCS bugtracker issue #3002
644 ;
645 ; Update: These are actually MOV EAX,'X31I' instructions
646 ; in the eCS LVM MBR-code. They are at different places in
647 ; the v1.x and v2.x LVM code.
648 ; Let's protect their location.
649 ORIGIN 000d0h
650 db 'I13X',0,'I13X',0
651
652
653 MBR_RealStart_NoError:
654 ; Now Check Code with CheckSum
655 mov si, offset FurtherMoreLoad
656
657 ;movzx cx, bptr ds:[10h]
658 mov cl, ds:[10h]
659 mov ch,0
660
661 xor bx, bx
662 MBR_RealStart_CheckCodeLoop:
663 call MBR_GetCheckOfSector
664 loop MBR_RealStart_CheckCodeLoop
665
666
667 cmp MBR_CheckCode, bx
668 je MBR_RealStart_CheckSuccess
669
670 mov si, offset TXT_ERROR_Attention
671 call MBR_Teletype
672 mov si, offset TXT_ERROR_CheckCode
673 call MBR_Teletype
674 mov si, offset TXT_ERROR_CheckFailed
675 call MBR_Teletype
676 jmp MBR_HaltSystem
677 MBR_RealStart_CheckSuccess:
678 jmp AiR_BOOT_Start
679
680
681
682
683
684;------------------------------------------------------------------------------
685 Include TEXT/TXTMBR.ASM ; All translateable Text in MBR
686;------------------------------------------------------------------------------
687
688
689
690; This is an ugly kludge function to create space for the
691; double 'I13X' signature.
692; It loads the configuration sectors, but bx,cx and dx are not initialized
693; in this function. That's done around line 500.
694; Putting this few bytes here creates just enough room.
695MBR_LoadConfig Proc Near
696 ; Changed from conditional assembler to calculated value
697 ; Fixes issue: #2987 -- "air-boot doesn't remember drive letter"
698 ; Size of the ab-configuration in 512 byte sectors
699 mov al, (MBR_BackUpMBR - Configuration) / 200h
700 mov ah,02h
701 int 13h
702 ret
703MBR_LoadConfig EndP
704
705
706 ; Disk Signature
707 ; Note that in an LVM 2.x MBR this collides
708 ; with the dummy PTE that it uses to look for IBM-BM
709 ; on the second harddisk.
710 ORIGIN 001B8h
711
712 ; AiR-BOOT will merge the field from the MBR it replaces.
713 db 'DSIG'
714
715 ; Unused word at 01BCh.
716 ; An LVM 2.x MBR puts 0CC33h here.
717 ; AiR-BOOT will merge the field from the MBR it replaces.
718 dw '$$'
719
720
721 ;
722 ; Partition Table.
723 ;
724 ORIGIN 001BEh
725
726 ; The 4 entries just for show.
727 ; AiR-BOOT will merge them from the MBR it replaces.
728 db 16 dup('0')
729 db 16 dup('1')
730 db 16 dup('2')
731 db 16 dup('3')
732
733 ; Boot Sigbature
734 dw 0aa55h
735
736; End of sector 1
737
738
739
740
741
742;==============================================================================
743 ; Sector 2
744
745 ;
746 ; Here starts the second sector, sector 2
747 ;
748 ORIGIN 00200h
749
750;
751; Everything beyond this point is loaded on startup
752; and is NOT existant at first
753;
754FurtherMoreLoad:
755
756;
757; Filesystem table correlating id with name.
758;
759
760 ; first Normal-Partition-ID, Hidden-Partition-ID
761 ; and Default-Partition-Flags.
762 ; 01h -> Boot-Able
763 ; 10h -> FAT32 - Name Getting Scheme
764 ; 20h -> No Name To Get (use Partition Name from IPT)
765 ; 40h -> 'L' flag possible
766 db 'AiRSYS-TABLE'
767FileSysIDs db 01h, 11h,01h, 04h,014h,01h, 06h,016h,41h, 0Eh,00Eh,01h
768 db 07h, 17h,41h, 08h,017h,21h, 35h,035h,20h,0FCh,017h,41h
769 db 09h, 19h,11h, 0Bh,01Bh,11h, 0Ch,01Ch,11h,0EBh,0EBh,01h
770 db 63h, 63h,21h, 81h,081h,21h, 83h,083h,21h, 40h,040h,21h
771 db 0A5h,0A5h,21h,0A6h,0A6h,21h, 82h,082h,20h,0A7h,0A7h,21h
772 db 63h, 63h,21h, 4Dh,04Dh,21h, 4Eh,04Eh,21h, 4Fh,04Fh,21h
773 db 01h, 01h,01h, 01h,001h,01h, 01h,001h,01h, 01h,001h,01h
774 db 01h, 01h,01h, 01h,001h,01h, 01h,001h,01h, 01h,001h,01h
775 db 01h, 01h,01h, 01h,001h,01h, 01h,001h,01h, 01h,001h,01h
776 db 01h, 01h,01h,0FDh,0FDh,20h, 84h,084h,20h,0A0h,0A0h,20h
777 db 0Ah, 0Ah,20h,0FEh,0FEh,21h,0FFh,0FFh,21h, 00h,000h,21h
778 db 16 dup (0)
779
780FileSysNames db 'FAT12 ', 'FAT16 ', 'FAT16Big', 'FAT16Big'
781 db 'HPFS ', 'NTFS ', 'LVM-Data', 'JFS '
782 db 'FAT32 ', 'FAT32 ', 'FAT32 ', 'BeOS '
783 db 'Unix ', 'Minix ', 'Linux ', 'Venix ' ; x row ;)
784 db 'BSD/386 ', 'OpenBSD ', 'LinuxSwp', 'NeXTSTEP'
785 db 'GNU HURD', 'QNX ', 'QNX ', 'QNX '
786 db ' ', ' ', ' ', ' '
787 db ' ', ' ', ' ', ' '
788 db ' ', ' ', ' ', ' '
789 db ' ', 'Kernel ', ' ', '0V-Award'
790; db 'OS/2 Man', 'via BIOS', 'Floppy ', 'Unknown '
791 db 'OS2-BMGR', 'via BIOS', 'Floppy ', 'Unknown '
792 ; -> 44 Partition-Types
793
794
795
796
797;==============================================================================
798 ; Sector 3
799 ;
800 ; Sector 3
801 ;
802 ORIGIN 00400h
803
804
805 ; ##############################################
806 ; ## ENTRY-POINT AFTER ALL THE INITIAL HASSLE ##
807 ; ##############################################
808
809
810
811
812AiR_BOOT_Start:
813
814
815
816 ;
817 ; Since v1.0.8, AiR-BOOT is able to chainload IBM-BM.
818 ; When IBM-BM resides above the 1024-cylinder limit, the 'I13X'
819 ; signature is required at 3000:0000, FS needs to contain 3000h
820 ; and the 32-bit LBA address needs to follow the 'I13X' signature.
821 ; For booting IBM-BM from the second disk, a copy of the MBR of the
822 ; first disk is also required at 0000:7E00.
823 ; This information is derived from the eCS 2.x LVM MBR.
824 ;
825 ; So, now is a good time to copy the MBR of the first disk to
826 ; 0000:7E00 in case the partition that will be started is IBM-BM.
827 ; This copy is located at 8000:0000 and DS already points to this
828 ; segment.
829 ;
830 pusha ; Save all the general purpose regs
831 push es ; We need ES too, so save its value
832 xor ax,ax ; Segment 0000h
833 mov es,ax ; Make ES point to it
834 mov si,offset BootBasePtr ; Start of AiR-BOOT which has the MBR
835 mov di,7e00h ; Destination for the MBR for IBM-BM
836 mov cx,100h ; 256 words = 512 bytes
837 cld ; Direction from low to high
838 rep movsw ; Copy the 256 words of the MBR
839 pop es ; Restore previous value of ES
840 popa ; Restore all the general purpose regs
841
842
843 ;~ nop
844 ;~ mov ax, offset sobss
845 ;~ mov ax,offset BeginOfVariables
846 ;~ mov ax,offset [TrueSecs]
847 ;~ lea ax, [TrueSecs] ; Tasm generates mov here
848 ;~ mov ax,word ptr [TrueSecs]
849 ;~ mov ax,offset EndOfVariables
850 ;~ mov ax, offset eobss
851 ;~ nop
852
853
854
855 ;jmp skip
856
857 ; Rousseau:
858 ; I should cleanup my garbage here...
859
860 ; Initialize Variable-Tables, Detections, etc.
861 call PRECRAP_Main
862
863 ; Number of harddisks is now known
864
865 call PARTSCAN_ScanForPartitions
866
867
868 ; Number of disks found
869 mov si, offset DisksFound
870 call MBR_Teletype
871
872 mov al, [TotalHarddiscs]
873 call VideoIO_SyncPos
874 call VideoIO_PrintByteDynamicNumber
875 xor si,si
876 call MBR_TeletypeNL
877
878 ; Number of bootable systems indicator
879 mov si, offset PartitionsFound
880 call MBR_Teletype
881
882 mov al, [CFG_Partitions]
883 call VideoIO_SyncPos
884 call VideoIO_PrintByteDynamicNumber
885
886 xor si,si
887 call MBR_TeletypeNL
888 call MBR_TeletypeNL
889
890 call VideoIO_SyncPos
891
892 mov dl,80h
893 call VideoIO_DumpDiskInfo
894
895 ;
896 ; Enumberate Bootable Systems by name
897 ; and prepare Phase 1 if active.
898 ;
899 ; This can also be implemented using the
900 ; Installable LVM-flag I think.
901 ; But at the time I had lesser knowledge about LVM...
902 ; So this algorithm may change in the future.
903 ;
904 mov si, offset PartitionTable
905 xor cx,cx
906 mov cl,[CFG_Partitions]
907 MBR_Parts:
908 add si, 4
909 push si
910 push si
911 ;call MBR_TeletypeVolName
912 pop si
913 call PART_IsInstallVolume
914 jnc MBR_Parts_NI
915
916 ; Install Volume
917 mov al,' '
918 mov bl,7
919 mov ah, 0eh
920 int 10h
921
922 mov al,'('
923 mov bl,7
924 mov ah, 0eh
925 int 10h
926
927 mov al,[CFG_Partitions]
928 sub al,cl
929 ;inc al
930 ;mov [Menu_EntryAutomatic],al
931 mov [CFG_PartAutomatic],al ; Setup entry for install-volume
932 mov [CFG_PartLast],al
933 mov ah, [eCS_InstallVolume] ; 1st byte is 0 if no phase 1 active
934 test ah,ah ; test the byte, ZF is 0 if phase 1 active
935 lahf ; flags in ah
936 xor ah, 40h ; complement ZF
937 and ah, 40h ; mask ZF
938 shr ah, 6 ; move ZF to LSB
939 mov [CFG_AutomaticBoot], ah ; automatic boot if phase 1 is active
940
941
942 add al,'1'
943 mov bl,7
944 mov ah, 0eh
945 int 10h
946
947 mov al,')'
948 mov bl,7
949 mov ah, 0eh
950 int 10h
951
952 mov bx,cx
953
954 MBR_Parts_NI:
955 xor si,si
956 ;call MBR_TeletypeNL
957 pop si
958 add si, 30 ; Add remainder of IPT entry
959 loop MBR_Parts
960
961
962
963
964 ; Index of automatic start partition
965 ;mov si, offset AutoStartPart
966 ;call MBR_Teletype
967
968 ;mov al, [CFG_PartAutomatic]
969 ;add al, 31h
970 ;mov ah, 09h
971 ;mov bx, 15
972 ;mov cx, 1
973 ;int 10h
974
975 ;mov al, [CFG_PartAutomatic]
976 ;add al, 31h
977 ;mov ah, 0eh
978 ;mov bx, 15
979 ;mov cx, 1
980 ;int 10h
981
982 xor si,si
983 call MBR_TeletypeNL
984 xor si,si
985 call MBR_TeletypeNL
986
987 ;mov ax,[BIOS_AuxParms]
988 ;call VideoIO_SyncPos
989 ;push ax
990 ;add al,'0'
991 ;mov bl,7
992 ;mov ah, 0eh
993 ;int 10h
994 ;pop ax
995 ;xchg al,ah
996 ;sub al,0a2h
997 ;mov bl,7
998 ;mov ah, 0eh
999 ;int 10h
1000
1001
1002 call MBR_TeletypeSyncPos
1003
1004 xor si,si
1005 call MBR_TeletypeNL
1006 call MBR_TeletypeNL
1007
1008
1009
1010 mov si, offset ShowMenu
1011 call MBR_TeletypeBold
1012
1013
1014 skip:
1015
1016
1017
1018 ;
1019 ; ####################### WAIT FOR KEY ########################
1020 ;
1021
1022
1023 ; Rousseau:
1024 ; Wait for key so we can see debug log if ab-menu hangs.
1025 ;;xor ax, ax
1026 ;;int 16h
1027
1028 ;call SOUND_Beep
1029
1030 ; Rousseau: delayed save of video-page
1031
1032 mov ax, VideoIO_Page1
1033 call VideoIO_BackUpTo ; Copy BIOS POST to Second Page
1034
1035 ;call SOUND_Beep
1036
1037
1038 ;
1039 ; COM-PORT DEBUG
1040 ;
1041 ;call AuxIO_TeletypeNL
1042 ;mov si, offset PartitionTable
1043 ;call AuxIO_DumpSector
1044 ;call AuxIO_TeletypeNL
1045
1046
1047 ; Save configuration so phase1 boot-through is disabled
1048 ; on next boot.
1049 ; Moved here to fix that Esc out of SETUP would also save.
1050 ; So moved above the MBR_Main_ReEnterSetup label.
1051 mov byte ptr [eCS_InstallVolume], 0 ; disable phase 1 for next boot
1052 call DriveIO_SaveConfiguration
1053
1054
1055
1056 ;
1057 ; RE-ENTER SETUP
1058 ;
1059 MBR_Main_ReEnterSetup:
1060 call SETUP_CheckEnterSETUP
1061
1062 ;call SOUND_Beep
1063
1064 ; Rousseau: Every time I see "AfterCrap" I have to laugh :-)
1065 call AFTERCRAP_Main
1066
1067 ; [Linux support removed since v1.02]
1068 ; Now get FAT16-Linux Kernel Partition, If requested
1069 ;cmp [CFG_LinuxKrnlPartition], 0FFh
1070 ;je MBR_Main_NoLinuxKrnlPartition
1071 ;call LINUX_InitFAT16access
1072 ;MBR_Main_NoLinuxKrnlPartition:
1073
1074
1075
1076 MBR_Main_ReEnterBootMenuPre:
1077
1078 ; SetUp PartitionPointers for BootMenu (filter non-bootable)
1079 call PART_CalculateMenuPartPointers
1080
1081 ; ...and count that one...
1082 cmp byte ptr [PartitionPointerCount], 0
1083 jne MBR_Main_SomethingBootAble
1084 mov si, offset TXT_NoBootAble
1085 call MBR_Teletype
1086 jmp MBR_HaltSystem
1087
1088 MBR_Main_SomethingBootAble:
1089 ; FixUp Values, define Timed Setup booting, etc.
1090 call PART_FixUpDefaultPartitionValues
1091
1092
1093
1094 ; -------------------------------------------------- BOOT-MENU
1095 MBR_Main_ReEnterBootMenu:
1096 call BOOTMENU_ResetMenuVars ; reset has to be done
1097 test byte ptr [CFG_AutomaticBoot], 1
1098 jz MBR_Main_NoAutomaticBooting
1099 ; ------------------------------------------ AUTOMATIC BOOTING
1100 ; Select automatic partition, disable automatic booting for
1101 ; next time and boot system...
1102 mov byte ptr [CFG_AutomaticBoot], 0
1103 call PASSWORD_AskSystemPwd
1104 mov al, Menu_EntryAutomatic
1105
1106 ;mov al, 2
1107
1108 mov Menu_EntrySelected, al ; zero based
1109 jmp MBR_Main_NoBootMenu
1110
1111 MBR_Main_NoAutomaticBooting:
1112
1113 ;call SOUND_Beep
1114
1115 test byte ptr [CFG_BootMenuActive], 0FFh
1116 jnz MBR_Main_GotBootMenu
1117 ; ----------------------------------------------- NO BOOT-MENU
1118 ; Select default partition and boot system...
1119 call PASSWORD_AskSystemPwd
1120
1121 ;call VideoIO_DBG_WriteString2
1122
1123 mov al, Menu_EntryDefault
1124 ;mov al,0 ; zero based
1125 mov Menu_EntrySelected, al
1126 jmp MBR_Main_NoBootMenu
1127
1128 MBR_Main_GotBootMenu:
1129 ; ------------------------------------------ BOOT-MENU VISUALS
1130 call FX_StartScreen
1131
1132 ;call SOUND_Beep
1133
1134 call BOOTMENU_BuildBackground
1135 call BOOTMENU_BuildMain
1136 call FX_EndScreenRight
1137 call PASSWORD_AskSystemPwd
1138 call BOOTMENU_ResetTimedBoot
1139
1140 ;call SOUND_Beep
1141
1142 call BOOTMENU_Execute
1143
1144 ;call SOUND_Beep
1145
1146 jc MBR_Main_ReEnterSetup
1147 call BOOTMENU_SetVarsAfterMenu
1148
1149 ;call SOUND_Beep
1150
1151 ; ---------------------------------------------------- BOOTING
1152 MBR_Main_NoBootMenu:
1153 call FX_StartScreen
1154 call BOOTMENU_BuildGoodBye
1155 call FX_EndScreenRight
1156 call PASSWORD_AskChangeBootPwd
1157
1158 IFNDEF ReleaseCode
1159 ; Debug Code to terminate DOS .COM program - used for
1160 ; testing AiR-BOOT
1161 int 3
1162 mov ax, 6200h
1163 int 21h
1164 mov es, bx
1165 mov ax, 4C00h ; Quit program
1166 int 21h
1167 ENDIF
1168 call ANTIVIR_SaveBackUpMBR
1169 mov dl, Menu_EntrySelected
1170
1171 ; -------------------------------------------- START PARTITION
1172 call PART_StartPartition
1173
1174
1175
1176;
1177; Include other code-modules here.
1178; Because TASM is a multiple pass assembler, forward references
1179; are possible.
1180;
1181b_std_txt:
1182Include REGULAR/STD_TEXT.ASM ; Standard (non-translateable text)
1183size_std_txt = $-b_std_txt
1184
1185b_driveio:
1186Include REGULAR/DRIVEIO.ASM ; Drive I/O, Config Load/Save
1187size_driveio = $-b_driveio
1188
1189b_lvm:
1190Include SPECIAL/LVM.ASM ; LVM-specific code
1191size_lvm = $-b_lvm
1192
1193b_videoio:
1194Include REGULAR/VIDEOIO.ASM ; Video I/O
1195size_videoio = $-b_videoio
1196
1197b_timer:
1198Include REGULAR/TIMER.ASM ; Timer
1199size_timer = $-b_timer
1200
1201b_partmain:
1202Include REGULAR/PARTMAIN.ASM ; Regular Partition Routines
1203size_partmain = $-b_partmain
1204
1205b_partscan:
1206Include REGULAR/PARTSCAN.ASM ; Partition Scanning
1207size_partscan = $-b_partscan
1208
1209b_bootmenu:
1210Include REGULAR/BOOTMENU.ASM ; Boot-Menu
1211size_bootmenu = $-b_bootmenu
1212
1213b_password:
1214Include REGULAR/PASSWORD.ASM ; Password related
1215size_password = $-b_password
1216
1217b_other:
1218Include REGULAR/OTHER.ASM ; Other Routines
1219size_other = $-b_other
1220
1221b_main:
1222Include SETUP/MAIN.ASM ; The whole AiR-BOOT SETUP
1223size_main = $-b_main
1224
1225
1226
1227IFDEF TXT_IncludeCyrillic
1228b_ccharset:
1229 Include SPECIAL/CHARSET.ASM ; Charset Support (e.g. Cyrillic)
1230size_ccharset = $-b_ccharset
1231ENDIF
1232
1233
1234b_math:
1235Include REGULAR/MATH.ASM ; Math functions (like 32-bit multiply)
1236size_math = $-b_math
1237
1238
1239
1240
1241; Various debugging routines, uses AUXIO and CONV
1242IFDEF AUX_DEBUG
1243b_debug:
1244Include REGULAR/DEBUG.ASM ; Debug module
1245size_debug = $-b_debug
1246b_auxio:
1247Include REGULAR/AUXIO.ASM ; Com-port support for debugging
1248size_auxio = $-b_auxio
1249ENDIF
1250
1251
1252
1253
1254;==============================================================================
1255
1256 ;
1257 ; Moved up.
1258 ;
1259
1260 ;
1261 ; This is the AiR-BOOT MBR-Protection Image.
1262 ; 04600 / 200h = 23h = 35d sectors are before this point.
1263 ; The stuff generated here gets overwritten when the
1264 ; MBR_PROT.ASM module, which is assembled separately,
1265 ; gets merged.
1266 ; So you won't find the string below in the generated binary.
1267 ;
1268 ; MOVED TO 6800h to create space and have a continuous
1269 ; code block.
1270 ; This makes the RU version buildable again with Tasm.
1271 ;
1272 ;org 04600h ; Sector 36-37
1273
1274
1275 ; Rousseau: It needed a sector alignment, so moved it up to
1276 ; have as much space as possible for the modules
1277 ; included here.
1278
1279
1280;==============================================================================
1281 ; Sector 38-x
1282 ;
1283 ; This section contains translatable texts.
1284 ;
1285 ;org 04A00h
1286
1287
1288b_txtother:
1289Include TEXT/TXTOTHER.ASM ; All translateable Text-Strings
1290size_txtother = $-b_txtother
1291
1292b_txtmenus:
1293Include TEXT/TXTMENUS.ASM ; All translateable Menu-text
1294size_txtmenus = $-b_txtmenus
1295
1296b_charset:
1297Include TEXT/CHARSET.ASM ; Special Video Charsets (if needed)
1298size_charset = $-b_charset
1299
1300b_conv:
1301Include REGULAR/CONV.ASM ; Various conversion routines
1302size_conv = $-b_conv
1303
1304b_virus:
1305Include SPECIAL/VIRUS.ASM ; Virus Detection / Anti-Virus
1306size_virus = $-b_virus
1307; [Linux support removed since v1.02]
1308;Include SPECIAL/FAT16.ASM ; FAT-16 Support
1309;Include SPECIAL/LINUX.ASM ; Linux Kernel Support
1310b_billsuxx:
1311Include SPECIAL/F00K/BILLSUXX.ASM ; Extended Partition - Microsoft-Hack
1312size_billsuxx = $-b_billsuxx
1313
1314
1315
1316 ;
1317 ; Critical end of code marker.
1318 ;
1319 db 'DEAD'
1320 db 'FACE'
1321
1322;
1323; Keep these modules here at the end of the code section.
1324; When debugging, extra code space is used and code will move up towards
1325; the protection image that is 'orged' and will thus overlay.
1326; The effects are turned off in debug mode, so it does not matter much that
1327; this code get's lost.
1328;
1329b_sound:
1330Include SPECIAL/SOUND.ASM ; Sound
1331size_sound = $-b_sound
1332
1333b_apm:
1334Include SPECIAL/APM.ASM ; Power Managment Support
1335size_apm = $-b_apm
1336
1337b_fx:
1338Include SPECIAL/FX.ASM ; l33t Cooper-Bars/Scrolling <bg>
1339size_fx = $-b_fx
1340
1341
1342; If we are debugging, we overwrite the FX code.
1343; As long as no FX is disabled this will do no harm.
1344IFDEF AUX_DEBUG
1345 ORG 06780h
1346ENDIF
1347
1348bld_level:
1349 ;
1350 ; Here we insert the OS/2 BLDLEVEL Information.
1351 ; It is composed of the AiR-BOOT version-info and other
1352 ; information.
1353 ; It is unique for each release of AiR-BOOT.
1354 ;
1355 InsertBuildLevel
1356
1357 ;
1358 ; End of code marker.
1359 ;
1360 db 'BABE'
1361 db 'FACE'
1362
1363code_end:
1364
1365
1366 ;
1367 ; AiR-BOOT Protection Image.
1368 ; Moved from below to have it not break the included modules
1369 ; with it's sector alignment requirement.
1370 ;
1371 ORIGIN 06800h
1372
1373 ;
1374 ; This is the AiR-BOOT MBR-Protection Image.
1375 ; 06800 / 200h = 34h = 52d sectors are before this point.
1376 ; The stuff generated here gets overwritten when the
1377 ; MBR_PROT.ASM module, which is assembled separately,
1378 ; gets merged.
1379 ; So you won't find the string below in the generated binary.
1380 ;
1381
1382 ; 06800-068FF
1383 ; 06900-069FF
1384 ; 06A00-06AFF
1385 ; 06B00-06BFF
1386
1387;
1388; Hardcoded to 1k (1024 bytes) (MBR_PROT.ASM)
1389; The string below is searched for by the FIXCODE helper and *must* be
1390; sector (512-bytes) aligned.
1391;
1392MBR_Protection db 'AiR-BOOT MBR-Protection Image'
1393
1394 ; Just fill.
1395 db 1024-($-MBR_Protection) dup('M')
1396
1397
1398;==============================================================================
1399 ; Sector 55
1400
1401 ;
1402 ; This section contains the AiR-BOOT configuration.
1403 ; Note that it has a version that should be updated
1404 ; when stuff is added.
1405 ; Also add stuff to the end so that offsets of other
1406 ; variables remain vaild.
1407 ;
1408 ORIGIN 06C00h
1409
1410Configuration:
1411 ; THERE IS A NON-ASCII CHAR HERE !!
1412 ; Your editor may not display this non-ASCII
1413 ; character at the end if the 'AiRCFG-TABLE'
1414 ; string. When this character get's deleted,
1415 ; AiR-BOOT will not function because it cannot
1416 ; find the config-signature which includes this
1417 ; invisible character. The code of the char is: 0x0ad.
1418 db 'AiRCFG-TABLE­'
1419 db 01h, 08h, 'U' ; "Compressed" ID String
1420 ; Version 1.02 was for code 1.06, 1.03 was internal
1421 ; and 1.04,1.05 and 1.06 do not exist.
1422 ;
1423 ; 1.07 was used with AB v1.07 and introduced the phase1
1424 ; system-name. For the rest it is compatible with v1.02.
1425 ;
1426 ; 1.0.8 is introduced with AB v1.0.8 and indicates the movement
1427 ; of several components and the packing of the hideparttable.
1428 ; The core configuration has not changed but the generated
1429 ; configuration has. The v1.0.8 installer handles upgrading.
1430 ;
1431 ; It is not required for the config to have the
1432 ; same version as the code, so in the future
1433 ; the code version might be higher than the
1434 ; config version if there are no changes to the latter.
1435 ;
1436
1437CFG_LastTimeEditLow dw 0 ; Last Time Edited Stamp (will incr every setup)
1438CFG_LastTimeEditHi dw 0 ; second 16 bit part...
1439
1440CFG_CheckConfig dw 0 ; Check-Sum for Configuration
1441
1442CFG_Partitions db 0 ; Count of partitions in IPT
1443 db 0 ; Was BootParts - Removed since v0.28b
1444CFG_PartDefault db 0 ; Default-Partition (Base=0)
1445
1446CFG_PartLast db 0 ; Which Partition was booted last time ? (Base=0)
1447CFG_TimedBoot db 0 ; Timed Boot Enable (for REAL Enable look TimedBootEnable)
1448CFG_TimedSecs db 15 ; Timed Boot - How Many Seconds Till Boot
1449CFG_TimedDelay dw 123 ; Timed Boot - Delay
1450CFG_TimedBootLast db 1 ; Timed Boot - Boot From Last Drive Booted From
1451CFG_RememberBoot db 1 ; Remember Manual Boot Choice
1452CFG_RememberTimed db 0 ; Remember if Timed Boot (if both disabled: Boot Default)
1453CFG_IncludeFloppy db 1 ; Include Floppy Drives in Boot-Menu
1454CFG_BootMenuActive db 1 ; Display Boot-Menu (if Disabled: Boot Default)
1455 ; v0.29+ -> 2 - Detailed Bootmenu
1456CFG_PartitionsDetect db 1 ; Autodetect New Partitions (Auto-Add!)
1457CFG_PasswordSetup db 0 ; Ask Password when entering Setup
1458CFG_PasswordSystem db 0 ; Ask Password when booting System
1459CFG_PasswordChangeBoot db 0 ; Ask Password when changing boot partition
1460CFG_ProtectMBR db 0 ; Protect MBR via TSR ?
1461CFG_IgnoreWriteToMBR db 0 ; Just ignore writes to MBR, otherwise crash
1462CFG_FloppyBootGetName db 0 ; Gets floppy name for display purposes
1463CFG_DetectVirus db 0 ; Detect Virus ?
1464CFG_DetectStealth db 0 ; Detect Stealth-Virus ?
1465CFG_DetectVIBR db 0 ; Detect BootRecord-Virus ?
1466CFG_AutoEnterSetup db 0 ; Automatic Enter Setup (first install!)
1467CFG_MasterPassword dw 0101Fh ; Encoded Password (this is just CR)
1468 dw 07A53h
1469 dw 0E797h
1470 dw 0A896h
1471CFG_BootPassword dw 0101Fh ; Another CR... ;-)
1472 dw 07A53h
1473 dw 0E797h
1474 dw 0A896h
1475 db 0 ; Rude-Protection - Removed since v0.28b
1476CFG_LinuxRootPartition db 0 ; Linux Root Partition (Base=0)
1477CFG_TimedKeyHandling db 0 ; Timed Key Handling (for Timed Boot)
1478 ; 0 - Do Nothing
1479 ; 1 - Reset Time
1480 ; 2 - Stop Time
1481CFG_MakeSound db 0 ; Should be clear ;)
1482CFG_FloppyBootGetTimer db 0 ; Floppy Name will get updated every 2 secs
1483CFG_ResumeBIOSbootSeq db 0 ; If BIOS Boot Sequence should be resumed
1484 ; 0 - Disabled
1485 ; 1 - CD-ROM
1486 ; 2 - Network
1487 ; 3 - ZIP/LS120
1488CFG_CooperBars db 0 ; If Cooper Bars should be shown
1489CFG_LinuxCommandLine db 75 dup (0) ; Linux Command Line
1490CFG_LinuxKrnlPartition db 0FFh ; FAT-16 Linux Kernel Partition (Base=0)
1491 ; FFh -> Disabled
1492CFG_LinuxDefaultKernel db 'DEFAULT', 4 dup (32), 0 ; Default Kernel Name
1493CFG_LinuxLastKernel db 11 dup (32), 0 ; Last-Booted Kernel Name
1494CFG_ExtPartitionMShack db 0 ; Extended Partition M$-Hack Global Enable
1495CFG_AutomaticBoot db 0 ; Automatic Booting (only one bootup)
1496CFG_PartAutomatic db 0 ; Partition-No for automatic booting
1497CFG_ForceLBAUsage db 1 ; LBA-BIOS-API forced on any HDD I/O
1498CFG_IgnoreLVM db 0 ; Ignores any LVM-Information
1499
1500
1501;
1502; THERE IS ROOM RESERVED HERE FOR MORE VARIABLES
1503;
1504
1505 ;
1506 ; Drive Letters.
1507 ;
1508 ORIGIN 06CB0h
1509
1510
1511;
1512; Moved here to make room for packed hiddenparttable.
1513;
1514DriveLetters db LocIPT_MaxPartitions dup (0)
1515 ; Format is:
1516 ;============
1517 ; Drive-Letter : BYTE (80h-C:, 81h-D:)
1518 ; --------------------> 1 Byte * 45
1519
1520 ;
1521 ; Allways have the name of the installation volume
1522 ; at this offset.
1523 ; So future config changes will not break auto-install.
1524 ;
1525 ORIGIN 06D00h
1526
1527; SET(A)BOOT stores the volume name of the eCS system being installed here.
1528; It is truncated to 11 chars because AiR-BOOT currently does not support
1529; longer labelnames. The name is also capitalized.
1530;eCS_InstallVolume db 12 dup (0)
1531;eCS_InstallVolume db 'HIGHLOG' ,0
1532eCS_InstallVolume db 0,'NOPHASEONE' ,0
1533;eCS_InstallVolume db 'ECS-MIDDLE',0,0
1534;eCS_InstallVolume db 'ECS-HIGH',0,0,0,0
1535;eCS_InstallVolume db 'ECS-HIGH',0,'NO',0
1536
1537
1538;
1539; THERE IS ROOM RESERVED HERE FOR MORE VARIABLES
1540;
1541
1542 ;
1543 ; 06DABh - 06C00h = 01ABh = 427 bytes.
1544 ; Entries allocated down from 06E00 boundary.
1545 ;
1546 ORIGIN 06DABh ; 427 Boundry
1547
1548; (432 - 5 = 427)
1549AutoDrvLetter db 0
1550AutoDrvLetterSerial dd 0
1551
1552; This entry is also 34 bytes long (466 - 34 = 432)
1553BIOScontIPTentry:
1554 db 0, 0, 0, 0, ' '
1555 db 0, 0FEh, Flags_Bootable
1556 dw 0 ; No Checksum :)
1557 db 0, 1, 0
1558 db 0, 1, 0 ; Location of Partition/Boot Record
1559 dd 0, 0
1560
1561; VIR variables are for the AiR-BOOT Anti Virus Code
1562; Most of them are backups of Interrupt Points, so we can check, if a
1563; stealth virus is on-line, we can intercept its call.
1564; Normal (non stealth) virus are trapped simply by rereading the MBR sector.
1565; If a virus is found, we will restore MBR from Sektor 60/62 and stop the
1566; system from working, so the user has to press reset.
1567; That's saver than a Reboot.
1568;
1569; If a virus is found on the partition to boot, the system will ONLY halt,
1570; nothing more, because we can not remove it. The user shall do it :)
1571; Those viruses are detected via a real nasty method...Checksum-Checking of the
1572; boot-record, which is to be executed. If it does not match the one in our
1573; internal partition table, we will stop. You may however switch this detection
1574; off or just reset it by switching 'VIBR Detection'.
1575
1576; 478 - 12 = 466 ; 466 Sub-Part
1577CFG_VIR_INT08 dd 0 ; pointer to saved 08h entry point
1578CFG_VIR_INT13 dd 0 ; pointer to saved 13h entry point
1579CFG_VIR_INT1C dd 0 ; pointer to saved 1Ch entry point
1580
1581; 478 Boundry (512-34)
1582; This entry is also 34 bytes long
1583FloppyIPTentry db 0, 0, 0, 0, 'FloppyDrive'
1584 db 0, 0FFh, Flags_Bootable
1585 dw 0 ; No Checksum :)
1586 db 0, 1, 0
1587 db 0, 1, 0 ; Location of Partition/Boot Record
1588 dd 0, 0
1589;------------------------------------------------------------------------------
1590
1591 ;org 06E00h ; Sector 56-57
1592
1593 ;
1594 ; AiR-BOOT Internal Partition Table (IPT)
1595 ;
1596 ORIGIN % (image_size - 0a00h - (image_size - image_size_60secs))
1597
1598
1599;
1600; Rousseau: This is the start of the AiR-BOOT IPT
1601;
1602
1603
1604PartitionTable db (LocIPT_MaxPartitions * LocIPT_LenOfIPT) dup (0)
1605; no-partitions detected... :]
1606; db 1, 0, 0, 0, 'Harddisc 1'
1607; db 0, 0FFh, Flags_BootAble
1608; dw 0 ; No Checksum :)
1609; db 0, 0, 1
1610; db 0, 0, 1 ; Location of Partition/Boot Record
1611; dd 0, 0
1612
1613 ; Format is:
1614 ;============
1615 ; SerialNumber * 4
1616 ; PartitionName * 11
1617 ; Drive * 1
1618 ; SystemID * 1 (means the partition type)
1619 ; Flags * 1
1620 ; Checksum * 2 (for virus checking)
1621 ; LocationBegin * 3 (where the partition begins)
1622 ; LocationPartTab * 3 (where the partition table is)
1623 ; AbsoluteBegin * 4 (where the partition begins, in absolute sectors)
1624 ; AbsolutePartTab * 4 (where the partition table is, in absolute sectors)
1625 ; --------------------> 34 Bytes (total maximum partition-entries = 30)
1626
1627
1628
1629 ; No need to check overlap here because this string will
1630 ; be overwritten if the maximum partition count is reached.
1631 ; So this is not a critical boundary.
1632 ORG (image_size - 600h - (image_size - image_size_60secs) / 2 - 10)
1633
1634 db 'AiRBOOTPAR' ; 1K internal partition table
1635
1636
1637;------------------------------------------------------------------------------
1638 ;org 07400h ; Sector 58
1639
1640
1641 ;
1642 ; Hidden Partition Table (6-bit packed as of v1.0.8)
1643 ;
1644 ORIGIN % (image_size - 600h - (image_size - image_size_60secs) / 2)
1645
1646HidePartitionTable db (LocIPT_MaxPartitions * LocHPT_LenOfHPT) dup (0FFh)
1647 ; Format is:
1648 ;============
1649 ; PartitionPtr : BYTE * 30
1650 ; --------------------> 30 Bytes * 45
1651
1652;
1653; Driveletters were here.
1654; Moved down to make room for packed hideparttable.
1655;
1656
1657
1658 ;
1659 ; End of hidden partition table.
1660 ; Check overlap here for security reasons.
1661 ;
1662 ORIGIN % (image_size - 200h - 5)
1663
1664; 79fa - end of packed hide table
1665 db 'ABHID' ; 1K internal Hide-partition table
1666
1667
1668
1669
1670;------------------------------------------------------------------------------
1671 ;org 07A00h
1672 ; Sector 60
1673
1674 ;
1675 ; AiR-BOOT MBR Backup.
1676 ;
1677 ORIGIN % (image_size - 200h)
1678
1679
1680MBR_BackUpMBR db 'AiR-BOOT MBR-BackUp',\
1681 ' - Just to fill this sector with something',0
1682AirBootRocks db 'AiR-BOOT Rocks!',0
1683
1684 db (512 - ($-MBR_BackUpMBR) - 2) dup('M')
1685
1686 ; End of Image signature.
1687 ;
1688 ORIGIN % (image_size - 2)
1689 dw 0BABEh
1690
1691
1692 ;
1693 ; End of Image.
1694 ;
1695 ORIGIN % (image_size)
1696
1697
1698IFDEF SEGMENTED
1699;
1700; End of AiR-BOOT code and data.
1701;
1702
1703LDRIMAGE ENDS
1704
1705;DATA_SEG ENDS
1706
1707;
1708; Uninitialized Data (BSS)
1709;
1710VOLATILE SEGMENT USE16 PUBLIC 'BSS'
1711
1712ENDIF
1713
1714
1715
1716sobss:
1717;------------------------------------------------------------------------------
1718
1719 ;
1720 ; Removed ORG for BSS data to be more compatible
1721 ; with segment-concatenated layout.
1722 ;
1723 ; What happens before this space ??
1724 ; If org 0 corruption occurs.
1725 ;
1726
1727 ;
1728 ; Filling hiddenparttable goes out-of-bounds !
1729 ; Fixed with 6-bit packing.
1730 ;
1731
1732;
1733; If segmented, offsets are relative to the BSS segment.
1734; They are resolved at link-time.
1735; If not segmented, offsets are relative to the CODE segment.
1736;
1737IFDEF SEGMENTED
1738 ORG 02400h
1739ELSE
1740 ORG 0A000h
1741ENDIF
1742
1743
1744; This space actually gets initialized in PreCrap to NUL (till EndOfVariables)
1745BeginOfVariables:
1746PartitionSector db 512 dup (?) ; Temporary Sector for Partition
1747JfsPBR db 512 dup (?) ; Temporary Sector for JFS PBR writeback
1748LVMSector db 512 dup (?) ; Temporary Sector for LVM
1749TmpSector db 512 dup (?) ; Temporary Sector
1750Scratch db 256 dup (?) ; Scratch buffer
1751
1752; Everything used to build a new IPT and reference it to the old one
1753; IETS OVERSCHRIJFT DIT !!
1754NewPartTable db 1536 dup (?) ; New Partition Table
1755
1756; New Hide-Partition Table
1757NewHidePartTable db partition_count * LocHPT_LenOfHPT dup (?)
1758
1759; Logical Drive-Letters
1760NewDriveLetters db partition_count dup (?)
1761
1762; Size-Table (6 bytes per partition)
1763PartitionSizeTable db partition_count * 6 dup (?)
1764
1765; Maximum is 52 entries till now
1766PartitionPointers dw 52 dup (?)
1767
1768; Count of total Partition Pointers
1769PartitionPointerCount db ?
1770
1771; X-Reference Table (holds new partnr, index is old part nr)
1772PartitionXref db partition_count dup (?)
1773
1774; Volume-Letters
1775; 0 - no LVM support
1776; 1 - LVM support, but no letter
1777; 'C'-'Z' - assigned drive letter
1778PartitionVolumeLetters db partition_count dup (?)
1779
1780
1781
1782
1783TotalHarddiscs db ? ; Total harddrives (by POST)
1784LBASwitchTable db 128 dup (?) ; Bit 25-18 for CHS/LBA Switching
1785NewPartitions db ? ; Freshly found partitions
1786 ; Independent of SaveConfiguration
1787TooManyPartitions db ? ; Non-zero if too many partitions found
1788
1789VideoIO_Segment dw ? ; Segment for Video I/O
1790
1791ExtendedAbsPos dd ? ; Extended Partition Absolute Position
1792ExtendedAbsPosSet db ? ; If Absolute Position set
1793
1794CurPartition_Location dw 4 dup (?) ; Where did current partition come from?
1795CurIO_UseExtension db ? ; 1-Use INT 13h EXTENSIONS
1796 ; (filled out by PreCrap)
1797CurIO_Scanning db ? ; 1-AiR-BOOT is scanning partitions
1798 ; (for detailed error message)
1799
1800; [Linux support removed since v1.02]
1801;GotLinux db ? ; 1-Linux found
1802
1803Menu_EntrySelected db ? ; Which partition we boot this time...
1804Menu_UpperPart db ? ; Which number (Base=0) is the partition upper pos
1805Menu_AbsoluteX db ? ; Pos where Menu stuff starts
1806Menu_TotalParts db ? ; Copy of CFG_BootParts
1807Menu_TotalLines db ? ; Total Lines on Screen used for BootMenu
1808Menu_EntryDefault db ? ; Default Entry in filtered View
1809Menu_EntryLast db ? ; LastBooted Entry in filtered View
1810Menu_EntryAutomatic db ? ; Automatic Entry in filtered View
1811 ; - All adjusted to menu locations
1812
1813PartSetup_UpperPart db ? ; Partition-Setup (like Menu_UpperPart)
1814PartSetup_ActivePart db ? ; Active Partition
1815PartSetup_HiddenUpper db ? ; (like Menu_UpperPart)
1816PartSetup_HiddenX db ? ; Pos for Hidden-Setup
1817PartSetup_HiddenAdd db ? ; Adjust for Hidden-Setup
1818
1819TimedBootEnable db ? ; Local Enable/Disable for timed boot
1820TimedTimeOut dd ? ; TimeOut Timer for TimedBoot (too much time here;)
1821TimedSecondLeft db ? ; How many seconds are left till boom ?
1822TimedSecondBack db ? ; To get a modification noticed
1823TimedBootUsed db ? ; Timed Boot used for bootup ?
1824FloppyGetNameTimer dd ? ; Timer for Floppy-Get-Name
1825SETUP_KeysOnEntry db ? ; which Shift Status was there, when booting ?
1826SETUP_ExitEvent db ? ; Exit Event to end SETUP
1827TempPasswordEntry db 17 dup (?)
1828SETUP_OldPwd db 17 dup (?)
1829SETUP_NewPwd db 17 dup (?)
1830SETUP_VerifyPwd db 17 dup (?)
1831StartSoundPlayed db ?
1832ChangePartNameSave db ? ; Save label after user-edit ?
1833SyncLvmLabels db ? ; Sync LVM labels after user-edit ?
1834
1835FX_UseCount dw ?
1836FX_OverallTimer dw ?
1837FX_WideScrollerTimer dw ?
1838FX_WideScrollerCurPos dw ?
1839FX_WideScrollerSpeed db ?
1840FX_WideScrollerSpeedState db ?
1841FX_WideScrollerDirection db ?
1842FX_WideScrollerAbsDirection db ?
1843FX_WideScrollerBounceSpeed db ?
1844FX_CooperBarsTimer dw ?
1845
1846;~ ; [Linux support removed since v1.02]
1847;~ FAT16_Drive db ? ; FAT-16: Drive of FAT16-partition
1848;~ FAT16_AbsPartitionBegin dd ? ; FAT-16: LBA Begin of Partition
1849;~ FAT16_SecsPerCluster db ? ; FAT-16: Sectors Per Cluster
1850;~ FAT16_NumOfRootEntries dw ? ; FAT-16: Number of Root Entries
1851;~ FAT16_SecsPerFAT dw ? ; FAT-16: Sectors Per FAT
1852;~ FAT16_AbsFATBegin dd ? ; FAT-16: LBA Begin of FAT
1853;~ FAT16_AbsRootBegin dd ? ; FAT-16: LBA Begin of Root
1854;~ FAT16_AbsClusterBegin dd ? ; FAT-16: LBA Begin of Clusters
1855;~ FAT16_FATCacheSector db ? ; FAT-16: FAT-Sector No in Cache
1856;~ FAT16_FATCache db 512 dup (?) ; FAT-16: FAT-Area Cache
1857;~ LINUX_KernelEntries db 680 dup (?) ; 34*20 -> Space for Kernel-Entries
1858;~ LINUX_KernelNo db ? ; Total of Kernels in KernelEntries
1859;~ LINUX_KernelSizeTable db 120 dup (?) ; Size-Table (6 bytes per kernel)
1860
1861; Dynamically Generated Tables - do not need to get initialized with NUL
1862FX_CooperColors db 672 dup (?) ; 7 cooper bars*96 - runtime calculated
1863FX_CooperState db 7 dup (?)
1864FX_SinusPos db 7 dup (?)
1865FX_CooperPos dw 7 dup (?)
1866CharsetTempBuffer db 4096 dup (?) ; Uninitialized Charset buffer
1867LVM_CRCTable dd 256 dup (?) ; LVM-CRC (->SPECiAL\LVM.asm)
1868
1869
1870
1871
1872;
1873; Rousseau: added some stuff.
1874;
1875
1876
1877 ;EVEN
1878HugeDisk db MaxDisks dup(?)
1879TrueSecs dd MaxDisks dup(?)
1880
1881; BIOS geometry of the boot-drive
1882; Note that heads cannot be 256 due to legacy DOS/BIOS bug
1883; If Int13X is supported those values are used, otherwise the legacy values.
1884BIOS_Cyls dd MaxDisks dup(?)
1885BIOS_Heads dd MaxDisks dup(?)
1886BIOS_Secs dd MaxDisks dup(?)
1887BIOS_Bytes dw MaxDisks dup(?)
1888BIOS_TotalSecs dq MaxDisks dup(?)
1889
1890; LBA geometry of the boot-drive
1891; Note that these values are taken from the BPB of a partition boot-record
1892LVM_Cyls dd MaxDisks dup(?)
1893LVM_Heads dd MaxDisks dup(?)
1894LVM_Secs dd MaxDisks dup(?)
1895LVM_Bytes dw MaxDisks dup(?)
1896LVM_TotalSecs dq MaxDisks dup(?)
1897
1898; OS/2 geometry of the boot-drive
1899; Note that these values are taken from the BPB of a partition boot-record
1900LOG_Cyls dd MaxDisks dup(?)
1901LOG_Heads dd MaxDisks dup(?)
1902LOG_Secs dd MaxDisks dup(?)
1903LOG_Bytes dw MaxDisks dup(?)
1904LOG_TotalSecs dq MaxDisks dup(?)
1905
1906; End of transient variables.
1907EndOfVariables:
1908
1909
1910;
1911; Temporary buffer for 48h INT13X bios call.
1912;
1913
1914 ; Size of the buffer.
1915 ; this param *must* be filled in.
1916 ; Code inserts it.
1917i13xbuf dw 1 dup (?)
1918
1919 ; The buffer itself.
1920 db 126 dup(?)
1921
1922 ; Size of buffer calculated.
1923 ; (excluding the size word at the start).
1924 i13xbuf_size = $-offset i13xbuf-2
1925
1926 ; Some debug area.
1927ott db 512 dup(?)
1928
1929eobss:
1930
1931IFDEF SEGMENTED
1932 VOLATILE ENDS
1933ELSE
1934 LDRIMAGE ENDS
1935ENDIF
1936
1937 END AiR_BOOT
1938
Note: See TracBrowser for help on using the repository browser.