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

Last change on this file since 35 was 35, checked in by Ben Rietbroek, 13 years ago

Corrected CRC calculations in installers and setaboot [2012-01-21]

Fixes

o Corrected CRC calculations on AiR-BOOT configuration in the

installers and setaboot. They are now v1.07 compatible again.

Note

This commit and all following commits upto and including the RC3
commit [2012-09-09] are delayed commits from a local repository.
Also, the RC (Release Candidate) naming of the corresponding commits
is a bit misleading. One would label a revision with RC when near to
a final release. Since many things have changed between RC1,RC2 & RC3,
these RC's should be interpreted as mile-stones.

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

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