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

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

Fixed a nasty bug when eCS phase1 is active [2012-05-13]

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!!

Fixes

o Bug Description

When creating a partition in a free space between partitions for
eCS installation, the phase1 boot-through code would calculate the
wrong index for the new partition. As a result the next partition
would be auto-booted instead of the newly installed system.
This bug is also present in v1.07.

o Quick Fix

Run PARTSCAN_ScanForPartitions for a second time when eCS phase1
is active. This resyncs the PartitionXref table.

File size: 69.4 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 mov al, byte ptr [CFG_Partitions]
858 mov byte ptr [OldPartitionCount], al
859
860 ; Initialize Variable-Tables, Detections, etc.
861 call PRECRAP_Main
862
863 ; Number of harddisks is now known
864
865IFDEF AUX_DEBUG
866 call DEBUG_DumpIPT
867 ;~ call DEBUG_DumpPartitionPointers
868 call DEBUG_DumpPartitionXref
869 ;~ call DEBUG_DumpNewPartTable
870ENDIF
871
872 ; Scan all partitions
873 call PARTSCAN_ScanForPartitions
874
875 ; Display number of physical disks found
876 mov si, offset DisksFound
877 call MBR_Teletype
878 mov al, [TotalHarddiscs]
879 call VideoIO_SyncPos
880 call VideoIO_PrintByteDynamicNumber
881 xor si,si
882 call MBR_TeletypeNL
883
884 ; Display number of partitions found
885 mov si, offset PartitionsFound
886 call MBR_Teletype
887 mov al, [CFG_Partitions]
888 call VideoIO_SyncPos
889 call VideoIO_PrintByteDynamicNumber
890
891 ; Dump summier disk-info for disks found
892 xor si,si
893 call MBR_TeletypeNL
894 call MBR_TeletypeNL
895 call VideoIO_SyncPos
896 mov dl,80h
897 call VideoIO_DumpDiskInfo
898
899
900IFDEF AUX_DEBUG
901 call DEBUG_DumpIPT
902 ;~ call DEBUG_DumpPartitionPointers
903 call DEBUG_DumpPartitionXref
904 ;~ call DEBUG_DumpNewPartTable
905ENDIF
906
907
908 ; ======================
909 ; == eCS PHASE1 check ==
910 ; ======================
911
912 ; If the firt byte if name of the Install Volume is not 0
913 ; then we potentially have a phase1 boot.
914 test byte ptr [eCS_InstallVolume],0ffh
915 ; Nope, so continue normally.
916 jz MBR_Main_ContinueBoot
917
918 ; Setup phase1.
919 ; It is still possible that a name was set for the
920 ; Install Volume that does not exist.
921 ; In that case CY will be clear and AL=0FFh.
922 call PART_SetupPhase1
923 ; Oops, Install Volume not found, continue normally.
924 jnc MBR_Main_ContinueBoot
925
926
927 ; == Install Volume Found ==
928
929 ; Because the old IPT read from disk differs from the new
930 ; IPT, we need to rescan all partitions.
931 ; This causes the PartitionXref table to be filled with
932 ; correct values so the auto-boot from the new partition
933 ; works correctly.
934 call PARTSCAN_ScanForPartitions
935
936 ; Setup automatic boot to forgo the Menu.
937 ; PART_SetupPhase1 has filled in the other variables.
938 mov byte ptr [CFG_AutomaticBoot],1
939
940
941IFDEF AUX_DEBUG
942 call DEBUG_DumpIPT
943 ;~ call DEBUG_DumpPartitionPointers
944 call DEBUG_DumpPartitionXref
945 ;~ call DEBUG_DumpNewPartTable
946ENDIF
947
948
949 jmp MBR_Main_ContinueBoot
950
951
952
953
954
955 MBR_Main_ContinueBoot:
956 xor si,si
957 call MBR_TeletypeNL
958 xor si,si
959 call MBR_TeletypeNL
960
961
962 call MBR_TeletypeSyncPos
963
964 xor si,si
965 call MBR_TeletypeNL
966 call MBR_TeletypeNL
967
968
969
970 mov si, offset ShowMenu
971 call MBR_TeletypeBold
972
973
974
975
976
977
978 ;
979 ; ####################### WAIT FOR KEY ########################
980 ;
981
982
983 ; Rousseau:
984 ; Wait for key so we can see debug log if ab-menu hangs.
985 ;~ xor ax, ax
986 ;~ int 16h
987
988 ;call SOUND_Beep
989
990 ; Rousseau: delayed save of video-page
991
992 mov ax, VideoIO_Page1
993 call VideoIO_BackUpTo ; Copy BIOS POST to Second Page
994
995 ;call SOUND_Beep
996
997
998 ;
999 ; COM-PORT DEBUG
1000 ;
1001 ;call AuxIO_TeletypeNL
1002 ;mov si, offset PartitionTable
1003 ;call AuxIO_DumpSector
1004 ;call AuxIO_TeletypeNL
1005
1006
1007 ; Save configuration so phase1 boot-through is disabled
1008 ; on next boot.
1009 mov byte ptr [eCS_InstallVolume], 0 ; disable phase 1 for next boot
1010 call DriveIO_SaveConfiguration
1011
1012
1013
1014 ;
1015 ; RE-ENTER SETUP
1016 ;
1017 MBR_Main_ReEnterSetup:
1018 call SETUP_CheckEnterSETUP
1019
1020 ;call SOUND_Beep
1021
1022 ; Rousseau: Every time I see "AfterCrap" I have to laugh :-)
1023 call AFTERCRAP_Main
1024
1025 ; [Linux support removed since v1.02]
1026 ; Now get FAT16-Linux Kernel Partition, If requested
1027 ;cmp [CFG_LinuxKrnlPartition], 0FFh
1028 ;je MBR_Main_NoLinuxKrnlPartition
1029 ;call LINUX_InitFAT16access
1030 ;MBR_Main_NoLinuxKrnlPartition:
1031
1032
1033
1034 MBR_Main_ReEnterBootMenuPre:
1035
1036 ; SetUp PartitionPointers for BootMenu (filter non-bootable)
1037 call PART_CalculateMenuPartPointers
1038
1039 ; ...and count that one...
1040 cmp byte ptr [PartitionPointerCount], 0
1041 jne MBR_Main_SomethingBootAble
1042 mov si, offset TXT_NoBootAble
1043 call MBR_Teletype
1044 jmp MBR_HaltSystem
1045
1046 MBR_Main_SomethingBootAble:
1047 ; FixUp Values, define Timed Setup booting, etc.
1048 call PART_FixUpDefaultPartitionValues
1049
1050
1051
1052 ; -------------------------------------------------- BOOT-MENU
1053 MBR_Main_ReEnterBootMenu:
1054 call BOOTMENU_ResetMenuVars ; reset has to be done
1055 test byte ptr [CFG_AutomaticBoot], 1
1056 jz MBR_Main_NoAutomaticBooting
1057
1058
1059 ; ------------------------------------------ AUTOMATIC BOOTING
1060 ; Select automatic partition, disable automatic booting for
1061 ; next time and boot system...
1062 mov byte ptr [CFG_AutomaticBoot], 0
1063 call PASSWORD_AskSystemPwd
1064 mov al, Menu_EntryAutomatic
1065
1066 ;mov al, 2
1067
1068 mov Menu_EntrySelected, al ; zero based
1069 jmp MBR_Main_NoBootMenu
1070
1071
1072 MBR_Main_NoAutomaticBooting:
1073
1074 ;call SOUND_Beep
1075
1076 test byte ptr [CFG_BootMenuActive], 0FFh
1077 jnz MBR_Main_GotBootMenu
1078 ; ----------------------------------------------- NO BOOT-MENU
1079 ; Select default partition and boot system...
1080 call PASSWORD_AskSystemPwd
1081
1082 ;call VideoIO_DBG_WriteString2
1083
1084 mov al, Menu_EntryDefault
1085 ;mov al,0 ; zero based
1086 mov Menu_EntrySelected, al
1087 jmp MBR_Main_NoBootMenu
1088
1089 MBR_Main_GotBootMenu:
1090 ; ------------------------------------------ BOOT-MENU VISUALS
1091 call FX_StartScreen
1092
1093 ;call SOUND_Beep
1094
1095 call BOOTMENU_BuildBackground
1096 call BOOTMENU_BuildMain
1097 call FX_EndScreenRight
1098 call PASSWORD_AskSystemPwd
1099 call BOOTMENU_ResetTimedBoot
1100
1101 ;call SOUND_Beep
1102
1103 call BOOTMENU_Execute
1104
1105 ;call SOUND_Beep
1106
1107 jc MBR_Main_ReEnterSetup
1108 call BOOTMENU_SetVarsAfterMenu
1109
1110 ;call SOUND_Beep
1111
1112 ; ---------------------------------------------------- BOOTING
1113 MBR_Main_NoBootMenu:
1114 call FX_StartScreen
1115 call BOOTMENU_BuildGoodBye
1116 call FX_EndScreenRight
1117 call PASSWORD_AskChangeBootPwd
1118
1119 IFNDEF ReleaseCode
1120 ; Debug Code to terminate DOS .COM program - used for
1121 ; testing AiR-BOOT
1122 int 3
1123 mov ax, 6200h
1124 int 21h
1125 mov es, bx
1126 mov ax, 4C00h ; Quit program
1127 int 21h
1128 ENDIF
1129 call ANTIVIR_SaveBackUpMBR
1130
1131 ; Preload the selected menu-entry
1132 ; However, this value will be wrong if eCS phase1 is
1133 ; active and the installation partition is newly created.
1134 ; See below for the adjustment.
1135 mov dl, byte ptr [Menu_EntrySelected]
1136
1137 jmp MBR_Main_StartPartition
1138
1139
1140
1141 MBR_Main_StartPartition:
1142
1143IFDEF AUX_DEBUG
1144 ;~ call DEBUG_DumpIPT
1145 ;~ call DEBUG_DumpPartitionPointers
1146 call DEBUG_DumpPartitionXref
1147 ;~ call DEBUG_DumpNewPartTable
1148ENDIF
1149
1150
1151 ; -------------------------------------------- START PARTITION
1152 call PART_StartPartition
1153
1154
1155
1156;
1157; Include other code-modules here.
1158; Because TASM is a multiple pass assembler, forward references
1159; are possible.
1160;
1161b_std_txt:
1162Include REGULAR/STD_TEXT.ASM ; Standard (non-translateable text)
1163size_std_txt = $-b_std_txt
1164
1165b_driveio:
1166Include REGULAR/DRIVEIO.ASM ; Drive I/O, Config Load/Save
1167size_driveio = $-b_driveio
1168
1169b_lvm:
1170Include SPECIAL/LVM.ASM ; LVM-specific code
1171size_lvm = $-b_lvm
1172
1173b_videoio:
1174Include REGULAR/VIDEOIO.ASM ; Video I/O
1175size_videoio = $-b_videoio
1176
1177b_timer:
1178Include REGULAR/TIMER.ASM ; Timer
1179size_timer = $-b_timer
1180
1181b_partmain:
1182Include REGULAR/PARTMAIN.ASM ; Regular Partition Routines
1183size_partmain = $-b_partmain
1184
1185b_partscan:
1186Include REGULAR/PARTSCAN.ASM ; Partition Scanning
1187size_partscan = $-b_partscan
1188
1189b_bootmenu:
1190Include REGULAR/BOOTMENU.ASM ; Boot-Menu
1191size_bootmenu = $-b_bootmenu
1192
1193b_password:
1194Include REGULAR/PASSWORD.ASM ; Password related
1195size_password = $-b_password
1196
1197b_other:
1198Include REGULAR/OTHER.ASM ; Other Routines
1199size_other = $-b_other
1200
1201b_main:
1202Include SETUP/MAIN.ASM ; The whole AiR-BOOT SETUP
1203size_main = $-b_main
1204
1205
1206
1207IFDEF TXT_IncludeCyrillic
1208b_ccharset:
1209 Include SPECIAL/CHARSET.ASM ; Charset Support (e.g. Cyrillic)
1210size_ccharset = $-b_ccharset
1211ENDIF
1212
1213
1214b_math:
1215Include REGULAR/MATH.ASM ; Math functions (like 32-bit multiply)
1216size_math = $-b_math
1217
1218
1219
1220
1221; Various debugging routines, uses AUXIO and CONV
1222IFDEF AUX_DEBUG
1223b_debug:
1224Include REGULAR/DEBUG.ASM ; Debug module
1225size_debug = $-b_debug
1226b_auxio:
1227Include REGULAR/AUXIO.ASM ; Com-port support for debugging
1228size_auxio = $-b_auxio
1229ENDIF
1230
1231
1232
1233
1234;==============================================================================
1235
1236 ;
1237 ; Moved up.
1238 ;
1239
1240 ;
1241 ; This is the AiR-BOOT MBR-Protection Image.
1242 ; 04600 / 200h = 23h = 35d sectors are before this point.
1243 ; The stuff generated here gets overwritten when the
1244 ; MBR_PROT.ASM module, which is assembled separately,
1245 ; gets merged.
1246 ; So you won't find the string below in the generated binary.
1247 ;
1248 ; MOVED TO 6800h to create space and have a continuous
1249 ; code block.
1250 ; This makes the RU version buildable again with Tasm.
1251 ;
1252 ;org 04600h ; Sector 36-37
1253
1254
1255 ; Rousseau: It needed a sector alignment, so moved it up to
1256 ; have as much space as possible for the modules
1257 ; included here.
1258
1259
1260;==============================================================================
1261 ; Sector 38-x
1262 ;
1263 ; This section contains translatable texts.
1264 ;
1265 ;org 04A00h
1266
1267
1268b_txtother:
1269Include TEXT/TXTOTHER.ASM ; All translateable Text-Strings
1270size_txtother = $-b_txtother
1271
1272b_txtmenus:
1273Include TEXT/TXTMENUS.ASM ; All translateable Menu-text
1274size_txtmenus = $-b_txtmenus
1275
1276b_charset:
1277Include TEXT/CHARSET.ASM ; Special Video Charsets (if needed)
1278size_charset = $-b_charset
1279
1280b_conv:
1281Include REGULAR/CONV.ASM ; Various conversion routines
1282size_conv = $-b_conv
1283
1284b_virus:
1285Include SPECIAL/VIRUS.ASM ; Virus Detection / Anti-Virus
1286size_virus = $-b_virus
1287; [Linux support removed since v1.02]
1288;Include SPECIAL/FAT16.ASM ; FAT-16 Support
1289;Include SPECIAL/LINUX.ASM ; Linux Kernel Support
1290b_billsuxx:
1291Include SPECIAL/F00K/BILLSUXX.ASM ; Extended Partition - Microsoft-Hack
1292size_billsuxx = $-b_billsuxx
1293
1294
1295
1296 ;
1297 ; Critical end of code marker.
1298 ; Should always be in the image, otherwise something
1299 ; is very wrong.
1300 ;
1301 db 'DEAD'
1302 db 'FACE'
1303
1304;
1305; Keep these modules here at the end of the code section.
1306; When debugging, extra code space is used and code will move up towards
1307; the protection image that is 'orged' and will thus overlay.
1308; The effects are turned off in debug mode, so it does not matter much that
1309; this code get's lost.
1310;
1311b_sound:
1312Include SPECIAL/SOUND.ASM ; Sound
1313size_sound = $-b_sound
1314
1315b_apm:
1316Include SPECIAL/APM.ASM ; Power Managment Support
1317size_apm = $-b_apm
1318
1319b_fx:
1320Include SPECIAL/FX.ASM ; l33t Cooper-Bars/Scrolling <bg>
1321size_fx = $-b_fx
1322
1323
1324; If we are debugging, we overwrite the FX code.
1325; As long as FX is disabled this will do no harm.
1326IFDEF AUX_DEBUG
1327 ORG 06780h
1328ENDIF
1329
1330
1331bld_level:
1332 ;
1333 ; Here we insert the OS/2 BLDLEVEL Information.
1334 ; It is composed of the AiR-BOOT version-info and other
1335 ; information.
1336 ; It is unique for each release of AiR-BOOT.
1337 ;
1338 ; ?? When AUX_DEBUG is enabled and the above org is active,
1339 ; the BLDLEVEL gets corrupted eventhough it gets inserted here
1340 ; explicitly. The effect is almost like an 'OR' or a merge
1341 ; with the already generated FX code.
1342 ; Tasm and JWasm produce different results.
1343 ; ??
1344 ;
1345 InsertBuildLevel
1346
1347 ;bliep <>
1348
1349 ;
1350 ; End of code marker.
1351 ; If this one vanishes in the image, the FX code will not
1352 ; be operational.
1353 ; Will happen with debugging enabled.
1354 ;
1355 db 'BABE'
1356 db 'FACE'
1357
1358code_end:
1359
1360
1361 ;
1362 ; AiR-BOOT Protection Image.
1363 ; Moved from below to have it not break the included modules
1364 ; with it's sector alignment requirement.
1365 ;
1366 ORIGIN 06800h
1367
1368zzz_code_space = $ - code_end
1369 ;
1370 ; This is the AiR-BOOT MBR-Protection Image.
1371 ; 06800 / 200h = 34h = 52d sectors are before this point.
1372 ; The stuff generated here gets overwritten when the
1373 ; MBR_PROT.ASM module, which is assembled separately,
1374 ; gets merged.
1375 ; So you won't find the string below in the generated binary.
1376 ;
1377
1378 ; 06800-068FF
1379 ; 06900-069FF
1380 ; 06A00-06AFF
1381 ; 06B00-06BFF
1382
1383;
1384; Hardcoded to 1k (1024 bytes) (MBR_PROT.ASM)
1385; The string below is searched for by the FIXCODE helper and *must* be
1386; sector (512-bytes) aligned.
1387;
1388MBR_Protection db 'AiR-BOOT MBR-Protection Image'
1389
1390 ; Just fill.
1391 db 1024-($-MBR_Protection) dup('M')
1392
1393
1394;==============================================================================
1395 ; Sector 55
1396
1397 ;
1398 ; This section contains the AiR-BOOT configuration.
1399 ; Note that it has a version that should be updated
1400 ; when stuff is added.
1401 ; Also add stuff to the end so that offsets of other
1402 ; variables remain vaild.
1403 ;
1404 ORIGIN 06C00h
1405
1406Configuration:
1407 ; THERE IS A NON-ASCII CHAR HERE !!
1408 ; Your editor may not display this non-ASCII
1409 ; character at the end if the 'AiRCFG-TABLE'
1410 ; string. When this character get's deleted,
1411 ; AiR-BOOT will not function because it cannot
1412 ; find the config-signature which includes this
1413 ; invisible character. The code of the char is: 0x0ad.
1414 db 'AiRCFG-TABLE­'
1415 db 01h, 08h, 'U' ; "Compressed" ID String
1416 ; Version 1.02 was for code 1.06, 1.03 was internal
1417 ; and 1.04,1.05 and 1.06 do not exist.
1418 ;
1419 ; 1.07 was used with AB v1.07 and introduced the phase1
1420 ; system-name. For the rest it is compatible with v1.02.
1421 ;
1422 ; 1.0.8 is introduced with AB v1.0.8 and indicates the movement
1423 ; of several components and the packing of the hideparttable.
1424 ; The core configuration has not changed but the generated
1425 ; configuration has. The v1.0.8 installer handles upgrading.
1426 ;
1427 ; It is not required for the config to have the
1428 ; same version as the code, so in the future
1429 ; the code version might be higher than the
1430 ; config version if there are no changes to the latter.
1431 ;
1432
1433CFG_LastTimeEditLow dw 0 ; Last Time Edited Stamp (will incr every setup)
1434CFG_LastTimeEditHi dw 0 ; second 16 bit part...
1435
1436CFG_CheckConfig dw 0 ; Check-Sum for Configuration
1437
1438CFG_Partitions db 0 ; Count of partitions in IPT
1439 db 0 ; Was BootParts - Removed since v0.28b
1440CFG_PartDefault db 0 ; Default-Partition (Base=0)
1441
1442CFG_PartLast db 0 ; Which Partition was booted last time ? (Base=0)
1443CFG_TimedBoot db 0 ; Timed Boot Enable (for REAL Enable look TimedBootEnable)
1444CFG_TimedSecs db 15 ; Timed Boot - How Many Seconds Till Boot
1445CFG_TimedDelay dw 123 ; Timed Boot - Delay
1446CFG_TimedBootLast db 1 ; Timed Boot - Boot From Last Drive Booted From
1447CFG_RememberBoot db 1 ; Remember Manual Boot Choice
1448CFG_RememberTimed db 0 ; Remember if Timed Boot (if both disabled: Boot Default)
1449CFG_IncludeFloppy db 1 ; Include Floppy Drives in Boot-Menu
1450CFG_BootMenuActive db 1 ; Display Boot-Menu (if Disabled: Boot Default)
1451 ; v0.29+ -> 2 - Detailed Bootmenu
1452CFG_PartitionsDetect db 1 ; Autodetect New Partitions (Auto-Add!)
1453CFG_PasswordSetup db 0 ; Ask Password when entering Setup
1454CFG_PasswordSystem db 0 ; Ask Password when booting System
1455CFG_PasswordChangeBoot db 0 ; Ask Password when changing boot partition
1456CFG_ProtectMBR db 0 ; Protect MBR via TSR ?
1457CFG_IgnoreWriteToMBR db 0 ; Just ignore writes to MBR, otherwise crash
1458CFG_FloppyBootGetName db 0 ; Gets floppy name for display purposes
1459CFG_DetectVirus db 0 ; Detect Virus ?
1460CFG_DetectStealth db 0 ; Detect Stealth-Virus ?
1461CFG_DetectVIBR db 0 ; Detect BootRecord-Virus ?
1462CFG_AutoEnterSetup db 0 ; Automatic Enter Setup (first install!)
1463CFG_MasterPassword dw 0101Fh ; Encoded Password (this is just CR)
1464 dw 07A53h
1465 dw 0E797h
1466 dw 0A896h
1467CFG_BootPassword dw 0101Fh ; Another CR... ;-)
1468 dw 07A53h
1469 dw 0E797h
1470 dw 0A896h
1471 db 0 ; Rude-Protection - Removed since v0.28b
1472CFG_LinuxRootPartition db 0 ; Linux Root Partition (Base=0)
1473CFG_TimedKeyHandling db 0 ; Timed Key Handling (for Timed Boot)
1474 ; 0 - Do Nothing
1475 ; 1 - Reset Time
1476 ; 2 - Stop Time
1477CFG_MakeSound db 0 ; Should be clear ;)
1478CFG_FloppyBootGetTimer db 0 ; Floppy Name will get updated every 2 secs
1479CFG_ResumeBIOSbootSeq db 0 ; If BIOS Boot Sequence should be resumed
1480 ; 0 - Disabled
1481 ; 1 - CD-ROM
1482 ; 2 - Network
1483 ; 3 - ZIP/LS120
1484CFG_CooperBars db 0 ; If Cooper Bars should be shown
1485CFG_LinuxCommandLine db 75 dup (0) ; Linux Command Line
1486CFG_LinuxKrnlPartition db 0FFh ; FAT-16 Linux Kernel Partition (Base=0)
1487 ; FFh -> Disabled
1488CFG_LinuxDefaultKernel db 'DEFAULT', 4 dup (32), 0 ; Default Kernel Name
1489CFG_LinuxLastKernel db 11 dup (32), 0 ; Last-Booted Kernel Name
1490CFG_ExtPartitionMShack db 0 ; Extended Partition M$-Hack Global Enable
1491CFG_AutomaticBoot db 0 ; Automatic Booting (only one bootup)
1492CFG_PartAutomatic db 0 ; Partition-No for automatic booting
1493CFG_ForceLBAUsage db 1 ; LBA-BIOS-API forced on any HDD I/O
1494CFG_IgnoreLVM db 0 ; Ignores any LVM-Information
1495
1496
1497;
1498; THERE IS ROOM RESERVED HERE FOR MORE VARIABLES
1499;
1500
1501 ;
1502 ; Drive Letters.
1503 ;
1504 ORIGIN 06CB0h
1505
1506
1507;
1508; Moved here to make room for packed hiddenparttable.
1509;
1510DriveLetters db LocIPT_MaxPartitions dup (0)
1511 ; Format is:
1512 ;============
1513 ; Drive-Letter : BYTE (80h-C:, 81h-D:)
1514 ; --------------------> 1 Byte * 45
1515
1516 ;
1517 ; Allways have the name of the installation volume
1518 ; at this offset.
1519 ; So future config changes will not break auto-install.
1520 ;
1521 ORIGIN 06D00h
1522
1523; SET(A)BOOT stores the volume name of the eCS system being installed here.
1524; It is truncated to 11 chars because AiR-BOOT currently does not support
1525; longer labelnames. The name is also capitalized.
1526;eCS_InstallVolume db 12 dup (0)
1527;eCS_InstallVolume db 'HIGHLOG' ,0
1528;eCS_InstallVolume db 'ECS-MIDDLE',0,0
1529;eCS_InstallVolume db 'ECS-HIGH',0,0,0,0
1530;eCS_InstallVolume db 'ECS-HIGH',0,'NO',0
1531eCS_InstallVolume db 'KANWEG2',0
1532;eCS_InstallVolume db 0,'NOPHASEONE' ,0
1533
1534;
1535; THERE IS ROOM RESERVED HERE FOR MORE VARIABLES
1536;
1537
1538 ;
1539 ; 06DABh - 06C00h = 01ABh = 427 bytes.
1540 ; Entries allocated down from 06E00 boundary.
1541 ;
1542 ORIGIN 06DABh ; 427 Boundry
1543
1544; (432 - 5 = 427)
1545AutoDrvLetter db 0
1546AutoDrvLetterSerial dd 0
1547
1548; This entry is also 34 bytes long (466 - 34 = 432)
1549BIOScontIPTentry:
1550 db 0, 0, 0, 0, ' '
1551 db 0, 0FEh, Flags_Bootable
1552 dw 0 ; No Checksum :)
1553 db 0, 1, 0
1554 db 0, 1, 0 ; Location of Partition/Boot Record
1555 dd 0, 0
1556
1557; VIR variables are for the AiR-BOOT Anti Virus Code
1558; Most of them are backups of Interrupt Points, so we can check, if a
1559; stealth virus is on-line, we can intercept its call.
1560; Normal (non stealth) virus are trapped simply by rereading the MBR sector.
1561; If a virus is found, we will restore MBR from Sektor 60/62 and stop the
1562; system from working, so the user has to press reset.
1563; That's saver than a Reboot.
1564;
1565; If a virus is found on the partition to boot, the system will ONLY halt,
1566; nothing more, because we can not remove it. The user shall do it :)
1567; Those viruses are detected via a real nasty method...Checksum-Checking of the
1568; boot-record, which is to be executed. If it does not match the one in our
1569; internal partition table, we will stop. You may however switch this detection
1570; off or just reset it by switching 'VIBR Detection'.
1571
1572; 478 - 12 = 466 ; 466 Sub-Part
1573CFG_VIR_INT08 dd 0 ; pointer to saved 08h entry point
1574CFG_VIR_INT13 dd 0 ; pointer to saved 13h entry point
1575CFG_VIR_INT1C dd 0 ; pointer to saved 1Ch entry point
1576
1577; 478 Boundry (512-34)
1578; This entry is also 34 bytes long
1579FloppyIPTentry db 0, 0, 0, 0, 'FloppyDrive'
1580 db 0, 0FFh, Flags_Bootable
1581 dw 0 ; No Checksum :)
1582 db 0, 1, 0
1583 db 0, 1, 0 ; Location of Partition/Boot Record
1584 dd 0, 0
1585;------------------------------------------------------------------------------
1586
1587 ;org 06E00h ; Sector 56-57
1588
1589 ;
1590 ; AiR-BOOT Internal Partition Table (IPT)
1591 ;
1592 ORIGIN % (image_size - 0a00h - (image_size - image_size_60secs))
1593
1594
1595;
1596; Rousseau: This is the start of the AiR-BOOT IPT
1597;
1598
1599
1600PartitionTable db (LocIPT_MaxPartitions * LocIPT_LenOfIPT) dup (0)
1601; no-partitions detected... :]
1602; db 1, 0, 0, 0, 'Harddisc 1'
1603; db 0, 0FFh, Flags_BootAble
1604; dw 0 ; No Checksum :)
1605; db 0, 0, 1
1606; db 0, 0, 1 ; Location of Partition/Boot Record
1607; dd 0, 0
1608
1609 ; Format is:
1610 ;============
1611 ; SerialNumber * 4
1612 ; PartitionName * 11
1613 ; Drive * 1
1614 ; SystemID * 1 (means the partition type)
1615 ; Flags * 1
1616 ; Checksum * 2 (for virus checking)
1617 ; LocationBegin * 3 (where the partition begins)
1618 ; LocationPartTab * 3 (where the partition table is)
1619 ; AbsoluteBegin * 4 (where the partition begins, in absolute sectors)
1620 ; AbsolutePartTab * 4 (where the partition table is, in absolute sectors)
1621 ; --------------------> 34 Bytes (total maximum partition-entries = 30)
1622
1623
1624
1625 ; No need to check overlap here because this string will
1626 ; be overwritten if the maximum partition count is reached.
1627 ; So this is not a critical boundary.
1628 ORG (image_size - 600h - (image_size - image_size_60secs) / 2 - 10)
1629
1630 db 'AiRBOOTPAR' ; 1K internal partition table
1631
1632
1633;------------------------------------------------------------------------------
1634 ;org 07400h ; Sector 58
1635
1636
1637 ;
1638 ; Hidden Partition Table (6-bit packed as of v1.0.8)
1639 ;
1640 ORIGIN % (image_size - 600h - (image_size - image_size_60secs) / 2)
1641
1642HidePartitionTable db (LocIPT_MaxPartitions * LocHPT_LenOfHPT) dup (0FFh)
1643 ; Format is:
1644 ;============
1645 ; PartitionPtr : BYTE * 30
1646 ; --------------------> 30 Bytes * 45
1647
1648;
1649; Driveletters were here.
1650; Moved down to make room for packed hideparttable.
1651;
1652
1653
1654 ;
1655 ; End of hidden partition table.
1656 ; Check overlap here for security reasons.
1657 ;
1658 ORIGIN % (image_size - 200h - 5)
1659
1660; 79fa - end of packed hide table
1661 db 'ABHID' ; 1K internal Hide-partition table
1662
1663
1664
1665
1666;------------------------------------------------------------------------------
1667 ;org 07A00h
1668 ; Sector 60
1669
1670 ;
1671 ; AiR-BOOT MBR Backup.
1672 ;
1673 ORIGIN % (image_size - 200h)
1674
1675
1676MBR_BackUpMBR db 'AiR-BOOT MBR-BackUp',\
1677 ' - Just to fill this sector with something',0
1678AirBootRocks db 'AiR-BOOT Rocks!',0
1679
1680 db (512 - ($-MBR_BackUpMBR) - 2) dup('M')
1681
1682 ; End of Image signature.
1683 ;
1684 ORIGIN % (image_size - 2)
1685 dw 0BABEh
1686
1687
1688 ;
1689 ; End of Image.
1690 ;
1691 ORIGIN % (image_size)
1692
1693
1694IFDEF SEGMENTED
1695;
1696; End of AiR-BOOT code and data.
1697;
1698
1699LDRIMAGE ENDS
1700
1701;DATA_SEG ENDS
1702
1703;
1704; Uninitialized Data (BSS)
1705;
1706VOLATILE SEGMENT USE16 PUBLIC 'BSS'
1707
1708ENDIF
1709
1710
1711
1712sobss:
1713;------------------------------------------------------------------------------
1714
1715 ;
1716 ; Removed ORG for BSS data to be more compatible
1717 ; with segment-concatenated layout.
1718 ;
1719 ; What happens before this space ??
1720 ; If org 0 corruption occurs.
1721 ;
1722
1723 ;
1724 ; Filling hiddenparttable goes out-of-bounds !
1725 ; Fixed with 6-bit packing.
1726 ;
1727
1728;
1729; If segmented, offsets are relative to the BSS segment.
1730; They are resolved at link-time.
1731; If not segmented, offsets are relative to the CODE segment.
1732;
1733IFDEF SEGMENTED
1734 ORG 02400h
1735ELSE
1736 ORG 0A000h
1737ENDIF
1738
1739
1740; This space actually gets initialized in PreCrap to NUL (till EndOfVariables)
1741BeginOfVariables:
1742PartitionSector db 512 dup (?) ; Temporary Sector for Partition
1743JfsPBR db 512 dup (?) ; Temporary Sector for JFS PBR writeback
1744LVMSector db 512 dup (?) ; Temporary Sector for LVM
1745TmpSector db 512 dup (?) ; Temporary Sector
1746Scratch db 256 dup (?) ; Scratch buffer
1747
1748; Everything used to build a new IPT and reference it to the old one
1749; IETS OVERSCHRIJFT DIT !!
1750NewPartTable db 1536 dup (?) ; New Partition Table
1751
1752; New Hide-Partition Table
1753NewHidePartTable db partition_count * LocHPT_LenOfHPT dup (?)
1754
1755; Logical Drive-Letters
1756NewDriveLetters db partition_count dup (?)
1757
1758; Size-Table (6 bytes per partition)
1759PartitionSizeTable db partition_count * 6 dup (?)
1760
1761; Maximum is 52 word entries till now
1762PartitionPointers dw 52 dup (?)
1763
1764; Count of total Partition Pointers
1765PartitionPointerCount db ?
1766
1767; X-Reference Table (holds new partnr, index is old part nr)
1768PartitionXref db partition_count dup (?)
1769
1770; Volume-Letters
1771; 0 - no LVM support
1772; 1 - LVM support, but no letter
1773; 'C'-'Z' - assigned drive letter
1774PartitionVolumeLetters db partition_count dup (?)
1775
1776
1777
1778
1779TotalHarddiscs db ? ; Total harddrives (by POST)
1780LBASwitchTable db 128 dup (?) ; Bit 25-18 for CHS/LBA Switching
1781NewPartitions db ? ; Freshly found partitions
1782 ; Independent of SaveConfiguration
1783TooManyPartitions db ? ; Non-zero if too many partitions found
1784
1785VideoIO_Segment dw ? ; Segment for Video I/O
1786
1787ExtendedAbsPos dd ? ; Extended Partition Absolute Position
1788ExtendedAbsPosSet db ? ; If Absolute Position set
1789
1790CurPartition_Location dw 4 dup (?) ; Where did current partition come from?
1791CurIO_UseExtension db ? ; 1-Use INT 13h EXTENSIONS
1792 ; (filled out by PreCrap)
1793CurIO_Scanning db ? ; 1-AiR-BOOT is scanning partitions
1794 ; (for detailed error message)
1795
1796; [Linux support removed since v1.02]
1797;GotLinux db ? ; 1-Linux found
1798
1799Menu_EntrySelected db ? ; Which partition we boot this time...
1800Menu_UpperPart db ? ; Which number (Base=0) is the partition upper pos
1801Menu_AbsoluteX db ? ; Pos where Menu stuff starts
1802Menu_TotalParts db ? ; Copy of CFG_BootParts
1803Menu_TotalLines db ? ; Total Lines on Screen used for BootMenu
1804Menu_EntryDefault db ? ; Default Entry in filtered View
1805Menu_EntryLast db ? ; LastBooted Entry in filtered View
1806Menu_EntryAutomatic db ? ; Automatic Entry in filtered View
1807 ; - All adjusted to menu locations
1808
1809PartSetup_UpperPart db ? ; Partition-Setup (like Menu_UpperPart)
1810PartSetup_ActivePart db ? ; Active Partition
1811PartSetup_HiddenUpper db ? ; (like Menu_UpperPart)
1812PartSetup_HiddenX db ? ; Pos for Hidden-Setup
1813PartSetup_HiddenAdd db ? ; Adjust for Hidden-Setup
1814
1815TimedBootEnable db ? ; Local Enable/Disable for timed boot
1816TimedTimeOut dd ? ; TimeOut Timer for TimedBoot (too much time here;)
1817TimedSecondLeft db ? ; How many seconds are left till boom ?
1818TimedSecondBack db ? ; To get a modification noticed
1819TimedBootUsed db ? ; Timed Boot used for bootup ?
1820FloppyGetNameTimer dd ? ; Timer for Floppy-Get-Name
1821SETUP_KeysOnEntry db ? ; which Shift Status was there, when booting ?
1822SETUP_ExitEvent db ? ; Exit Event to end SETUP
1823TempPasswordEntry db 17 dup (?)
1824SETUP_OldPwd db 17 dup (?)
1825SETUP_NewPwd db 17 dup (?)
1826SETUP_VerifyPwd db 17 dup (?)
1827StartSoundPlayed db ?
1828ChangePartNameSave db ? ; Save label after user-edit ?
1829SyncLvmLabels db ? ; Sync LVM labels after user-edit ?
1830
1831FX_UseCount dw ?
1832FX_OverallTimer dw ?
1833FX_WideScrollerTimer dw ?
1834FX_WideScrollerCurPos dw ?
1835FX_WideScrollerSpeed db ?
1836FX_WideScrollerSpeedState db ?
1837FX_WideScrollerDirection db ?
1838FX_WideScrollerAbsDirection db ?
1839FX_WideScrollerBounceSpeed db ?
1840FX_CooperBarsTimer dw ?
1841
1842;~ ; [Linux support removed since v1.02]
1843;~ FAT16_Drive db ? ; FAT-16: Drive of FAT16-partition
1844;~ FAT16_AbsPartitionBegin dd ? ; FAT-16: LBA Begin of Partition
1845;~ FAT16_SecsPerCluster db ? ; FAT-16: Sectors Per Cluster
1846;~ FAT16_NumOfRootEntries dw ? ; FAT-16: Number of Root Entries
1847;~ FAT16_SecsPerFAT dw ? ; FAT-16: Sectors Per FAT
1848;~ FAT16_AbsFATBegin dd ? ; FAT-16: LBA Begin of FAT
1849;~ FAT16_AbsRootBegin dd ? ; FAT-16: LBA Begin of Root
1850;~ FAT16_AbsClusterBegin dd ? ; FAT-16: LBA Begin of Clusters
1851;~ FAT16_FATCacheSector db ? ; FAT-16: FAT-Sector No in Cache
1852;~ FAT16_FATCache db 512 dup (?) ; FAT-16: FAT-Area Cache
1853;~ LINUX_KernelEntries db 680 dup (?) ; 34*20 -> Space for Kernel-Entries
1854;~ LINUX_KernelNo db ? ; Total of Kernels in KernelEntries
1855;~ LINUX_KernelSizeTable db 120 dup (?) ; Size-Table (6 bytes per kernel)
1856
1857; Dynamically Generated Tables - do not need to get initialized with NUL
1858FX_CooperColors db 672 dup (?) ; 7 cooper bars*96 - runtime calculated
1859FX_CooperState db 7 dup (?)
1860FX_SinusPos db 7 dup (?)
1861FX_CooperPos dw 7 dup (?)
1862CharsetTempBuffer db 4096 dup (?) ; Uninitialized Charset buffer
1863LVM_CRCTable dd 256 dup (?) ; LVM-CRC (->SPECiAL\LVM.asm)
1864
1865
1866
1867
1868;
1869; Rousseau: added some stuff.
1870;
1871
1872Phase1Active db ?
1873OldPartitionCount db ?
1874
1875 ;EVEN
1876HugeDisk db MaxDisks dup(?)
1877TrueSecs dd MaxDisks dup(?)
1878
1879; BIOS geometry of the boot-drive
1880; Note that heads cannot be 256 due to legacy DOS/BIOS bug
1881; If Int13X is supported those values are used, otherwise the legacy values.
1882BIOS_Cyls dd MaxDisks dup(?)
1883BIOS_Heads dd MaxDisks dup(?)
1884BIOS_Secs dd MaxDisks dup(?)
1885BIOS_Bytes dw MaxDisks dup(?)
1886BIOS_TotalSecs dq MaxDisks dup(?)
1887
1888; LBA geometry of the boot-drive
1889; Note that these values are taken from the BPB of a partition boot-record
1890LVM_Cyls dd MaxDisks dup(?)
1891LVM_Heads dd MaxDisks dup(?)
1892LVM_Secs dd MaxDisks dup(?)
1893LVM_Bytes dw MaxDisks dup(?)
1894LVM_TotalSecs dq MaxDisks dup(?)
1895
1896; OS/2 geometry of the boot-drive
1897; Note that these values are taken from the BPB of a partition boot-record
1898LOG_Cyls dd MaxDisks dup(?)
1899LOG_Heads dd MaxDisks dup(?)
1900LOG_Secs dd MaxDisks dup(?)
1901LOG_Bytes dw MaxDisks dup(?)
1902LOG_TotalSecs dq MaxDisks dup(?)
1903
1904; End of transient variables.
1905EndOfVariables:
1906
1907
1908;
1909; Temporary buffer for 48h INT13X bios call.
1910;
1911
1912 ; Size of the buffer.
1913 ; this param *must* be filled in.
1914 ; Code inserts it.
1915i13xbuf dw 1 dup (?)
1916
1917 ; The buffer itself.
1918 db 126 dup(?)
1919
1920 ; Size of buffer calculated.
1921 ; (excluding the size word at the start).
1922 i13xbuf_size = $-offset i13xbuf-2
1923
1924 ; Some debug area.
1925ott db 512 dup(?)
1926
1927eobss:
1928
1929IFDEF SEGMENTED
1930 VOLATILE ENDS
1931ELSE
1932 LDRIMAGE ENDS
1933ENDIF
1934
1935 END AiR_BOOT
1936
Note: See TracBrowser for help on using the repository browser.