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

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

Bumped code-version to v1.0.8 [2011-11-11]

Fixes

o Fixed the drive-letter feature that was broken in v1.07
o Corrected release date in signature which was not updated with v1.07

Changes

o Bumped code-version in signature to v1.0.8

The extra dot is cosmetic only, the version in the signature
is BCD-coded and did not change format.

o Reworked MBR code to contain two I13X signatures

These signatures are actually MOV EAX,'X31I' in the original eCS
LVM MBR-code. However, they are at different offsets in the v1.x
and v2.x versions of the LVM MBR-code. (v1.x->0d5h -- v2.x->0d0h)
Other code might depend on their existence so we put both in
the AiR-BOOT MBR. (See eCS bugtracker issue #3002)

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