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

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

Reworked Special Partition Handling [2011-11-24]

Changes

Changed the special partitioning handling code to be more aware
of what kind of partition we're dealing with. This is debug-code.
Most of the added functions are actually redundant and are removed
in later revisions.

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