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

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

Fixed Installer to handle packed hideparttable [2012-04-23]

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 Installer can now handle packed hideparttable
o Implemented upgrading from v1.06 directly to v1.0.8
o Fixed minor stuff when upgrading from v1.06 to v1.07
o Implemented DOS code in C cross-platform installer

There is now one C source for 4 platforms:
DOS,WIN32,OS2 and LINUX (Linux portion not ready yet)
This obsoletes AIRBOOT.ASM/AIRBOOT.COM.
DOS Installer is now AIRBOOTD.EXE.

o This commit is prepairing for v1.0.8-rc2

File size: 70.0 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 ; Should always be in the image, otherwise something
1319 ; is very wrong.
1320 ;
1321 db 'DEAD'
1322 db 'FACE'
1323
1324;
1325; Keep these modules here at the end of the code section.
1326; When debugging, extra code space is used and code will move up towards
1327; the protection image that is 'orged' and will thus overlay.
1328; The effects are turned off in debug mode, so it does not matter much that
1329; this code get's lost.
1330;
1331b_sound:
1332Include SPECIAL/SOUND.ASM ; Sound
1333size_sound = $-b_sound
1334
1335b_apm:
1336Include SPECIAL/APM.ASM ; Power Managment Support
1337size_apm = $-b_apm
1338
1339b_fx:
1340Include SPECIAL/FX.ASM ; l33t Cooper-Bars/Scrolling <bg>
1341size_fx = $-b_fx
1342
1343
1344; If we are debugging, we overwrite the FX code.
1345; As long as FX is disabled this will do no harm.
1346IFDEF AUX_DEBUG
1347 ORG 06780h
1348ENDIF
1349
1350
1351bld_level:
1352 ;
1353 ; Here we insert the OS/2 BLDLEVEL Information.
1354 ; It is composed of the AiR-BOOT version-info and other
1355 ; information.
1356 ; It is unique for each release of AiR-BOOT.
1357 ;
1358 ; ?? When AUX_DEBUG is enabled and the above org is active,
1359 ; the BLDLEVEL gets corrupted eventhough it gets inserted here
1360 ; explicitly. The effect is almost like an 'OR' or a merge
1361 ; with the already generated FX code.
1362 ; Tasm and JWasm produce different results.
1363 ; ??
1364 ;
1365 InsertBuildLevel
1366
1367 ;bliep <>
1368
1369 ;
1370 ; End of code marker.
1371 ; If this one vanishes in the image, the FX code will not
1372 ; be operational.
1373 ; Will happen with debugging enabled.
1374 ;
1375 db 'BABE'
1376 db 'FACE'
1377
1378code_end:
1379
1380
1381 ;
1382 ; AiR-BOOT Protection Image.
1383 ; Moved from below to have it not break the included modules
1384 ; with it's sector alignment requirement.
1385 ;
1386 ORIGIN 06800h
1387
1388zzz_code_space = $ - code_end
1389 ;
1390 ; This is the AiR-BOOT MBR-Protection Image.
1391 ; 06800 / 200h = 34h = 52d sectors are before this point.
1392 ; The stuff generated here gets overwritten when the
1393 ; MBR_PROT.ASM module, which is assembled separately,
1394 ; gets merged.
1395 ; So you won't find the string below in the generated binary.
1396 ;
1397
1398 ; 06800-068FF
1399 ; 06900-069FF
1400 ; 06A00-06AFF
1401 ; 06B00-06BFF
1402
1403;
1404; Hardcoded to 1k (1024 bytes) (MBR_PROT.ASM)
1405; The string below is searched for by the FIXCODE helper and *must* be
1406; sector (512-bytes) aligned.
1407;
1408MBR_Protection db 'AiR-BOOT MBR-Protection Image'
1409
1410 ; Just fill.
1411 db 1024-($-MBR_Protection) dup('M')
1412
1413
1414;==============================================================================
1415 ; Sector 55
1416
1417 ;
1418 ; This section contains the AiR-BOOT configuration.
1419 ; Note that it has a version that should be updated
1420 ; when stuff is added.
1421 ; Also add stuff to the end so that offsets of other
1422 ; variables remain vaild.
1423 ;
1424 ORIGIN 06C00h
1425
1426Configuration:
1427 ; THERE IS A NON-ASCII CHAR HERE !!
1428 ; Your editor may not display this non-ASCII
1429 ; character at the end if the 'AiRCFG-TABLE'
1430 ; string. When this character get's deleted,
1431 ; AiR-BOOT will not function because it cannot
1432 ; find the config-signature which includes this
1433 ; invisible character. The code of the char is: 0x0ad.
1434 db 'AiRCFG-TABLE­'
1435 db 01h, 08h, 'U' ; "Compressed" ID String
1436 ; Version 1.02 was for code 1.06, 1.03 was internal
1437 ; and 1.04,1.05 and 1.06 do not exist.
1438 ;
1439 ; 1.07 was used with AB v1.07 and introduced the phase1
1440 ; system-name. For the rest it is compatible with v1.02.
1441 ;
1442 ; 1.0.8 is introduced with AB v1.0.8 and indicates the movement
1443 ; of several components and the packing of the hideparttable.
1444 ; The core configuration has not changed but the generated
1445 ; configuration has. The v1.0.8 installer handles upgrading.
1446 ;
1447 ; It is not required for the config to have the
1448 ; same version as the code, so in the future
1449 ; the code version might be higher than the
1450 ; config version if there are no changes to the latter.
1451 ;
1452
1453CFG_LastTimeEditLow dw 0 ; Last Time Edited Stamp (will incr every setup)
1454CFG_LastTimeEditHi dw 0 ; second 16 bit part...
1455
1456CFG_CheckConfig dw 0 ; Check-Sum for Configuration
1457
1458CFG_Partitions db 0 ; Count of partitions in IPT
1459 db 0 ; Was BootParts - Removed since v0.28b
1460CFG_PartDefault db 0 ; Default-Partition (Base=0)
1461
1462CFG_PartLast db 0 ; Which Partition was booted last time ? (Base=0)
1463CFG_TimedBoot db 0 ; Timed Boot Enable (for REAL Enable look TimedBootEnable)
1464CFG_TimedSecs db 15 ; Timed Boot - How Many Seconds Till Boot
1465CFG_TimedDelay dw 123 ; Timed Boot - Delay
1466CFG_TimedBootLast db 1 ; Timed Boot - Boot From Last Drive Booted From
1467CFG_RememberBoot db 1 ; Remember Manual Boot Choice
1468CFG_RememberTimed db 0 ; Remember if Timed Boot (if both disabled: Boot Default)
1469CFG_IncludeFloppy db 1 ; Include Floppy Drives in Boot-Menu
1470CFG_BootMenuActive db 1 ; Display Boot-Menu (if Disabled: Boot Default)
1471 ; v0.29+ -> 2 - Detailed Bootmenu
1472CFG_PartitionsDetect db 1 ; Autodetect New Partitions (Auto-Add!)
1473CFG_PasswordSetup db 0 ; Ask Password when entering Setup
1474CFG_PasswordSystem db 0 ; Ask Password when booting System
1475CFG_PasswordChangeBoot db 0 ; Ask Password when changing boot partition
1476CFG_ProtectMBR db 0 ; Protect MBR via TSR ?
1477CFG_IgnoreWriteToMBR db 0 ; Just ignore writes to MBR, otherwise crash
1478CFG_FloppyBootGetName db 0 ; Gets floppy name for display purposes
1479CFG_DetectVirus db 0 ; Detect Virus ?
1480CFG_DetectStealth db 0 ; Detect Stealth-Virus ?
1481CFG_DetectVIBR db 0 ; Detect BootRecord-Virus ?
1482CFG_AutoEnterSetup db 0 ; Automatic Enter Setup (first install!)
1483CFG_MasterPassword dw 0101Fh ; Encoded Password (this is just CR)
1484 dw 07A53h
1485 dw 0E797h
1486 dw 0A896h
1487CFG_BootPassword dw 0101Fh ; Another CR... ;-)
1488 dw 07A53h
1489 dw 0E797h
1490 dw 0A896h
1491 db 0 ; Rude-Protection - Removed since v0.28b
1492CFG_LinuxRootPartition db 0 ; Linux Root Partition (Base=0)
1493CFG_TimedKeyHandling db 0 ; Timed Key Handling (for Timed Boot)
1494 ; 0 - Do Nothing
1495 ; 1 - Reset Time
1496 ; 2 - Stop Time
1497CFG_MakeSound db 0 ; Should be clear ;)
1498CFG_FloppyBootGetTimer db 0 ; Floppy Name will get updated every 2 secs
1499CFG_ResumeBIOSbootSeq db 0 ; If BIOS Boot Sequence should be resumed
1500 ; 0 - Disabled
1501 ; 1 - CD-ROM
1502 ; 2 - Network
1503 ; 3 - ZIP/LS120
1504CFG_CooperBars db 0 ; If Cooper Bars should be shown
1505CFG_LinuxCommandLine db 75 dup (0) ; Linux Command Line
1506CFG_LinuxKrnlPartition db 0FFh ; FAT-16 Linux Kernel Partition (Base=0)
1507 ; FFh -> Disabled
1508CFG_LinuxDefaultKernel db 'DEFAULT', 4 dup (32), 0 ; Default Kernel Name
1509CFG_LinuxLastKernel db 11 dup (32), 0 ; Last-Booted Kernel Name
1510CFG_ExtPartitionMShack db 0 ; Extended Partition M$-Hack Global Enable
1511CFG_AutomaticBoot db 0 ; Automatic Booting (only one bootup)
1512CFG_PartAutomatic db 0 ; Partition-No for automatic booting
1513CFG_ForceLBAUsage db 1 ; LBA-BIOS-API forced on any HDD I/O
1514CFG_IgnoreLVM db 0 ; Ignores any LVM-Information
1515
1516
1517;
1518; THERE IS ROOM RESERVED HERE FOR MORE VARIABLES
1519;
1520
1521 ;
1522 ; Drive Letters.
1523 ;
1524 ORIGIN 06CB0h
1525
1526
1527;
1528; Moved here to make room for packed hiddenparttable.
1529;
1530DriveLetters db LocIPT_MaxPartitions dup (0)
1531 ; Format is:
1532 ;============
1533 ; Drive-Letter : BYTE (80h-C:, 81h-D:)
1534 ; --------------------> 1 Byte * 45
1535
1536 ;
1537 ; Allways have the name of the installation volume
1538 ; at this offset.
1539 ; So future config changes will not break auto-install.
1540 ;
1541 ORIGIN 06D00h
1542
1543; SET(A)BOOT stores the volume name of the eCS system being installed here.
1544; It is truncated to 11 chars because AiR-BOOT currently does not support
1545; longer labelnames. The name is also capitalized.
1546;eCS_InstallVolume db 12 dup (0)
1547;eCS_InstallVolume db 'HIGHLOG' ,0
1548eCS_InstallVolume db 0,'NOPHASEONE' ,0
1549;eCS_InstallVolume db 'ECS-MIDDLE',0,0
1550;eCS_InstallVolume db 'ECS-HIGH',0,0,0,0
1551;eCS_InstallVolume db 'ECS-HIGH',0,'NO',0
1552
1553
1554;
1555; THERE IS ROOM RESERVED HERE FOR MORE VARIABLES
1556;
1557
1558 ;
1559 ; 06DABh - 06C00h = 01ABh = 427 bytes.
1560 ; Entries allocated down from 06E00 boundary.
1561 ;
1562 ORIGIN 06DABh ; 427 Boundry
1563
1564; (432 - 5 = 427)
1565AutoDrvLetter db 0
1566AutoDrvLetterSerial dd 0
1567
1568; This entry is also 34 bytes long (466 - 34 = 432)
1569BIOScontIPTentry:
1570 db 0, 0, 0, 0, ' '
1571 db 0, 0FEh, Flags_Bootable
1572 dw 0 ; No Checksum :)
1573 db 0, 1, 0
1574 db 0, 1, 0 ; Location of Partition/Boot Record
1575 dd 0, 0
1576
1577; VIR variables are for the AiR-BOOT Anti Virus Code
1578; Most of them are backups of Interrupt Points, so we can check, if a
1579; stealth virus is on-line, we can intercept its call.
1580; Normal (non stealth) virus are trapped simply by rereading the MBR sector.
1581; If a virus is found, we will restore MBR from Sektor 60/62 and stop the
1582; system from working, so the user has to press reset.
1583; That's saver than a Reboot.
1584;
1585; If a virus is found on the partition to boot, the system will ONLY halt,
1586; nothing more, because we can not remove it. The user shall do it :)
1587; Those viruses are detected via a real nasty method...Checksum-Checking of the
1588; boot-record, which is to be executed. If it does not match the one in our
1589; internal partition table, we will stop. You may however switch this detection
1590; off or just reset it by switching 'VIBR Detection'.
1591
1592; 478 - 12 = 466 ; 466 Sub-Part
1593CFG_VIR_INT08 dd 0 ; pointer to saved 08h entry point
1594CFG_VIR_INT13 dd 0 ; pointer to saved 13h entry point
1595CFG_VIR_INT1C dd 0 ; pointer to saved 1Ch entry point
1596
1597; 478 Boundry (512-34)
1598; This entry is also 34 bytes long
1599FloppyIPTentry db 0, 0, 0, 0, 'FloppyDrive'
1600 db 0, 0FFh, Flags_Bootable
1601 dw 0 ; No Checksum :)
1602 db 0, 1, 0
1603 db 0, 1, 0 ; Location of Partition/Boot Record
1604 dd 0, 0
1605;------------------------------------------------------------------------------
1606
1607 ;org 06E00h ; Sector 56-57
1608
1609 ;
1610 ; AiR-BOOT Internal Partition Table (IPT)
1611 ;
1612 ORIGIN % (image_size - 0a00h - (image_size - image_size_60secs))
1613
1614
1615;
1616; Rousseau: This is the start of the AiR-BOOT IPT
1617;
1618
1619
1620PartitionTable db (LocIPT_MaxPartitions * LocIPT_LenOfIPT) dup (0)
1621; no-partitions detected... :]
1622; db 1, 0, 0, 0, 'Harddisc 1'
1623; db 0, 0FFh, Flags_BootAble
1624; dw 0 ; No Checksum :)
1625; db 0, 0, 1
1626; db 0, 0, 1 ; Location of Partition/Boot Record
1627; dd 0, 0
1628
1629 ; Format is:
1630 ;============
1631 ; SerialNumber * 4
1632 ; PartitionName * 11
1633 ; Drive * 1
1634 ; SystemID * 1 (means the partition type)
1635 ; Flags * 1
1636 ; Checksum * 2 (for virus checking)
1637 ; LocationBegin * 3 (where the partition begins)
1638 ; LocationPartTab * 3 (where the partition table is)
1639 ; AbsoluteBegin * 4 (where the partition begins, in absolute sectors)
1640 ; AbsolutePartTab * 4 (where the partition table is, in absolute sectors)
1641 ; --------------------> 34 Bytes (total maximum partition-entries = 30)
1642
1643
1644
1645 ; No need to check overlap here because this string will
1646 ; be overwritten if the maximum partition count is reached.
1647 ; So this is not a critical boundary.
1648 ORG (image_size - 600h - (image_size - image_size_60secs) / 2 - 10)
1649
1650 db 'AiRBOOTPAR' ; 1K internal partition table
1651
1652
1653;------------------------------------------------------------------------------
1654 ;org 07400h ; Sector 58
1655
1656
1657 ;
1658 ; Hidden Partition Table (6-bit packed as of v1.0.8)
1659 ;
1660 ORIGIN % (image_size - 600h - (image_size - image_size_60secs) / 2)
1661
1662HidePartitionTable db (LocIPT_MaxPartitions * LocHPT_LenOfHPT) dup (0FFh)
1663 ; Format is:
1664 ;============
1665 ; PartitionPtr : BYTE * 30
1666 ; --------------------> 30 Bytes * 45
1667
1668;
1669; Driveletters were here.
1670; Moved down to make room for packed hideparttable.
1671;
1672
1673
1674 ;
1675 ; End of hidden partition table.
1676 ; Check overlap here for security reasons.
1677 ;
1678 ORIGIN % (image_size - 200h - 5)
1679
1680; 79fa - end of packed hide table
1681 db 'ABHID' ; 1K internal Hide-partition table
1682
1683
1684
1685
1686;------------------------------------------------------------------------------
1687 ;org 07A00h
1688 ; Sector 60
1689
1690 ;
1691 ; AiR-BOOT MBR Backup.
1692 ;
1693 ORIGIN % (image_size - 200h)
1694
1695
1696MBR_BackUpMBR db 'AiR-BOOT MBR-BackUp',\
1697 ' - Just to fill this sector with something',0
1698AirBootRocks db 'AiR-BOOT Rocks!',0
1699
1700 db (512 - ($-MBR_BackUpMBR) - 2) dup('M')
1701
1702 ; End of Image signature.
1703 ;
1704 ORIGIN % (image_size - 2)
1705 dw 0BABEh
1706
1707
1708 ;
1709 ; End of Image.
1710 ;
1711 ORIGIN % (image_size)
1712
1713
1714IFDEF SEGMENTED
1715;
1716; End of AiR-BOOT code and data.
1717;
1718
1719LDRIMAGE ENDS
1720
1721;DATA_SEG ENDS
1722
1723;
1724; Uninitialized Data (BSS)
1725;
1726VOLATILE SEGMENT USE16 PUBLIC 'BSS'
1727
1728ENDIF
1729
1730
1731
1732sobss:
1733;------------------------------------------------------------------------------
1734
1735 ;
1736 ; Removed ORG for BSS data to be more compatible
1737 ; with segment-concatenated layout.
1738 ;
1739 ; What happens before this space ??
1740 ; If org 0 corruption occurs.
1741 ;
1742
1743 ;
1744 ; Filling hiddenparttable goes out-of-bounds !
1745 ; Fixed with 6-bit packing.
1746 ;
1747
1748;
1749; If segmented, offsets are relative to the BSS segment.
1750; They are resolved at link-time.
1751; If not segmented, offsets are relative to the CODE segment.
1752;
1753IFDEF SEGMENTED
1754 ORG 02400h
1755ELSE
1756 ORG 0A000h
1757ENDIF
1758
1759
1760; This space actually gets initialized in PreCrap to NUL (till EndOfVariables)
1761BeginOfVariables:
1762PartitionSector db 512 dup (?) ; Temporary Sector for Partition
1763JfsPBR db 512 dup (?) ; Temporary Sector for JFS PBR writeback
1764LVMSector db 512 dup (?) ; Temporary Sector for LVM
1765TmpSector db 512 dup (?) ; Temporary Sector
1766Scratch db 256 dup (?) ; Scratch buffer
1767
1768; Everything used to build a new IPT and reference it to the old one
1769; IETS OVERSCHRIJFT DIT !!
1770NewPartTable db 1536 dup (?) ; New Partition Table
1771
1772; New Hide-Partition Table
1773NewHidePartTable db partition_count * LocHPT_LenOfHPT dup (?)
1774
1775; Logical Drive-Letters
1776NewDriveLetters db partition_count dup (?)
1777
1778; Size-Table (6 bytes per partition)
1779PartitionSizeTable db partition_count * 6 dup (?)
1780
1781; Maximum is 52 entries till now
1782PartitionPointers dw 52 dup (?)
1783
1784; Count of total Partition Pointers
1785PartitionPointerCount db ?
1786
1787; X-Reference Table (holds new partnr, index is old part nr)
1788PartitionXref db partition_count dup (?)
1789
1790; Volume-Letters
1791; 0 - no LVM support
1792; 1 - LVM support, but no letter
1793; 'C'-'Z' - assigned drive letter
1794PartitionVolumeLetters db partition_count dup (?)
1795
1796
1797
1798
1799TotalHarddiscs db ? ; Total harddrives (by POST)
1800LBASwitchTable db 128 dup (?) ; Bit 25-18 for CHS/LBA Switching
1801NewPartitions db ? ; Freshly found partitions
1802 ; Independent of SaveConfiguration
1803TooManyPartitions db ? ; Non-zero if too many partitions found
1804
1805VideoIO_Segment dw ? ; Segment for Video I/O
1806
1807ExtendedAbsPos dd ? ; Extended Partition Absolute Position
1808ExtendedAbsPosSet db ? ; If Absolute Position set
1809
1810CurPartition_Location dw 4 dup (?) ; Where did current partition come from?
1811CurIO_UseExtension db ? ; 1-Use INT 13h EXTENSIONS
1812 ; (filled out by PreCrap)
1813CurIO_Scanning db ? ; 1-AiR-BOOT is scanning partitions
1814 ; (for detailed error message)
1815
1816; [Linux support removed since v1.02]
1817;GotLinux db ? ; 1-Linux found
1818
1819Menu_EntrySelected db ? ; Which partition we boot this time...
1820Menu_UpperPart db ? ; Which number (Base=0) is the partition upper pos
1821Menu_AbsoluteX db ? ; Pos where Menu stuff starts
1822Menu_TotalParts db ? ; Copy of CFG_BootParts
1823Menu_TotalLines db ? ; Total Lines on Screen used for BootMenu
1824Menu_EntryDefault db ? ; Default Entry in filtered View
1825Menu_EntryLast db ? ; LastBooted Entry in filtered View
1826Menu_EntryAutomatic db ? ; Automatic Entry in filtered View
1827 ; - All adjusted to menu locations
1828
1829PartSetup_UpperPart db ? ; Partition-Setup (like Menu_UpperPart)
1830PartSetup_ActivePart db ? ; Active Partition
1831PartSetup_HiddenUpper db ? ; (like Menu_UpperPart)
1832PartSetup_HiddenX db ? ; Pos for Hidden-Setup
1833PartSetup_HiddenAdd db ? ; Adjust for Hidden-Setup
1834
1835TimedBootEnable db ? ; Local Enable/Disable for timed boot
1836TimedTimeOut dd ? ; TimeOut Timer for TimedBoot (too much time here;)
1837TimedSecondLeft db ? ; How many seconds are left till boom ?
1838TimedSecondBack db ? ; To get a modification noticed
1839TimedBootUsed db ? ; Timed Boot used for bootup ?
1840FloppyGetNameTimer dd ? ; Timer for Floppy-Get-Name
1841SETUP_KeysOnEntry db ? ; which Shift Status was there, when booting ?
1842SETUP_ExitEvent db ? ; Exit Event to end SETUP
1843TempPasswordEntry db 17 dup (?)
1844SETUP_OldPwd db 17 dup (?)
1845SETUP_NewPwd db 17 dup (?)
1846SETUP_VerifyPwd db 17 dup (?)
1847StartSoundPlayed db ?
1848ChangePartNameSave db ? ; Save label after user-edit ?
1849SyncLvmLabels db ? ; Sync LVM labels after user-edit ?
1850
1851FX_UseCount dw ?
1852FX_OverallTimer dw ?
1853FX_WideScrollerTimer dw ?
1854FX_WideScrollerCurPos dw ?
1855FX_WideScrollerSpeed db ?
1856FX_WideScrollerSpeedState db ?
1857FX_WideScrollerDirection db ?
1858FX_WideScrollerAbsDirection db ?
1859FX_WideScrollerBounceSpeed db ?
1860FX_CooperBarsTimer dw ?
1861
1862;~ ; [Linux support removed since v1.02]
1863;~ FAT16_Drive db ? ; FAT-16: Drive of FAT16-partition
1864;~ FAT16_AbsPartitionBegin dd ? ; FAT-16: LBA Begin of Partition
1865;~ FAT16_SecsPerCluster db ? ; FAT-16: Sectors Per Cluster
1866;~ FAT16_NumOfRootEntries dw ? ; FAT-16: Number of Root Entries
1867;~ FAT16_SecsPerFAT dw ? ; FAT-16: Sectors Per FAT
1868;~ FAT16_AbsFATBegin dd ? ; FAT-16: LBA Begin of FAT
1869;~ FAT16_AbsRootBegin dd ? ; FAT-16: LBA Begin of Root
1870;~ FAT16_AbsClusterBegin dd ? ; FAT-16: LBA Begin of Clusters
1871;~ FAT16_FATCacheSector db ? ; FAT-16: FAT-Sector No in Cache
1872;~ FAT16_FATCache db 512 dup (?) ; FAT-16: FAT-Area Cache
1873;~ LINUX_KernelEntries db 680 dup (?) ; 34*20 -> Space for Kernel-Entries
1874;~ LINUX_KernelNo db ? ; Total of Kernels in KernelEntries
1875;~ LINUX_KernelSizeTable db 120 dup (?) ; Size-Table (6 bytes per kernel)
1876
1877; Dynamically Generated Tables - do not need to get initialized with NUL
1878FX_CooperColors db 672 dup (?) ; 7 cooper bars*96 - runtime calculated
1879FX_CooperState db 7 dup (?)
1880FX_SinusPos db 7 dup (?)
1881FX_CooperPos dw 7 dup (?)
1882CharsetTempBuffer db 4096 dup (?) ; Uninitialized Charset buffer
1883LVM_CRCTable dd 256 dup (?) ; LVM-CRC (->SPECiAL\LVM.asm)
1884
1885
1886
1887
1888;
1889; Rousseau: added some stuff.
1890;
1891
1892
1893 ;EVEN
1894HugeDisk db MaxDisks dup(?)
1895TrueSecs dd MaxDisks dup(?)
1896
1897; BIOS geometry of the boot-drive
1898; Note that heads cannot be 256 due to legacy DOS/BIOS bug
1899; If Int13X is supported those values are used, otherwise the legacy values.
1900BIOS_Cyls dd MaxDisks dup(?)
1901BIOS_Heads dd MaxDisks dup(?)
1902BIOS_Secs dd MaxDisks dup(?)
1903BIOS_Bytes dw MaxDisks dup(?)
1904BIOS_TotalSecs dq MaxDisks dup(?)
1905
1906; LBA geometry of the boot-drive
1907; Note that these values are taken from the BPB of a partition boot-record
1908LVM_Cyls dd MaxDisks dup(?)
1909LVM_Heads dd MaxDisks dup(?)
1910LVM_Secs dd MaxDisks dup(?)
1911LVM_Bytes dw MaxDisks dup(?)
1912LVM_TotalSecs dq MaxDisks dup(?)
1913
1914; OS/2 geometry of the boot-drive
1915; Note that these values are taken from the BPB of a partition boot-record
1916LOG_Cyls dd MaxDisks dup(?)
1917LOG_Heads dd MaxDisks dup(?)
1918LOG_Secs dd MaxDisks dup(?)
1919LOG_Bytes dw MaxDisks dup(?)
1920LOG_TotalSecs dq MaxDisks dup(?)
1921
1922; End of transient variables.
1923EndOfVariables:
1924
1925
1926;
1927; Temporary buffer for 48h INT13X bios call.
1928;
1929
1930 ; Size of the buffer.
1931 ; this param *must* be filled in.
1932 ; Code inserts it.
1933i13xbuf dw 1 dup (?)
1934
1935 ; The buffer itself.
1936 db 126 dup(?)
1937
1938 ; Size of buffer calculated.
1939 ; (excluding the size word at the start).
1940 i13xbuf_size = $-offset i13xbuf-2
1941
1942 ; Some debug area.
1943ott db 512 dup(?)
1944
1945eobss:
1946
1947IFDEF SEGMENTED
1948 VOLATILE ENDS
1949ELSE
1950 LDRIMAGE ENDS
1951ENDIF
1952
1953 END AiR_BOOT
1954
Note: See TracBrowser for help on using the repository browser.