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

Last change on this file since 30 was 30, checked in by Ben Rietbroek, 14 years ago

AiR-BOOT v1.07 -- As released with eCS v2.1. [2011-05-06]
Signature-date: 2006-03-13. (incorrect)
Trunk contains buildable v1.07 version as distributed with eCS v2.1.
Directory 'tags' contains v1.06 & v1.07 reference versions
built for all languages. Note that language ID for 'Dutch' changed
from 'DT' to 'NL' in v1.07 and that the v1.06 reference version also
uses 'NL' for 'Dutch'.
Also note that helper programs like the installer and setaboot are
are only modified for the OS/2 versions in v1.07.
The signature-date for v1.07 incorrectly states the same
date as for v1.06. The signature-version is correct.
Removed other binaries. (cd-rom images, old releases, etc.)
The tags serve as reference versions:

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