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

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

Created Bitfield functions (auxdebug on) [2012-02-21]

WARNING!!

All commits upto and including the commit of [2012-05-13] contain
a severe bug!! Building from these sources and then disabling
the 'force LBA' feature while also using the drive-letter feature or
editing the label can DESTROY THE MBR on ALL ATTACHED DISKS!!
DO NOT DISABLE 'FORCE LBA USAGE' WHEN BUILT FROM THE THESE COMMITS!!

New

o Functions to insert/retrieve bitfields

Let's see if we can compress the hideparttable...

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