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

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

AiR-BOOT v1.0.8-rc3 build-20120909 [2012-09-10]

With Git one can easily hop-skip-and-jump between branches.
So I use Git for my local repos and make use of this easy branching.
Because SVN can only handle lineair history, these branches had to be
rebased before committing them to Netlabs. So, this commit contains a
multitude of changes which makes it a bit hairy.

New

o Display LVM drive-letters in the main menu

A populair request was to show drive-letter information in the menu.
Drive-letters however, are OS specific and AiR-BOOT cannot
accurately predict what drive-letter other operating systems would
assign to what partition. eCS LVM drive-letters however are stored
in the LVM-record and can thus be displayed.

o Added 'Show LVM Drive Letters' option in SETUP/BASIC

This will toggle the display of LVM drive-letters in the main menu.
By default this option is enabled.

o Show popup message when BIOS INT13X extensions are not available

The system is halted.

o Show 'DEL to Power Off' in the bottom left corner

This tries to power-off the system, but it may not work for you.

o Simple interactive debugger

Outputs to the serial port with a few one-letter commands to dump
internal tables and state. (Only available in debug builds)

o Enhanced drive-letter feature

Enable multiple eCS installations using the same drive-letter.
This makes it possible to clone a system with the command
'XCOPY /h /o /t /s /e /r /v /e' to another drive and have that boot
from the same drive-letter.
(Or installing to the same drive by hiding the other system)

Changes

o Reduced MBR protection-image from 1024 to 768 bytes

Luckily the MBR Protection Image code does not exceed 768 bytes,
so that gives us another 256 bytes of precious code-space.
Now the non-EN versions are happy again.
Note that the alignment for the image changed from 512 to 256 bytes.
MBR-PROT.ASM, FIXCODE.C, PARTMAIN.ASM and AIR-BOOT.ASM have been
adjusted for this change.
The fight for code-space continues...

o Updating from v1.06 now also copies over drive-letters

When the user has forced drive-letters in v1.06 these will be copied
over to the v1.0.8 configuration when upgrading.
Because the drive-letter feature is broken in v1.07,
the drive-letter table does not get copied over when upgrading
from v1.07.

o Made FX-code optional to compile in

The FX-code supplies the shifting screen-effects when 'Cooper Bars'
is enabled in the setup. With the current enhancements made however,
there is a continuous lack of code-space, especially when debug-code
is included during development. The FX-code occupies some
1200 bytes, a space that can be put to better use. Therefore the
inclusion of the FX-code has been made conditional to make room for
either debugging or future new features.

o Also rewrite PBR on HPFS

Earlier, a fix was made to write a modified PBR back in case JFS was
used. This was done to enable the drive-letter feature on JFS, since
the PBR JFS-bootcode does not use the supplied PBR in memory.
With the enhancements in the drive-letter feature, the HPFS PBR
needs to be updated on disk also, to cope with zero drive-letters in
the HPFS PBR. This potentially fixes a missing drive-letter in the
PBR when the system is restored from an archive. You might need the
drive-letter feature to force the correct drive-letter on the first
boot, after which the feature can be disabled.

o Added extra MBR protection

When AiR-BOOT is active, it is only AiR-BOOT that writes to the MBR.
To protect the MBR from programming errors, like the one below,
any write to the MBR is now checked for validity.
In essence this is protecting your MBR from bad programming done
by me...

Fixes

o Fixed a minor bug with displaying LVM drive-letters

When more partitions that can be displayed were present, scrolling
the menu would not scroll the drive-letter. Fixed.

o Fixed a bug with regard to the drive-letter feature

When partitions were deleted, and some partitions above the deleted
partition(s) had a drive-letter forced, these partitions would lose
this assignment. This bug is also present in v1.06.

Note

The AIRBOOT.HIS file mentions a DOCU directory with the AiR-BOOT
documentation etc. However, this is not present in this commit and
will be provided at a later time.

File size: 92.5 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
23
24
25
26;##############################################################################
27; AiR-BOOT / DEFINITIONS
28;##############################################################################
29
30;
31; Include AiR-BOOT Version Information.
32; This version-info is defined using simpel EQU's so it can serve as a
33; single source for other formats. The AiR-BOOT signature and the
34; OS/2 BLDLEVEL use this basic version information.
35;
36Include VERSION.INC
37
38;
39; Include OS/2 BLDLEVEL Information.
40; It uses the version-information in VERSION.INC to build it's signature.
41;
42Include BLDLEVEL.INC
43
44;
45; Include some macro's.
46; This file contains the ORIGIN macro that is used to detect overlaps.
47;
48Include ../INCLUDE/ASM.INC
49
50
51; We actually don't want to use this directive because it generates extra
52; NOP instructions that we can do without.
53; TASM also has a bug in that when the .ERR2 directive is used when
54; the .386 directive is in effect, the JUMPS directive is also active
55; and cannot be turned off.
56; NOJUMPS seems to have no effect in this situation.
57; In this case 4 NOP instructions are generated after forward referencing jump
58; instructions, to allow for automatic recoding by TASM.
59; This seems to be a TASM bug. (v2,v3,v4, dunno v5)
60IFDEF TASM
61 ;~ JUMPS
62ENDIF
63
64
65;
66; If defined then each module is prefixed with it's name.
67; This is used for debugging purposes but it also increases code space.
68; It should be off in release code.
69;
70;~ MODULE_NAMES EQU
71
72
73
74; -----------------------------------------------------------------------------
75; DEBUG
76; -----------------------------------------------------------------------------
77
78;
79; Enable this to include Debug Modules and enable COM-port debugging.
80; To have room for the debug-code, the FX-code can only be enabled
81; when AUX_DEBUG is not defined.
82;
83;~ AUX_DEBUG EQU
84
85;
86; To have FX enabled, make sure FX_ENABLE is defined.
87; There is no need (for now) to remove Cooper Bars from the setup-menu
88; because AiR-BOOT does not crash when enabling Cooper Bars while FX
89; is not compiled in. Only TAB to post-screen does not work.
90; Way to go Martin !
91;
92IFNDEF AUX_DEBUG
93FX_ENABLED EQU
94ENDIF
95
96;
97; If ReleaseCode is not defined, it will produce debug-able code...
98; Rousseau: This is currently *not* functional so don't use it !
99; It was used to debug AiR-BOOT as a .COM file.
100;
101ReleaseCode equ -1
102
103
104; -----------------------------------------------------------------------------
105; AUX
106; -----------------------------------------------------------------------------
107;
108; bits 7-5 = datarate
109; (000=110,001=150,010=300,011=600,100=1200,101=2400,110=4800,111=9600 bps)
110; bits 4-3 = parity
111; (00 or 10 = none, 01 = odd, 11 = even)
112; bit 2 = stop-bits
113; (set = 2 stop-bits, clear = 1 stop-bit)
114; bits 1-0 = data-bits
115; (00 = 5, 01 = 6, 10 = 7, 11 = 8)
116;
117
118; 9600 bps, no parity, 1 stop-bit, 8 bits per char
119AUX_INIT_PARMS EQU 11100011b
120
121; Com-port for debugging, 0 is disabled
122BIOS_COM_PORT EQU 1
123
124; Default word value for BIOS_AuxParms variable
125; Note that is has moved since v1.07
126BIOS_AUXPARMS_DEFAULT EQU (AUX_INIT_PARMS SHL 8) OR BIOS_COM_PORT
127
128
129
130
131; -----------------------------------------------------------------------------
132; LABELS
133; -----------------------------------------------------------------------------
134; Address labels after code-move
135BootBaseSeg equ 08000h ; Pre-boot, in the low 640K
136BootBasePtr equ 0h ; We put our MBR to this location
137BootBaseExec equ BootBasePtr+offset MBR_RealStart
138StackSeg equ 07000h ; Put the stack below the code
139
140; Use different addresses depending on whether in pre-boot
141; or debug (dos) environment.
142IFDEF ReleaseCode
143 StartBaseSeg equ 00000h ; Pre-boot, we are in low memory
144 StartBasePtr equ 07C00h ; BIOS starts our MBR at 0:7C00
145ELSE
146 ; Rousseau: where does this value come from ?
147 ; Should be CS.
148 ; Rectified in actual code by ignoring this value.
149 StartBaseSeg equ 03A98h ; Adjust to DOS segment
150 StartBasePtr equ 00100h ; We are a .COM file, DOS is active
151ENDIF
152
153
154
155; -----------------------------------------------------------------------------
156; VIDEO
157; -----------------------------------------------------------------------------
158; Video pages, no INT 10h is used for menu-drawing etc.
159VideoIO_Page0 equ 0B800h
160VideoIO_Page1 equ 0B900h
161VideoIO_Page2 equ 0BA00h
162VideoIO_Page4 equ 0BC00h
163VideoIO_FXSegment equ 0A000h
164
165; Special line-drawing characters
166TextChar_WinLineRight equ 0C4h ; 'Ä'
167TextChar_WinLineDown equ 0B3h ; '³'
168TextChar_WinRep1 equ 0D1h ; 'Ñ'
169TextChar_WinRep2 equ 0C5h ; 'Å'
170TextChar_WinRep3 equ 0CFh ; 'Ï'
171TextChar_WinRep4 equ 0B5h ; 'µ'
172TextChar_WinRep5 equ 0C6h ; 'Æ'
173TextChar_WinRep6 equ 0D8h ; 'Ø'
174
175
176
177; -----------------------------------------------------------------------------
178; PARTITION TABLE
179; -----------------------------------------------------------------------------
180; Offsets for Partition-Entries in MBR/EBRs
181LocBRPT_LenOfEntry equ 16 ; Length of a standard MBR or EPR entry
182LocBRPT_Flags equ 0 ; Bootable, Hidden, etc.
183LocBRPT_BeginCHS equ 1 ; Packed CHS value
184LocBRPT_BeginHead equ 1 ; Start head, usually < 16
185LocBRPT_BeginSector equ 2 ; Start sector, max 63 + cyl high bits
186LocBRPT_BeginCylinder equ 3 ; Start cylinder 8+2 bits, max 1023
187LocBRPT_SystemID equ 4 ; Type of system using the partition
188LocBRPT_EndCHS equ 5 ; Packed CHS value
189LocBRPT_EndHead equ 5 ; End head, usually < 16
190LocBRPT_EndSector equ 6 ; End sector, max 63 + cyl high bits
191LocBRPT_EndCylinder equ 7 ; End cylinder 8+2 bits, max 1023
192LocBRPT_RelativeBegin equ 8 ; LBA32 address of partition
193LocBRPT_AbsoluteLength equ 12 ; 32-bit length of partition
194
195; Signature relative to start of MBR/EBR
196LocBR_Magic equ 510 ; Offset of 0AA55h signature
197
198; -----------------------------------------------------------------------------
199; LVM RECORD
200; -----------------------------------------------------------------------------
201; Used as a quick compare in LVM.ASM
202LocLVM_SignatureByte0 equ 02h
203
204; Offsets for LVM Information Sector.
205; These are relative to the start of the LVM sector.
206LocLVM_SignatureStart equ 00h ; 02h,'RMBPMFD' (8 bytes)
207LocLVM_CRC equ 08h ; CRC is a DWORD
208LocLVM_Heads equ 1ch ; Number of heads
209LocLVM_Secs equ 20h ; Sectors per Track
210LocLVM_DiskName equ 24h ; Name of the disk
211LocLVM_StartOfEntries equ 3ch ; (contains maximum of 4 entries)
212LocLVM_LenOfEntry equ 3ch ; Length of an LVM-entry
213
214; An LVM info-sector can contain information on max. 4 partitions.
215; All 4 entries will be used when there 4 primary partitions defined.
216; For logical partitions, the LVM info-sector is located below the start
217; of the logical partition and only one LVM entry is used in that logical
218; LVM info-sector.
219LocLVM_MaxEntries equ 4 ; Max entries in an LVM-sector
220
221
222; -----------------------------------------------------------------------------
223; LVM ENTRY
224; -----------------------------------------------------------------------------
225; Offsets for LVM entry.
226; These are relative to the start of the entry.
227LocLVM_VolumeID equ 00h ; DWORD
228LocLVM_PartitionID equ 04h ; DWORD
229LocLVM_PartitionSize equ 08h ; DWORD
230LocLVM_PartitionStart equ 0ch ; DWORD
231LocLVM_OnBootMenu equ 10h ; is on IBM BM Bootmenu
232LocLVM_Startable equ 11h ; is Startable (newly installed system)
233LocLVM_VolumeLetter equ 12h ; Drive Letter for partition (C-Z or 0)
234LocLVM_Unknown equ 13h ; unknown BYTE (can be used ?)
235LocLVM_InstallLetter equ 13h ; unknown BYTE (can be used ?)
236
237; Truncated to 11 chars when displayed in menu.
238; MiniLVM sets both to the same value.
239; Also, MiniLVM uses a 0-byte terminator, so the maximum length is 19d.
240; Same goes for LocLVM_DiskName.
241; These offsets are relative to an LVM entry.
242LocLVM_VolumeName equ 14h ; 20 bytes
243LocLVM_PartitionName equ 28h ; 20 bytes (Used in menu)
244
245; LVM constants.
246LocLVM_LabelLen equ 14h ; Length of LVM Label (Disk/Part/Vol)
247LocLVM_DiskNameLen equ 14h ; Length of LVM DiskName
248LocLVM_VolumeNameLen equ 14h ; Length of LVM VolumeName
249LocLVM_PartitionNameLen equ 14h ; Length of LVM PartitionName
250
251
252; -----------------------------------------------------------------------------
253; AiR-BOOT IPT
254; -----------------------------------------------------------------------------
255; Offsets for IPT (Internal Partition Table)
256LocIPT_MaxPartitions equ max_partitions ; 45 in v1.07+
257LocIPT_LenOfSizeElement equ 6 ; Size of one Size-Element
258LocIPT_LenOfIPT equ 34 ; Length of an IPT-entry
259LocIPT_Serial equ 0 ; Serial from MBR ?
260LocIPT_Name equ 4 ; Name from FS or LVM (part/vol)
261LocIPT_Drive equ 15 ; Drive-ID (80h,81h)
262LocIPT_SystemID equ 16 ; Partition-Type (06,07,etc)
263LocIPT_Flags equ 17 ; AiR-BOOT Flags for part (see below)
264LocIPT_BootRecordCRC equ 18 ; CRC of Boot-Record
265LocIPT_LocationBegin equ 20 ; Begin of Partition
266LocIPT_LocationPartTable equ 23 ; PartitionTable of Partition
267LocIPT_AbsoluteBegin equ 26 ; Absolute Sector of Begin
268LocIPT_AbsolutePartTable equ 30 ; Absolute Sector of PartTable
269
270
271; AiR-BOOT IPT-Flags
272LocIPT_DefaultFlags equ 00000011b ; Don't know if boot-able :)
273LocIPT_DefaultNonBootFlags equ 00000010b ; VIBR Detection is always on
274
275Flags_Bootable equ 00000001b
276Flags_VIBR_Detection equ 00000010b
277Flags_HideFeature equ 00000100b
278Flags_DriveLetter equ 00001000b ; OS/2 FAT16/HPFS only
279Flags_ExtPartMShack equ 00010000b ; Ext. Partition M$-Hack req ?
280Flags_NoPartName equ 01000000b
281Flags_NowFound equ 10000000b ; temp only in OldPartTable
282Flags_SpecialMarker equ 10000000b ; temp only for HiddenSetup
283
284FileSysFlags_BootAble equ 00000001b ; Is this Partition boot-able ?
285FileSysFlags_FAT32 equ 00010000b ; FAT 32 specific name getting
286FileSysFlags_NoName equ 00100000b ; No Name - use PartitionName
287FileSysFlags_DriveLetter equ 01000000b ; DriveLetter Feature possible
288
289
290; -----------------------------------------------------------------------------
291; AiR-BOOT HPT
292; -----------------------------------------------------------------------------
293; Hidden Partition Table
294; Length of an HPT-entry ((45 * 6 bits-per-part) / 8) * 45
295; 33.75 = 34 bytes for HPT-entry, coincidently same as length of IPT-entry.
296; Packed table !
297LocHPT_LenOfHPT equ 34
298
299
300; -----------------------------------------------------------------------------
301; NAVIGATION KEYS
302; -----------------------------------------------------------------------------
303; Navigation keys
304Keys_Up equ 48h
305Keys_Down equ 50h
306Keys_Left equ 4Bh
307Keys_Right equ 4Dh
308Keys_PageUp equ 49h
309Keys_PageDown equ 51h
310Keys_GrayPlus equ 4Eh
311Keys_GrayMinus equ 4Ah
312Keys_Plus equ 1Bh
313Keys_Minus equ 35h
314Keys_ENTER equ 1Ch
315Keys_ESC equ 1h
316Keys_F1 equ 3Bh
317Keys_F10 equ 44h
318Keys_C equ 2Eh ; Add. Check for Ctrl!
319Keys_Y equ 2Ch
320Keys_Z equ 15h
321Keys_N equ 31h
322Keys_TAB equ 0Fh
323Keys_Delete equ 53h
324Keys_Backspace equ 0Eh
325Keys_Space equ 20h
326
327Keys_Flags_EnterSetup equ 1100b ; Strg+Alt (AL)
328
329
330; -----------------------------------------------------------------------------
331; MISC
332; -----------------------------------------------------------------------------
333; Initial value for the FreeDriveletterMap
334; Meaning A,B not free; C-Z free, rest unused. (right to left)
335; Each partition with an assigned drive-letter clears a bit in this map.
336; (Not implemented yet)
337InitialFreeDriveletterMap equ 00000011111111111111111111111100b
338
339;
340; The first harddisk is BIOS coded 80h.
341; This makes a total of 128 disks that could be supported using this coding.
342; This value is used to store disk-information and this info is allocated
343; in the BSS. 64 disks ought to be enough for everybody :-)
344;
345MaxDisks equ 64
346
347
348
349
350
351
352;##############################################################################
353; AiR-BOOT / MAIN-CODE
354;##############################################################################
355
356;
357; Because of the TASM-bug the processor had to be changed to turn JUMPS
358; off. Existing movzx instructions were replaced with 286 equivalent code.
359; Out of range relative jumps have been recoded.
360;
361; Since version 1.0.8, JWasm is the preferred assembler and Tasm will be
362; dropped. Also, the chances of AiR-BOOT being used on a 286-machine are
363; very slim, so a future version will revert back to .386 and also incorporate
364; 32-bit code. This will enable some enhanced constructs such as scaled
365; indexing, bit-instructions, 32-bit registers and what not.
366;
367.286
368
369;
370; For Tasm, MODEL is needed for the USES directive to work.
371; So always use a model when assembling with Tasm otherwise registers on
372; function calls that use USES are not saved and restored.
373; The model itself, has no real effect because we generate a binary image
374; and not a segmented executable.
375; For the other assemblers we define no model to get rid of the default C/C++
376; segments for future object-linked versions of AiR-BOOT.
377;
378IFDEF TASM
379 ;~ .model large, basic
380 .model tiny,c
381ENDIF
382
383;
384; The below is used to switch between the original 1-segment (code_seg) layout
385; and the new 2-segment (code_seg and bss_data) layout.
386; It will be removed in future versions.
387; The 2-segment layout was needed for JWasm because it does not treat
388; db ? at the end of a code segment as bss-data.
389; Therefore, a true BSS segment is now used.
390; Both the code_seg and the bss_data are grouped to the logical AIRBOOT
391; segment.
392; Note that this influences the offsets in the BSS in the list-file and
393; the wdis disassembly file (.WDA).
394; They are now segment-relative. The true offset is resolved at link
395; time.
396;
397SEGMENTED EQU
398
399 IFDEF SEGMENTED
400 AIRBOOT GROUP LDRIMAGE,VOLATILE
401 ENDIF
402
403 ; Our code-segment starts here.
404 LDRIMAGE SEGMENT USE16 PUBLIC 'CODE'
405
406 IFDEF SEGMENTED
407 ASSUME CS:AIRBOOT, DS:AIRBOOT, ES:nothing, SS:nothing
408 ELSE
409 ASSUME CS:LDRIMAGE,DS:LDRIMAGE,ES:nothing, SS:nothing
410 ENDIF
411
412
413
414;==============================================================================
415; Sector 1
416;==============================================================================
417
418;------------------------------------------------------------------------------
419 ; We are not a .COM file at 100h but a BINARY image
420 ; of which only the 1st sector gets loaded at 0000:07c00h
421 ; by the BIOS. The code in this 1st sector is position
422 ; independent and moves itself to a new location at 8000:0000h.
423 ; Then it jumps to a new entry-point and loads the rest of
424 ; the image to the new location.
425 org 00000h
426;------------------------------------------------------------------------------
427
428
429;
430; Since AiR-BOOT is a boot-loader residing in track0, the first 512 bytes
431; have the layout of a Master Boot Record (MBR). When AiR-BOOT get's installed,
432; the first 512 bytes of this code get's merged with the Partition Table.
433; The rest is installed in the remaining sectors with sector 62 (LBA 61)
434; being the last sector used by AiR-BOOT. Sector 63 is reserved for IBM LVM.
435; The last sector used by AiR-BOOT is a copy of the MBR that AiR-BOOT makes
436; every time a system gets booted.
437;
438
439;
440; Due to the addition of an extra 'I13X' sugnature and code to preserve the
441; values of the registers on entry, the MBR-code has become a bit messy.
442; This will be cleaned-up in future versions.
443;
444
445;
446; Martin had a short jump followed by the AiRBOOT signature at first.
447; Then he encountered strange behaviour by some M$ operating-systems
448; if the the first insruction was not a CLI.
449; But there was no room to insert the CLI and of course he did not want to
450; change the location of the AiR-BOOT signature.
451; He solved this by inserting the M$ needed CLI at offset 0 followed by a short
452; jump that uses the 'A' of the AiR-BOOT signature as the jump displacement.
453;
454
455
456; -----------------------------------------------------------------------------
457; FIRST ENTRY-POINT
458; -----------------------------------------------------------------------------
459; ######################################################
460; # ENTRY-POINT WHERE THE BIOS TRANSFERS CONTROL TO US #
461; ######################################################
462AiR_BOOT:
463 ; Some M$ operating systems need a CLI
464 ; here otherwise they will go beserk
465 ; and will do funny things during
466 ; boot phase, it's laughable!
467 MBR_1stOpc: cli
468
469 ; JMP-Short -> MBR_Start
470 ; Uses the 'A' from the signature as the displacement !
471 MBR_JmpOpc db 0EBh
472
473 ; ID String, Date (DD,MM,CC,YY), Version Number, Language ID
474 ;~ db 'AiRBOOT',24h,02h,20h,12h,01h,08h,TXT_LanguageID
475 MBR_ABSig: InsertAirbootSignature TXT_LanguageID
476
477 ; Total Code Sectors Count.
478 ; Actual value will be inserted by FIXCODE.
479 MBR_CodeSecs db 1
480
481 ; Total Code Sectors Count, dynamically calculated.
482 ;~ db (code_end-$)/512
483
484 ; Check-Sum for Code
485 MBR_CheckCode dw 0
486
487
488
489; -----------------------------------------------------------------------------
490; THIRD ENTRY-POINT
491; -----------------------------------------------------------------------------
492;
493; No single instruction below should be changed, added or removed in the code
494; below as this will cause the jump-link to go haywire.
495;
496MBR_Start:
497 ;
498 ; When we arrive here, no registers have been used yet.
499 ; So, they still contain the values the BIOS left in them.
500 ; We want to preserve those value's for later inspection
501 ; by putting them on the stack.
502 ;
503
504 ; No space for this instruction here.
505 ; We'll enable interrupts later.
506 ;sti ; This opcode is dedicated to:
507 ; =MICROSOFT JUMP DEPARTMENT=
508
509
510 ; Push all registers with values provided by the BIOS
511 ; on the stack.
512 pusha
513 ; Temporary save SS and SP so we still have access to this
514 ; stack after we have setup our own.
515 mov dx,ss
516 mov bx,sp
517
518 ;
519 ; Setup some base stuff
520 ; AX got loaded wrongly for debug, changed the instructions
521 ; without modifying the number of bytes.
522 ; Don't comment-out the redundant instruction below because it
523 ; *will* change the number of bytes and break the jump-chain.
524 ;
525
526 ; The segment we are moving ourself from (NOT USED)
527 ;mov ax, StartBaseSeg
528 ;mov ds, ax
529
530 ; Make sure DS points to CS.
531 push cs
532 pop ds
533
534 ; Setup the source and destination for the code move.
535 mov si, StartBasePtr ; The offset we move ourself from
536 mov ax, BootBaseSeg ; The target segment we move to
537 mov es, ax
538 ;mov di, BootBasePtr ; The target offset we move to
539 ; Changed the instruction to make room.
540 ; So, BootBasePtr is not used !
541 ; The offset in the target segment is assumed to be 0000
542 ; anyway.
543 xor di,di
544 ;sti
545
546 ; Depending on pre-boot or debug.
547 ; Note that ReleaseCode is obsolete, so we will always move
548 ; 256 words; aka this sector, the MBR.
549 IFDEF ReleaseCode
550 mov cx, 256 ; Pre-boot environment
551 ELSE
552 mov cx, 32700 ; Old Debug environment (move ~64kB)
553 ENDIF
554
555 ;
556 ; This moves this 512-byte sector, loaded by the BIOS at
557 ; 0000:7c00 to 8000:0000.
558 ;
559 cld
560 rep movsw
561
562 ; Code an intersegment jump to the new location.
563 ; jmp BootBaseSeg:BootBaseExec
564 ; Note that DX:BX containts the old SS:SP.
565 db 0EAh
566 dw BootBaseExec ; This is MBR_RealStart + BootBasePtr
567 dw BootBaseSeg ; This is 08000h
568
569
570
571
572; -----------------------------------------------------------------------------
573; SIMPLE MBR FUNCTIONS
574; -----------------------------------------------------------------------------
575;
576; Some MBR-functions to provide absolute minimum functionality.
577;
578
579;
580; Entry-point for halting the system.
581;
582MBR_HaltSystem:
583 mov ax, 8600h
584 xor cx, cx
585 mov dx, 500
586 int 15h ; Wait to display the whole screen :]
587MBR_HaltSys:
588 cli
589 jmp MBR_HaltSys
590
591
592 ;
593 ; Some small space for variables.
594 ;
595 ORIGIN 0003Ch
596
597; Comport settings.
598; It had to be moved to create room for the double I13X signature.
599; It cannot be in the config-area (sector 55)
600; because that area is crc-protected and would not allow 'poking'.
601BIOS_AuxParms dw BIOS_AUXPARMS_DEFAULT
602
603
604IFDEF AUX_DEBUG
605reserved db 6 dup('X')
606ELSE
607reserved db 6 dup(0)
608ENDIF
609
610
611
612
613; -----------------------------------------------------------------------------
614; SECOND ENTRY-POINT
615; -----------------------------------------------------------------------------
616 ;
617 ; We arrive here after the first jump using the 'A' of the
618 ; AiR-BOOT signature. So we ensure the jump is always at
619 ; this offset. We jump here, because Martin needed to
620 ; insert a CLI on start and did not want to change the
621 ; AiR-BOOT signature because of Microsoft inventions...
622 ;
623 ORIGIN 00044h
624
625 ; Jump again...
626 ; This time to the code that relocates to 8000:0000.
627 jmp MBR_Start
628
629;
630; Entry-point when loading fails.
631;
632 db 'LOAD ERROR!', 0
633MBR_LoadError Proc Near
634 mov si, offset $-12
635 push cs
636 pop ds
637 call MBR_Teletype
638 MBRLE_Halt:
639 jmp MBRLE_Halt
640MBR_LoadError EndP
641
642;
643; Entry-point when saving fails.
644;
645 db 'SAVE ERROR!', 0
646MBR_SaveError Proc Near
647 mov si, offset $-12
648 push cs
649 pop ds
650 call MBR_Teletype
651 MBRSE_Halt:
652 jmp MBRSE_Halt
653MBR_SaveError EndP
654
655
656; Put text on the screen using the BIOS tele-type function.
657; No attributes like color are supported.
658; In: SI - Pointer to begin of string (EOS is 0)
659; Destroyed: SI
660MBR_Teletype Proc Near Uses ax bx cx
661 mov ah, 0Eh
662 mov bx, 7
663 MBRT_Loop:
664 lodsb
665 or al, al
666 jz MBRT_End
667 int 10h
668 jmp MBRT_Loop
669 MBRT_End:
670 ret
671MBR_Teletype EndP
672
673;
674; Rousseau: DO NOT ADD CODE TO THIS SECTION !
675;
676
677; In: BX - Base Check, DS:SI - Pointer to 512-byte-area to be included
678; Out: BX - Base Check Result
679; Destroyed: SI will get updated (+512)
680MBR_GetCheckOfSector Proc Near Uses ax cx
681 mov cx, 256
682 MBRGCOS_Loop:
683 lodsw
684 xor ax, 0BABEh
685 xor bx, ax
686 loop MBRGCOS_Loop
687 or bx, bx
688 jnz MBRGCOS_NoFixUp
689 mov bx, 1 ; dont allow 0, cause 0 == empty
690 MBRGCOS_NoFixUp:
691 ret
692MBR_GetCheckOfSector EndP
693
694
695
696
697
698
699; -----------------------------------------------------------------------------
700; ENTRY-POINT OF MOVED CODE
701; -----------------------------------------------------------------------------
702
703;
704; When we arrive here we are running at 8000:0000.
705; DX:BX contains the SS:SP of the old stack.
706;
707
708;
709; This is where the rest of AiR-BOOT gets loaded from track0.
710;
711
712;------------------------------------------------------------------------------
713MBR_RealStart:
714 ;
715 ; Setup new stack and other segment registers.
716 ;
717 mov ax, StackSeg ; 07000h, below the moved code
718 mov ss, ax
719 mov sp, 7FFEh ; Even is better
720 push es ; ES holds segment where we moved to
721 pop ds ; Set DS==ES to Code Segment
722
723 ;
724 ; Push the old SS:SP which was saved in DX:BX on the new stack.
725 ;
726 push dx ; Old SS
727 push bx ; Old SP
728
729
730 ; If we are in debug-mode, all code is moved already,
731 ; so we can directly jump to it.
732 ; One difference is that in debug-mode, the whole .com image is
733 ; loaded by dos while when air-boot is active from the MBR it
734 ; does the loading itself.
735 ; (This debug environment is obsolete and dis-fuctional)
736 IFNDEF ReleaseCode
737 jmp AiR_BOOT_Start
738 ENDIF
739
740 ; Load the configuration-sectors from disk.
741 ; These are the main configuration sector and the various
742 ; tables that follow it upto but not including the MBR backup.
743 mov bx, offset Configuration
744 mov dx, 0080h ; First harddrive
745 mov cx, 0037h ; Config sector is at 55d (CHS)
746
747 ; Call the i/o-part
748 call MBR_LoadConfig
749 jnc MBR_ConfigCopy_NoError
750
751 ; Some error occured
752 MBR_ConfigCopy_LoadError:
753 call MBR_LoadError ; Will Abort BootUp
754
755 ; Load the code sectors
756 MBR_ConfigCopy_NoError:
757 mov bx, offset FurtherMoreLoad ; Directly after MBR in mem
758 mov dx, 0080h ; First harddrive
759 mov cx, 0002h ; Start at second sector
760 mov ah, 02h ; Read sectors
761
762 ; This location is in the MBR.
763 ; It is filled in by the FIXCODE helper that post processes
764 ; the AIRBOOT loader image after it has been built.
765 ; FIXCODE also embeds the MBR protection-image.
766 mov al, ds:[10h] ; Number of code sectors
767 int 13h ; Call BIOS service
768 jnc MBR_RealStart_NoError
769 jmp MBR_ConfigCopy_LoadError
770
771
772 ; [v1.05+]
773 ; Signature for IBM's LVM to detect our "powerful" features ;)
774 ;
775 ; [v1.0.8+]
776 ; Reworked MBR code to be able to create a
777 ; double 'I13X' signature.
778 ; MBR's created with LVM eCS v1.x have the signature at 0d5h
779 ; MBR's created with LVM eCS v2.x have the signature at 0d0h
780 ; See eCS bugtracker issue #3002
781 ;
782 ; Update: These are actually MOV EAX,'X31I' instructions
783 ; in the eCS LVM MBR-code. They are at different places in
784 ; the v1.x and v2.x LVM MBR-code. Other code might depend on
785 ; their presence. Let's protect their location.
786 ORIGIN 000d0h
787 db 'I13X',0,'I13X',0
788
789
790 MBR_RealStart_NoError:
791 ; Now Check Code with CheckSum
792 mov si, offset FurtherMoreLoad
793
794 ;movzx cx, bptr ds:[10h]
795 mov cl, ds:[10h]
796 mov ch,0
797
798 ; Claculate checksum
799 xor bx, bx
800 MBR_RealStart_CheckCodeLoop:
801 call MBR_GetCheckOfSector
802 loop MBR_RealStart_CheckCodeLoop
803
804
805 cmp MBR_CheckCode, bx
806 je MBR_RealStart_CheckSuccess
807
808 mov si, offset TXT_ERROR_Attention
809 call MBR_Teletype
810 mov si, offset TXT_ERROR_CheckCode
811 call MBR_Teletype
812 mov si, offset TXT_ERROR_CheckFailed
813 call MBR_Teletype
814 jmp MBR_HaltSystem
815
816
817 ;
818 ; OK, all loading went fine so the rest of the code
819 ; is present now, so we jump to it.
820 ; The old SS:SP is still on the stack.
821 ;
822 MBR_RealStart_CheckSuccess:
823 jmp AiR_BOOT_Start
824
825
826
827
828
829;------------------------------------------------------------------------------
830Include TEXT/TXTMBR.ASM ; All translateable Text in MBR
831;------------------------------------------------------------------------------
832
833
834
835; This is an ugly kludge function to create space for the
836; double 'I13X' signature.
837; It loads the configuration sectors, but bx,cx and dx are not initialized
838; in this function. That's done around line 500.
839; Putting this few bytes here creates just enough room.
840MBR_LoadConfig Proc Near
841 ; Changed from conditional assembler to calculated value
842 ; Fixes issue: #2987 -- "air-boot doesn't remember drive letter"
843 ; Size of the ab-configuration in 512 byte sectors
844 mov al, (MBR_BackUpMBR - Configuration) / 200h
845 mov ah,02h
846 int 13h
847 ret
848MBR_LoadConfig EndP
849
850
851 ; Disk Signature
852 ; Note that in an LVM 2.x MBR this collides
853 ; with the dummy PTE that it uses to look for IBM-BM
854 ; on the second harddisk.
855 ORIGIN 001B8h
856
857 ; AiR-BOOT will merge the field from the MBR it replaces.
858 MBR_DrvSig db 'DSIG'
859
860 ; Unused word at 01BCh.
861 ; An LVM 2.x MBR puts 0CC33h here.
862 ; AiR-BOOT will merge the field from the MBR it replaces.
863 MBR_Spare dw '$$'
864
865
866 ;
867 ; Partition Table.
868 ;
869 ORIGIN 001BEh
870
871 ; The 4 entries just for show.
872 ; AiR-BOOT will merge them from the MBR it replaces.
873 MBR_PartTable:
874 db 16 dup('0')
875 db 16 dup('1')
876 db 16 dup('2')
877 db 16 dup('3')
878
879 ; Boot Sigbature
880 MBR_Sig dw 0aa55h
881
882
883
884
885
886
887
888;==============================================================================
889; Sector 2
890;==============================================================================
891
892; -----------------------------------------------------------------------------
893; FILE-SYSTEM TABLES
894; -----------------------------------------------------------------------------
895
896
897 ORIGIN 00200h
898
899;
900; Everything beyond this point is loaded on startup
901; and is NOT existant at first
902;
903FurtherMoreLoad:
904
905;
906; Filesystem table correlating id with name.
907;
908
909 ; first Normal-Partition-ID, Hidden-Partition-ID
910 ; and Default-Partition-Flags.
911 ; 01h -> Boot-Able
912 ; 10h -> FAT32 - Name Getting Scheme
913 ; 20h -> No Name To Get (use Partition Name from IPT)
914 ; 40h -> 'L' flag possible
915 db 'AiRSYS-TABLE'
916FileSysIDs db 01h, 11h,01h, 04h,014h,01h, 06h,016h,41h, 0Eh,00Eh,01h
917 db 07h, 17h,41h, 08h,017h,21h, 35h,035h,20h,0FCh,017h,41h
918 db 09h, 19h,11h, 0Bh,01Bh,11h, 0Ch,01Ch,11h,0EBh,0EBh,01h
919 db 63h, 63h,21h, 81h,081h,21h, 83h,083h,21h, 40h,040h,21h
920 db 0A5h,0A5h,21h,0A6h,0A6h,21h, 82h,082h,20h,0A7h,0A7h,21h
921 db 63h, 63h,21h, 4Dh,04Dh,21h, 4Eh,04Eh,21h, 4Fh,04Fh,21h
922 db 01h, 01h,01h, 01h,001h,01h, 01h,001h,01h, 01h,001h,01h
923 db 01h, 01h,01h, 01h,001h,01h, 01h,001h,01h, 01h,001h,01h
924 db 01h, 01h,01h, 01h,001h,01h, 01h,001h,01h, 01h,001h,01h
925 db 01h, 01h,01h,0FDh,0FDh,20h, 84h,084h,20h,0A0h,0A0h,20h
926 db 0Ah, 0Ah,20h,0FEh,0FEh,21h,0FFh,0FFh,21h, 00h,000h,21h
927 db 16 dup (0)
928
929FileSysNames db 'FAT12 ', 'FAT16 ', 'FAT16Big', 'FAT16Big'
930 db 'HPFS ', 'NTFS ', 'LVM-Data', 'JFS '
931 db 'FAT32 ', 'FAT32 ', 'FAT32 ', 'BeOS '
932 db 'Unix ', 'Minix ', 'Linux ', 'Venix ' ; x row ;)
933 db 'BSD/386 ', 'OpenBSD ', 'LinuxSwp', 'NeXTSTEP'
934 db 'GNU HURD', 'QNX ', 'QNX ', 'QNX '
935 db ' ', ' ', ' ', ' '
936 db ' ', ' ', ' ', ' '
937 db ' ', ' ', ' ', ' '
938 db ' ', 'Kernel ', ' ', '0V-Award'
939; db 'OS/2 Man', 'via BIOS', 'Floppy ', 'Unknown '
940 db 'OS2-BMGR', 'via BIOS', 'Floppy ', 'Unknown '
941 ; -> 44 Partition-Types
942
943
944
945
946
947
948;==============================================================================
949; Sector 3
950;==============================================================================
951
952; -----------------------------------------------------------------------------
953; ENTRY-POINT AFTER LOADING THE REST OF THE CODE
954; -----------------------------------------------------------------------------
955
956 ORIGIN 00400h
957
958
959; ############################################
960; # ENTRY-POINT AFTER ALL THE INITIAL HASSLE #
961; ############################################
962AiR_BOOT_Start:
963
964
965 ;
966 ; Enable interrupts.
967 ;
968 sti
969
970 ;
971 ; Pop the old SS:SP from the stack and save it in the BSS.
972 ;
973 pop [OldSP]
974 pop [OldSS]
975
976
977; -----------------------------------------------------------------------------
978; IBM-BM BOOT PREPARATION
979; -----------------------------------------------------------------------------
980 ;
981 ; Since v1.0.8, AiR-BOOT is able to chainload IBM-BM.
982 ; When IBM-BM resides above the 1024-cylinder limit, the 'I13X'
983 ; signature is required at 3000:0000, FS needs to contain 3000h
984 ; and the 32-bit LBA address needs to follow the 'I13X' signature.
985 ; For booting IBM-BM from the second disk, a copy of the MBR of the
986 ; first disk is also required at 0000:7E00.
987 ; This information is derived from the eCS 2.x LVM MBR.
988 ;
989 ; So, now is a good time to copy the MBR of the first disk to
990 ; 0000:7E00 in case the partition that will be started is IBM-BM.
991 ; This copy is located at 8000:0000 and DS already points to this
992 ; segment. The 'I13X' signature and FS will be setup later.
993 ;
994 pusha ; Save all the general purpose regs
995 push es ; We need ES too, so save its value
996 xor ax,ax ; Segment 0000h
997 mov es,ax ; Make ES point to it
998 mov si,offset BootBasePtr ; Start of AiR-BOOT which has the MBR
999 mov di,7e00h ; Destination for the MBR for IBM-BM
1000 mov cx,100h ; 256 words = 512 bytes
1001 cld ; Direction from low to high
1002 rep movsw ; Copy the 256 words of the MBR
1003 pop es ; Restore previous value of ES
1004 popa ; Restore all the general purpose regs
1005
1006
1007; -----------------------------------------------------------------------------
1008; PRECRAP
1009; -----------------------------------------------------------------------------
1010
1011 ;
1012 ; First it clears the BSS area.
1013 ; Note that the old SS:SP is stored outside this area so ti
1014 ; does not get lost.
1015 ; Then initialize various runtime variables and structures.
1016 ;
1017 call PRECRAP_Main
1018 ; Number of harddisks and other system-info is now known.
1019
1020 ;!
1021 ;! DEBUG_BLOCK
1022 ;! Let's see what the BIOS supplied us with...
1023 ;! Uncomment below to activate.
1024 ;!
1025 __DUMP_BIOS_REGS__ EQU
1026 IFDEF AUX_DEBUG
1027 IFDEF __DUMP_BIOS_REGS__
1028 pushf
1029 pusha
1030 ; Print title.
1031 mov si,offset [bios_reg]
1032 call AuxIO_Print
1033 ; Save the current stack (SS:SP).
1034 mov ax,ss
1035 mov [CurrentSS],ax
1036 mov [CurrentSP],sp
1037
1038 ; Restore the old stack.
1039 mov ss,[OldSS]
1040 mov sp,[OldSP]
1041
1042 ; Pop the registers with the BIOS values.
1043 popa
1044 ; Push them back for AiR-BOOT restart (debug mode).
1045 pusha
1046 ; Dump them to the serial-port.
1047 call DEBUG_DumpRegisters
1048 ; Restore the current stack.
1049 mov ax,[CurrentSS]
1050 mov ss,ax
1051 mov sp,[CurrentSP]
1052
1053 ; Restore registers.
1054 popa
1055 popf
1056 ENDIF
1057 ENDIF
1058
1059
1060
1061
1062 ;!
1063 ;! DEBUG_BLOCK
1064 ;! Dump the registers at this point.
1065 ;! Uncomment below to activate.
1066 ;!
1067 IFDEF AUX_DEBUG
1068 ;~ call DEBUG_DumpRegisters
1069 ; Dump drive-letters of dl-feature before partitions are
1070 ; scanned and processed.
1071 call DEBUG_DumpDriveLetters
1072 call DEBUG_DumpVolumeLetters
1073 call DEBUG_DumpPartitionXref
1074 ENDIF
1075
1076; -----------------------------------------------------------------------------
1077; PARTITION SCAN
1078; -----------------------------------------------------------------------------
1079 ;
1080 ; Scan all partitions
1081 ;
1082 call PARTSCAN_ScanForPartitions
1083 ; Internal Partition Table is now populated.
1084
1085 ;!
1086 ;! DEBUG_BLOCK
1087 ;! Dump various tables.
1088 ;! Uncomment below to activate.
1089 ;!
1090 IFDEF AUX_DEBUG
1091 ;~ call DEBUG_DumpIPT
1092 ;~ call DEBUG_DumpPartitionPointers
1093 ;~ call DEBUG_DumpNewPartTable
1094 ;~ call DEBUG_DumpDriveLetters
1095 call DEBUG_DumpDriveLetters
1096 call DEBUG_DumpVolumeLetters
1097 call DEBUG_DumpPartitionXref
1098 ENDIF
1099
1100
1101; -----------------------------------------------------------------------------
1102; RESTORE FORCED DRIVELETTER CORRELATION [LVM]
1103; -----------------------------------------------------------------------------
1104
1105 ;
1106 ; Reconnect forced drive-letters to their corresponding
1107 ; partitions.
1108 ;
1109 call PARTSCAN_UpdateDriveLetters
1110 ; Driveletter <-> Partition correlation is now restored.
1111
1112
1113
1114 ;!
1115 ;! DEBUG_BLOCK
1116 ;! Dump various tables.
1117 ;! Uncomment below to activate.
1118 ;!
1119 IFDEF AUX_DEBUG
1120 ;~ call DEBUG_DumpIPT
1121 ;~ call DEBUG_DumpPartitionPointers
1122 ;~ call DEBUG_DumpNewPartTable
1123 ;~ call DEBUG_DumpDriveLetters
1124 call DEBUG_DumpDriveLetters
1125 call DEBUG_DumpVolumeLetters
1126 call DEBUG_DumpPartitionXref
1127 ENDIF
1128
1129
1130; -----------------------------------------------------------------------------
1131; SHOW WE ARE ALIVE
1132; -----------------------------------------------------------------------------
1133
1134 ;
1135 ; Put some info about AiR-BOOT and the system on the screen.
1136 ;
1137
1138 ; Display number of physical disks found
1139 mov si, offset DisksFound
1140 call MBR_Teletype
1141 mov al, [TotalHarddiscs]
1142 call VideoIO_SyncPos
1143 call VideoIO_PrintByteDynamicNumber
1144 xor si,si
1145 call MBR_TeletypeNL
1146
1147 ; Display number of partitions found
1148 mov si, offset PartitionsFound
1149 call MBR_Teletype
1150 mov al, [CFG_Partitions]
1151 call VideoIO_SyncPos
1152 call VideoIO_PrintByteDynamicNumber
1153
1154 ; Dump summier disk-info for disks found
1155 xor si,si
1156 call MBR_TeletypeNL
1157 call MBR_TeletypeNL
1158 call VideoIO_SyncPos
1159 mov dl,80h
1160 call VideoIO_DumpDiskInfo
1161
1162
1163
1164
1165
1166; -----------------------------------------------------------------------------
1167; eComStation PHASE1 CHECK
1168; -----------------------------------------------------------------------------
1169
1170 ;
1171 ; Here we check if eComStation v2.1 is being installed.
1172 ; If so, we forgo the menu and directly boot it.
1173 ;
1174
1175 ; If the first byte of the name of the Install Volume is not 0
1176 ; then we potentially have a phase1 boot.
1177 test byte ptr [eCS_InstallVolume],0ffh
1178 ; Nope, so continue normally.
1179 jz MBR_Main_ContinueBoot
1180
1181 ; Setup phase1.
1182 ; It is still possible that a name was set for the
1183 ; Install Volume that does not exist.
1184 ; In that case CY will be clear and AL=0FFh.
1185 call PART_SetupPhase1
1186 ; Oops, Install Volume not found, continue normally.
1187 jnc MBR_Main_ContinueBoot
1188
1189
1190 ;
1191 ; == Install Volume Found ==
1192 ;
1193
1194
1195 ;!
1196 ;! DEBUG_BLOCK
1197 ;! Dump various tables.
1198 ;! Uncomment below to activate.
1199 ;!
1200 IFDEF AUX_DEBUG
1201 ;~ call DEBUG_DumpIPT
1202 ;~ call DEBUG_DumpPartitionPointers
1203 ;~ call DEBUG_DumpPartitionXref
1204 ;~ call DEBUG_DumpNewPartTable
1205 ;~ call DEBUG_DumpDriveLetters
1206 ENDIF
1207
1208
1209 ; Because one or more partitions are possibly added, the
1210 ; PartitionXref table is not 'in sync' and could cause the
1211 ; wrong system to be automatically booted.
1212 ; So we rescan all partitions causing the PartitionXref
1213 ; table to be filled with correct values so the auto-boot
1214 ; from the new partition will work correctly.
1215 call PARTSCAN_ScanForPartitions
1216
1217
1218 ;!
1219 ;! DEBUG_BLOCK
1220 ;! Dump various tables.
1221 ;! Uncomment below to activate.
1222 ;!
1223 IFDEF AUX_DEBUG
1224 ;~ call DEBUG_DumpIPT
1225 ;~ call DEBUG_DumpPartitionPointers
1226 ;~ call DEBUG_DumpPartitionXref
1227 ;~ call DEBUG_DumpNewPartTable
1228 ;~ call DEBUG_DumpDriveLetters
1229 ENDIF
1230
1231 ; Setup automatic boot to forgo the Menu.
1232 ; PART_SetupPhase1 has filled in the other variables.
1233 mov byte ptr [CFG_AutomaticBoot],1
1234
1235 ;
1236 ; At this point the AiR-BOOT configuration has been altered
1237 ; to automatically boot the newly installed system without
1238 ; displaying the menu.
1239 ; Code further down the road will take care of that.
1240 ;
1241 jmp MBR_Main_ContinueBoot
1242
1243
1244
1245
1246 ;
1247 ; Wether a new system is being installed or not,
1248 ; booting continues here.
1249 ;
1250 MBR_Main_ContinueBoot:
1251
1252 ;
1253 ; Inform user how to switch between post-screen and menu
1254 ; by putting this info on the screen.
1255 ;
1256 xor si,si
1257 call MBR_TeletypeNL
1258 xor si,si
1259 call MBR_TeletypeNL
1260 call MBR_TeletypeSyncPos
1261 xor si,si
1262 call MBR_TeletypeNL
1263 call MBR_TeletypeNL
1264 mov si, offset ShowMenu
1265 call MBR_TeletypeBold
1266
1267
1268 ;
1269 ; Debug stop.
1270 ;
1271
1272 ;
1273 ; ####################### WAIT FOR KEY ########################
1274 ;
1275
1276 ; Wait for key so we can see debug log if ab-menu hangs.
1277 ;~ xor ax, ax
1278 ;~ int 16h
1279 ;call SOUND_Beep
1280
1281
1282 ; Copy BIOS POST to Second Page
1283 mov ax, VideoIO_Page1
1284 call VideoIO_BackUpTo
1285
1286 ;call SOUND_Beep
1287
1288
1289 ; Save configuration so phase1 boot-through is disabled
1290 ; on next boot.
1291 mov byte ptr [eCS_InstallVolume], 0
1292 call DriveIO_SaveConfiguration
1293
1294
1295
1296 ;
1297 ; See if setup needs to be entered.
1298 ;
1299 MBR_Main_ReEnterSetup:
1300 call SETUP_CheckEnterSETUP
1301
1302 ;
1303 ; Do some post processing.
1304 ;
1305 call AFTERCRAP_Main
1306
1307 ; [Linux support removed since v1.02]
1308 ; Now get FAT16-Linux Kernel Partition, If requested
1309 ;cmp [CFG_LinuxKrnlPartition], 0FFh
1310 ;je MBR_Main_NoLinuxKrnlPartition
1311 ;call LINUX_InitFAT16access
1312 ;MBR_Main_NoLinuxKrnlPartition:
1313
1314
1315
1316 MBR_Main_ReEnterBootMenuPre:
1317 ; SetUp PartitionPointers for BootMenu (filter non-bootable)
1318 call PART_CalculateMenuPartPointers
1319
1320 ; ...and count that one...
1321 cmp byte ptr [PartitionPointerCount], 0
1322 jne MBR_Main_SomethingBootAble
1323 mov si, offset TXT_NoBootAble
1324 call MBR_Teletype
1325 jmp MBR_HaltSystem
1326
1327 MBR_Main_SomethingBootAble:
1328 ; FixUp Values, define Timed Setup booting, etc.
1329 call PART_FixUpDefaultPartitionValues
1330
1331
1332
1333 ; -------------------------------------------------- BOOT-MENU
1334 MBR_Main_ReEnterBootMenu:
1335 call BOOTMENU_ResetMenuVars ; reset has to be done
1336 test byte ptr [CFG_AutomaticBoot], 1
1337 jz MBR_Main_NoAutomaticBooting
1338
1339
1340 ; ------------------------------------------ AUTOMATIC BOOTING
1341 ; Select automatic partition, disable automatic booting for
1342 ; next time and boot system...
1343 mov byte ptr [CFG_AutomaticBoot], 0
1344 call PASSWORD_AskSystemPwd
1345 mov al, Menu_EntryAutomatic
1346
1347 ;mov al, 2
1348
1349 mov Menu_EntrySelected, al ; zero based
1350 jmp MBR_Main_NoBootMenu
1351
1352
1353 MBR_Main_NoAutomaticBooting:
1354
1355 ;call SOUND_Beep
1356
1357 test byte ptr [CFG_BootMenuActive], 0FFh
1358 jnz MBR_Main_GotBootMenu
1359 ; ----------------------------------------------- NO BOOT-MENU
1360 ; Select default partition and boot system...
1361 call PASSWORD_AskSystemPwd
1362
1363 ;call VideoIO_DBG_WriteString2
1364
1365 mov al, Menu_EntryDefault
1366 ;mov al,0 ; zero based
1367 mov Menu_EntrySelected, al
1368 jmp MBR_Main_NoBootMenu
1369
1370 MBR_Main_GotBootMenu:
1371 ; ------------------------------------------ BOOT-MENU VISUALS
1372
1373
1374 IFDEF FX_ENABLED
1375 call FX_StartScreen
1376 ENDIF
1377
1378 call BOOTMENU_BuildBackground
1379 call BOOTMENU_BuildMain
1380
1381 IFDEF FX_ENABLED
1382 call FX_EndScreenRight
1383 ENDIF
1384
1385 call PASSWORD_AskSystemPwd
1386 call BOOTMENU_ResetTimedBoot
1387
1388 call BOOTMENU_Execute
1389
1390 jc MBR_Main_ReEnterSetup
1391 call BOOTMENU_SetVarsAfterMenu
1392
1393 ; ---------------------------------------------------- BOOTING
1394 MBR_Main_NoBootMenu:
1395
1396 IFDEF FX_ENABLED
1397 call FX_StartScreen
1398 ENDIF
1399
1400 call BOOTMENU_BuildGoodBye
1401
1402 IFDEF FX_ENABLED
1403 call FX_EndScreenRight
1404 ENDIF
1405
1406 call PASSWORD_AskChangeBootPwd
1407
1408 IFNDEF ReleaseCode
1409 ; Debug Code to terminate DOS .COM program - used for
1410 ; testing AiR-BOOT
1411 ; Obsolete.
1412 int 3
1413 mov ax, 6200h
1414 int 21h
1415 mov es, bx
1416 mov ax, 4C00h ; Quit program
1417 int 21h
1418 ENDIF
1419 call ANTIVIR_SaveBackUpMBR
1420
1421 ; Preload the selected menu-entry
1422 ; However, this value will be wrong if eCS phase1 is
1423 ; active and the installation partition is newly created.
1424 ; See below for the adjustment.
1425 mov dl, byte ptr [Menu_EntrySelected]
1426
1427
1428 ;
1429 ; Prepare to start the partition.
1430 ;
1431 jmp MBR_Main_StartPartition
1432
1433
1434
1435; -----------------------------------------------------------------------------
1436; START PARTITION
1437; -----------------------------------------------------------------------------
1438
1439 MBR_Main_StartPartition:
1440
1441 IFDEF AUX_DEBUG
1442 ;~ call DEBUG_DumpIPT
1443 ;~ call DEBUG_DumpPartitionPointers
1444 ;~ call DEBUG_DumpPartitionXref
1445 ;~ call DEBUG_DumpNewPartTable
1446 ENDIF
1447
1448
1449 ; -------------------------------------------- START PARTITION
1450 ; THIS DOES NOT RETURN !
1451 call PART_StartPartition
1452
1453
1454
1455
1456;
1457; This entry-point restarts AiR-BOOT almost from scratch.
1458; It skips the movement of the MBR but otherwise it is a functional restart.
1459; The old BIOS SS:SP where the registers on entry are stored is passed along.
1460;
1461AirbootRestart:
1462 mov bx, [OldSP] ; Old SP when BIOS transferred control to AB
1463 mov dx, [OldSS] ; Old SS when BIOS transferred control to AB
1464 jmp MBR_RealStart
1465
1466
1467;
1468; This entry-point displays a popup that the system is halted
1469; and then halts the system.
1470; It is entered on severe error conditions.
1471;
1472HaltSystem:
1473 call VideoIO_ClearScreen
1474 mov ax,0ababh
1475 mov cx, 0C04h
1476 mov si, offset SystemHalted
1477 call SETUP_ShowErrorBox
1478 ; Halt the system.
1479 jmp MBR_HaltSystem
1480
1481
1482
1483
1484
1485
1486 ;
1487 ; The following section includes various assembler
1488 ; modules. These contain functionality for a multitude of
1489 ; categories like disk-access, video-io, lvm, debugging, etc.
1490 ;
1491
1492
1493; -----------------------------------------------------------------------------
1494; INCLUDED FILE SECTION
1495; -----------------------------------------------------------------------------
1496
1497;
1498; Include other code-modules here.
1499;
1500
1501b_std_txt:
1502Include REGULAR/STD_TEXT.ASM ; Standard (non-translateable text)
1503size_std_txt = $-b_std_txt
1504
1505b_driveio:
1506Include REGULAR/DRIVEIO.ASM ; Drive I/O, Config Load/Save
1507size_driveio = $-b_driveio
1508
1509b_lvm:
1510Include SPECIAL/LVM.ASM ; LVM-specific code
1511size_lvm = $-b_lvm
1512
1513b_videoio:
1514Include REGULAR/VIDEOIO.ASM ; Video I/O
1515size_videoio = $-b_videoio
1516
1517b_timer:
1518Include REGULAR/TIMER.ASM ; Timer
1519size_timer = $-b_timer
1520
1521b_partmain:
1522Include REGULAR/PARTMAIN.ASM ; Regular Partition Routines
1523size_partmain = $-b_partmain
1524
1525b_partscan:
1526Include REGULAR/PARTSCAN.ASM ; Partition Scanning
1527size_partscan = $-b_partscan
1528
1529b_bootmenu:
1530Include REGULAR/BOOTMENU.ASM ; Boot-Menu
1531size_bootmenu = $-b_bootmenu
1532
1533b_password:
1534Include REGULAR/PASSWORD.ASM ; Password related
1535size_password = $-b_password
1536
1537b_other:
1538Include REGULAR/OTHER.ASM ; Other Routines
1539size_other = $-b_other
1540
1541b_main:
1542Include SETUP/MAIN.ASM ; The whole AiR-BOOT SETUP
1543size_main = $-b_main
1544
1545b_math:
1546Include REGULAR/MATH.ASM ; Math functions (like 32-bit multiply)
1547size_math = $-b_math
1548
1549b_txtother:
1550Include TEXT/TXTOTHER.ASM ; All translateable Text-Strings
1551size_txtother = $-b_txtother
1552
1553b_txtmenus:
1554Include TEXT/TXTMENUS.ASM ; All translateable Menu-text
1555size_txtmenus = $-b_txtmenus
1556
1557b_charset:
1558Include TEXT/CHARSET.ASM ; Special Video Charsets (if needed)
1559size_charset = $-b_charset
1560
1561b_conv:
1562Include REGULAR/CONV.ASM ; Various conversion routines
1563size_conv = $-b_conv
1564
1565b_virus:
1566Include SPECIAL/VIRUS.ASM ; Virus Detection / Anti-Virus
1567size_virus = $-b_virus
1568
1569; [Linux support removed since v1.02]
1570;Include SPECIAL/FAT16.ASM ; FAT-16 Support
1571;Include SPECIAL/LINUX.ASM ; Linux Kernel Support
1572
1573b_billsuxx:
1574Include SPECIAL/F00K/BILLSUXX.ASM ; Extended Partition - Microsoft-Hack
1575size_billsuxx = $-b_billsuxx
1576
1577b_sound:
1578Include SPECIAL/SOUND.ASM ; Sound
1579size_sound = $-b_sound
1580
1581b_apm:
1582Include SPECIAL/APM.ASM ; Power Managment Support
1583size_apm = $-b_apm
1584
1585
1586
1587;
1588; Cyrillic support.
1589;
1590IFDEF TXT_IncludeCyrillic
1591b_ccharset:
1592 Include SPECIAL/CHARSET.ASM ; Charset Support (e.g. Cyrillic)
1593size_ccharset = $-b_ccharset
1594ENDIF
1595
1596; Various debugging routines, uses AUXIO and CONV
1597IFDEF AUX_DEBUG
1598b_debug:
1599Include REGULAR/DEBUG.ASM ; Debug module
1600size_debug = $-b_debug
1601b_auxio:
1602Include REGULAR/AUXIO.ASM ; Com-port support for debugging
1603size_auxio = $-b_auxio
1604ENDIF
1605
1606;
1607; We only include this if FX_ENABLED is defined.
1608; FX is disabled when debugging to have more room for debug-code.
1609; The module compiles to 50eh = 1294 bytes, so that is a lot.
1610;
1611IFDEF FX_ENABLED
1612b_fx:
1613Include SPECIAL/FX.ASM ; l33t Cooper-Bars/Scrolling <bg>
1614size_fx = $-b_fx
1615ENDIF
1616
1617
1618 ;
1619 ; End of code marker.
1620 ;
1621 db 'BABE'
1622 db 'FACE'
1623
1624
1625; -----------------------------------------------------------------------------
1626; END OF CODE
1627; -----------------------------------------------------------------------------
1628code_end:
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639; -----------------------------------------------------------------------------
1640; BLDLEVEL INFORMATION
1641; -----------------------------------------------------------------------------
1642
1643 ORIGIN 068A0h
1644
1645;
1646; The space between this offset and code_end is the space
1647; available for code.
1648;
1649zzz_code_space = $ - code_end
1650
1651
1652bld_level:
1653 ;
1654 ; Here we insert the OS/2 BLDLEVEL Information.
1655 ; It is composed of the AiR-BOOT version-info and other
1656 ; information. It is unique for each release of AiR-BOOT.
1657 ;
1658
1659 ;
1660 ; ?? When AUX_DEBUG is enabled and the above org is active,
1661 ; the BLDLEVEL gets corrupted eventhough it gets inserted here
1662 ; explicitly. The effect is almost like an 'OR' or a merge
1663 ; with the already generated FX code.
1664 ; Tasm and JWasm produce different results.
1665 ; ??
1666 ;
1667 InsertBuildLevel
1668
1669
1670
1671
1672
1673;==============================================================================
1674; Sector 53
1675;==============================================================================
1676
1677 ;
1678 ; From here on, the layout of the image consists of:
1679 ; - AiR-BOOT Protection Image
1680 ; - AiR-BOOT Configuration
1681 ; - DriveLetters
1682 ; - Install Volume
1683 ; - Floppy/CDROM/BIOS BOOT ENTRIES
1684 ; - Internal Partition Table (IPT)
1685 ; - Hidden Partition Table (HPT)
1686 ; - MBR Backup
1687 ;
1688
1689 ;
1690 ; After that, the BSS follows with several runtime
1691 ; variables and structures.
1692 ; The BSS is not part of the image on disk of course.
1693 ;
1694
1695; -----------------------------------------------------------------------------
1696; PROTECTION IMAGE
1697; -----------------------------------------------------------------------------
1698
1699 ;
1700 ; This is the AiR-BOOT MBR-Protection Image.
1701 ; The stuff generated here gets overwritten when the
1702 ; MBR_PROT module, which is assembled separately,
1703 ; gets binary merged.
1704 ; So you won't find the string below in the generated binary.
1705 ;
1706 ORIGIN 06900h
1707
1708
1709
1710
1711;
1712; Hardcoded to 768 bytes (MBR_PROT.ASM)
1713; The string below is searched for by the FIXCODE helper and *must* be
1714; page (256 bytes) aligned.
1715;
1716; It seems to be possible to shrink the protection-image to 768 bytes.
1717; That gives us an additional 256 bytes of code-space.
1718; MBR-PROT.ASM,FIXCODE.C,PARTMAIN.ASM and AIR-BOOT.ASM need to be adjusted for that.
1719; Also the granularity needs to change from 512 bytes to 256 bytes since
1720; 6900h is not a 512-byte boundary.
1721;
1722; 20120908 - Done.
1723;
1724MBR_Protection db 'AiR-BOOT MBR-Protection Image'
1725
1726 ; Just fill.
1727 ;~ db 1024-($-MBR_Protection) dup('M')
1728 db 768-($-MBR_Protection) dup('M')
1729
1730
1731
1732
1733
1734
1735
1736;==============================================================================
1737; Sector 55
1738;==============================================================================
1739; -----------------------------------------------------------------------------
1740; AiR-BOOT CONFIGURATION
1741; -----------------------------------------------------------------------------
1742
1743 ;
1744 ; This section contains the AiR-BOOT configuration.
1745 ; Note that it has a version that should be updated
1746 ; when stuff is added.
1747 ; Also add stuff to the end so that offsets of other
1748 ; variables remain vaild.
1749 ;
1750 ORIGIN 06C00h
1751
1752Configuration:
1753 ; THERE IS A NON-ASCII CHAR HERE !!
1754 ; Your editor may not display this non-ASCII
1755 ; character at the end if the 'AiRCFG-TABLE'
1756 ; string. When this character get's deleted,
1757 ; AiR-BOOT will not function because it cannot
1758 ; find the config-signature which includes this
1759 ; invisible character. The code of the char is: 0adh.
1760 db 'AiRCFG-TABLE­'
1761 db 01h, 08h, 'U' ; "Compressed" ID String
1762 ; Version 1.02 was for code 1.06, 1.03 was internal
1763 ; and 1.04,1.05 and 1.06 do not exist.
1764 ;
1765 ; 1.07 was used with AB v1.07 and introduced the phase1
1766 ; system-name. For the rest it is compatible with v1.02.
1767 ;
1768 ; 1.0.8 is introduced with AB v1.0.8 and indicates the movement
1769 ; of several components and the packing of the hideparttable.
1770 ; The core configuration has not changed but the generated
1771 ; configuration has. The v1.0.8 installer handles upgrading.
1772 ;
1773 ; It is not required for the config to have the
1774 ; same version as the code, so in the future
1775 ; the code version might be higher than the
1776 ; config version if there are no changes to the latter.
1777 ;
1778
1779CFG_LastTimeEditLow dw 0 ; Last Time Edited Stamp (will incr every setup)
1780CFG_LastTimeEditHi dw 0 ; second 16 bit part...
1781
1782CFG_CheckConfig dw 0 ; Check-Sum for Configuration
1783
1784CFG_Partitions db 0 ; Count of partitions in IPT
1785CFG_MiscFlags db 1 ; Miscellaneous Flags (See EQUates)
1786CFG_PartDefault db 0 ; Default-Partition (Base=0)
1787
1788CFG_PartLast db 0 ; Which Partition was booted last time ? (Base=0)
1789CFG_TimedBoot db 0 ; Timed Boot Enable (for REAL Enable look TimedBootEnable)
1790CFG_TimedSecs db 15 ; Timed Boot - How Many Seconds Till Boot
1791CFG_TimedDelay dw 123 ; Timed Boot - Delay
1792CFG_TimedBootLast db 1 ; Timed Boot - Boot From Last Drive Booted From
1793CFG_RememberBoot db 1 ; Remember Manual Boot Choice
1794CFG_RememberTimed db 0 ; Remember if Timed Boot (if both disabled: Boot Default)
1795CFG_IncludeFloppy db 1 ; Include Floppy Drives in Boot-Menu
1796CFG_BootMenuActive db 1 ; Display Boot-Menu (if Disabled: Boot Default)
1797 ; v0.29+ -> 2 - Detailed Bootmenu
1798CFG_PartitionsDetect db 1 ; Autodetect New Partitions (Auto-Add!)
1799CFG_PasswordSetup db 0 ; Ask Password when entering Setup
1800CFG_PasswordSystem db 0 ; Ask Password when booting System
1801CFG_PasswordChangeBoot db 0 ; Ask Password when changing boot partition
1802CFG_ProtectMBR db 0 ; Protect MBR via TSR ?
1803CFG_IgnoreWriteToMBR db 0 ; Just ignore writes to MBR, otherwise crash
1804CFG_FloppyBootGetName db 0 ; Gets floppy name for display purposes
1805CFG_DetectVirus db 0 ; Detect Virus ?
1806CFG_DetectStealth db 0 ; Detect Stealth-Virus ?
1807CFG_DetectVIBR db 0 ; Detect BootRecord-Virus ?
1808CFG_AutoEnterSetup db 0 ; Automatic Enter Setup (first install!)
1809CFG_MasterPassword dw 0101Fh ; Encoded Password (this is just CR)
1810 dw 07A53h
1811 dw 0E797h
1812 dw 0A896h
1813CFG_BootPassword dw 0101Fh ; Another CR... ;-)
1814 dw 07A53h
1815 dw 0E797h
1816 dw 0A896h
1817 db 0 ; Rude-Protection - Removed since v0.28b
1818CFG_LinuxRootPartition db 0 ; Linux Root Partition (Base=0)
1819CFG_TimedKeyHandling db 0 ; Timed Key Handling (for Timed Boot)
1820 ; 0 - Do Nothing
1821 ; 1 - Reset Time
1822 ; 2 - Stop Time
1823CFG_MakeSound db 0 ; Should be clear ;)
1824CFG_FloppyBootGetTimer db 0 ; Floppy Name will get updated every 2 secs
1825CFG_ResumeBIOSbootSeq db 1 ; If BIOS Boot Sequence should be resumed
1826 ; 0 - Disabled
1827 ; 1 - CD-ROM
1828 ; 2 - Network
1829 ; 3 - ZIP/LS120
1830CFG_CooperBars db 0 ; If Cooper Bars should be shown
1831CFG_LinuxCommandLine db 75 dup (0) ; Linux Command Line
1832CFG_LinuxKrnlPartition db 0FFh ; FAT-16 Linux Kernel Partition (Base=0)
1833 ; FFh -> Disabled
1834CFG_LinuxDefaultKernel db 'DEFAULT', 4 dup (32), 0 ; Default Kernel Name
1835CFG_LinuxLastKernel db 11 dup (32), 0 ; Last-Booted Kernel Name
1836CFG_ExtPartitionMShack db 0 ; Extended Partition M$-Hack Global Enable
1837CFG_AutomaticBoot db 0 ; Automatic Booting (only one bootup)
1838CFG_PartAutomatic db 0 ; Partition-No for automatic booting
1839CFG_ForceLBAUsage db 1 ; LBA-BIOS-API forced on any HDD I/O
1840CFG_IgnoreLVM db 0 ; Ignores any LVM-Information
1841
1842
1843;
1844; THERE IS ROOM RESERVED HERE FOR MORE VARIABLES
1845;
1846
1847 ;
1848 ; Drive Letters.
1849 ;
1850 ORIGIN 06CB0h
1851
1852
1853; -----------------------------------------------------------------------------
1854; DRIVE LETTERS
1855; -----------------------------------------------------------------------------
1856
1857;
1858; Moved here to make room for packed hiddenparttable.
1859; This gets filled when drive-letters that are assigned using the dl-feature.
1860;
1861DriveLetters db LocIPT_MaxPartitions dup (0)
1862 ; Format is:
1863 ;============
1864 ; Drive-Letter : BYTE (80h-C:, 81h-D:)
1865 ; --------------------> 1 Byte * 45
1866
1867
1868
1869; -----------------------------------------------------------------------------
1870; INSTALL VOLUME
1871; -----------------------------------------------------------------------------
1872
1873 ;
1874 ; Allways have the name of the installation volume
1875 ; at this offset.
1876 ; So future config changes will not break auto-install.
1877 ;
1878 ORIGIN 06D00h
1879
1880; SET(A)BOOT stores the volume name of the eCS system being installed here.
1881; It is truncated to 11 chars because AiR-BOOT currently does not support
1882; longer labelnames. The name is also capitalized.
1883;eCS_InstallVolume db 12 dup (0)
1884;eCS_InstallVolume db 'HIGHLOG' ,0
1885;eCS_InstallVolume db 'ECS-MIDDLE',0,0
1886;eCS_InstallVolume db 'ECS-HIGH',0,0,0,0
1887;eCS_InstallVolume db 'ECS-HIGH',0,'NO',0
1888;eCS_InstallVolume db 'KANWEG2',0
1889eCS_InstallVolume db 0,'NOPHASEONE' ,0
1890
1891;
1892; THERE IS ROOM RESERVED HERE FOR MORE VARIABLES
1893;
1894
1895
1896; -----------------------------------------------------------------------------
1897; FLOPPY/CDROM/BIOS BOOT ENTRIES
1898; -----------------------------------------------------------------------------
1899
1900 ;
1901 ; 06DABh - 06C00h = 01ABh = 427 bytes.
1902 ; Entries allocated down from 06E00 boundary.
1903 ;
1904 ORIGIN 06DABh ; 427 Boundry
1905
1906; (432 - 5 = 427)
1907AutoDrvLetter db 0
1908AutoDrvLetterSerial dd 0
1909
1910; This entry is also 34 bytes long (466 - 34 = 432)
1911BIOScontIPTentry:
1912 db 0, 0, 0, 0, ' '
1913 db 0, 0FEh, Flags_Bootable
1914 dw 0 ; No Checksum :)
1915 db 0, 1, 0
1916 db 0, 1, 0 ; Location of Partition/Boot Record
1917 dd 0, 0
1918
1919; VIR variables are for the AiR-BOOT Anti Virus Code
1920; Most of them are backups of Interrupt Points, so we can check, if a
1921; stealth virus is on-line, we can intercept its call.
1922; Normal (non stealth) virus are trapped simply by rereading the MBR sector.
1923; If a virus is found, we will restore MBR from Sektor 60/62 and stop the
1924; system from working, so the user has to press reset.
1925; That's saver than a Reboot.
1926;
1927; If a virus is found on the partition to boot, the system will ONLY halt,
1928; nothing more, because we can not remove it. The user shall do it :)
1929; Those viruses are detected via a real nasty method...Checksum-Checking of the
1930; boot-record, which is to be executed. If it does not match the one in our
1931; internal partition table, we will stop. You may however switch this detection
1932; off or just reset it by switching 'VIBR Detection'.
1933
1934; 478 - 12 = 466 ; 466 Sub-Part
1935CFG_VIR_INT08 dd 0 ; pointer to saved 08h entry point
1936CFG_VIR_INT13 dd 0 ; pointer to saved 13h entry point
1937CFG_VIR_INT1C dd 0 ; pointer to saved 1Ch entry point
1938
1939; 478 Boundry (512-34)
1940; This entry is also 34 bytes long
1941FloppyIPTentry db 0, 0, 0, 0, 'FloppyDrive'
1942 db 0, 0FFh, Flags_Bootable
1943 dw 0 ; No Checksum :)
1944 db 0, 1, 0
1945 db 0, 1, 0 ; Location of Partition/Boot Record
1946 dd 0, 0
1947
1948
1949
1950; -----------------------------------------------------------------------------
1951; INTERNAL PARTITION TABLE (IPT)
1952; -----------------------------------------------------------------------------
1953
1954 ;
1955 ; AiR-BOOT Internal Partition Table (IPT)
1956 ;
1957 ORIGIN % (image_size - 0a00h - (image_size - image_size_60secs))
1958
1959
1960;
1961; Rousseau: This is the start of the AiR-BOOT IPT
1962;
1963PartitionTable db (LocIPT_MaxPartitions * LocIPT_LenOfIPT) dup (0)
1964; no-partitions detected... :]
1965; db 1, 0, 0, 0, 'Harddisc 1'
1966; db 0, 0FFh, Flags_BootAble
1967; dw 0 ; No Checksum :)
1968; db 0, 0, 1
1969; db 0, 0, 1 ; Location of Partition/Boot Record
1970; dd 0, 0
1971
1972 ; Format is:
1973 ;============
1974 ; SerialNumber * 4
1975 ; PartitionName * 11
1976 ; Drive * 1
1977 ; SystemID * 1 (means the partition type)
1978 ; Flags * 1
1979 ; Checksum * 2 (for virus checking)
1980 ; LocationBegin * 3 (where the partition begins)
1981 ; LocationPartTab * 3 (where the partition table is)
1982 ; AbsoluteBegin * 4 (where the partition begins, in absolute sectors)
1983 ; AbsolutePartTab * 4 (where the partition table is, in absolute sectors)
1984 ; --------------------> 34 Bytes (total maximum partition-entries = 30)
1985
1986
1987
1988 ; No need to check overlap here because this string will
1989 ; be overwritten if the maximum partition count is reached.
1990 ; So this is not a critical boundary.
1991 ORG (image_size - 600h - (image_size - image_size_60secs) / 2 - 10)
1992
1993 db 'AiRBOOTPAR' ; 1K internal partition table
1994
1995
1996
1997; -----------------------------------------------------------------------------
1998; HIDDEN PARTITION TABLE (HPT)
1999; -----------------------------------------------------------------------------
2000
2001 ;
2002 ; Hidden Partition Table (6-bit packed as of v1.0.8)
2003 ;
2004 ORIGIN % (image_size - 600h - (image_size - image_size_60secs) / 2)
2005
2006HidePartitionTable db (LocIPT_MaxPartitions * LocHPT_LenOfHPT) dup (0FFh)
2007 ; Format is:
2008 ;============
2009 ; PartitionPtr : BYTE * 30
2010 ; --------------------> 30 Bytes * 45
2011
2012;
2013; Driveletters were here.
2014; Moved down to make room for packed hideparttable.
2015;
2016
2017
2018 ;
2019 ; End of hidden partition table.
2020 ; Check overlap here for security reasons.
2021 ;
2022 ORIGIN % (image_size - 200h - 5)
2023
2024; 79fa - end of packed hide table
2025 db 'ABHID' ; 1K internal Hide-partition table
2026
2027
2028
2029
2030;==============================================================================
2031; Sector 62
2032;==============================================================================
2033; -----------------------------------------------------------------------------
2034; MBR BACKUP
2035; -----------------------------------------------------------------------------
2036
2037 ;
2038 ; AiR-BOOT MBR Backup.
2039 ;
2040 ORIGIN % (image_size - 200h)
2041
2042
2043MBR_BackUpMBR db 'AiR-BOOT MBR-BackUp',\
2044 ' - Just to fill this sector with something',0
2045AirBootRocks db 'AiR-BOOT Rocks!',0
2046
2047 db (512 - ($-MBR_BackUpMBR) - 2) dup('M')
2048
2049 ; End of Image signature.
2050 ;
2051 ORIGIN % (image_size - 2)
2052 dw 0BABEh
2053
2054
2055 ;
2056 ; End of Image.
2057 ;
2058 ORIGIN % (image_size)
2059
2060
2061
2062;
2063; Terminate LDRIMAGE segment.
2064;
2065IFDEF SEGMENTED
2066LDRIMAGE ENDS
2067ENDIF
2068
2069
2070
2071
2072
2073
2074
2075;##############################################################################
2076; BSS SEGMENT
2077;##############################################################################
2078
2079
2080
2081;
2082; Open BSS segment.
2083;
2084IFDEF SEGMENTED
2085VOLATILE SEGMENT USE16 PUBLIC 'BSS'
2086ENDIF
2087
2088
2089
2090sobss:
2091;------------------------------------------------------------------------------
2092
2093 ;
2094 ; Removed ORG for BSS data to be more compatible
2095 ; with segment-concatenated layout.
2096 ;
2097 ; What happens before this space ??
2098 ; If org 0 corruption occurs.
2099 ;
2100
2101 ;
2102 ; Filling hiddenparttable goes out-of-bounds !
2103 ; Fixed with 6-bit packing.
2104 ;
2105
2106;
2107; If segmented, offsets are relative to the BSS segment.
2108; They are resolved at link-time.
2109; If not segmented, offsets are relative to the CODE segment.
2110;
2111IFDEF SEGMENTED
2112 ORG 02400h
2113ELSE
2114 ORG 0A000h
2115ENDIF
2116
2117
2118; -----------------------------------------------------------------------------
2119; START OF BSS DATA
2120; -----------------------------------------------------------------------------
2121
2122; This space actually gets initialized in PreCrap to NUL (till EndOfVariables)
2123BeginOfVariables:
2124
2125
2126; -----------------------------------------------------------------------------
2127; SECTOR BUFFERS
2128; -----------------------------------------------------------------------------
2129PartitionSector db 512 dup (?) ; Temporary Sector for Partition
2130PBRSector db 512 dup (?) ; Temporary Sector for JFS/HPFS writeback
2131LVMSector db 512 dup (?) ; Temporary Sector for LVM
2132TmpSector db 512 dup (?) ; Temporary Sector
2133Scratch db 256 dup (?) ; Scratch buffer
2134
2135; -----------------------------------------------------------------------------
2136; NEW PARTITION TABLE
2137; -----------------------------------------------------------------------------
2138; Everything used to build a new IPT and reference it to the old one
2139NewPartTable db 1536 dup (?) ; New Partition Table
2140
2141
2142; -----------------------------------------------------------------------------
2143; NEW HIDE PARTITION TABLE
2144; -----------------------------------------------------------------------------
2145; New Hide-Partition Table
2146NewHidePartTable db LocIPT_MaxPartitions * LocHPT_LenOfHPT dup (?)
2147
2148 ;~ even
2149
2150; -----------------------------------------------------------------------------
2151; NEW DRIVE LETTERS
2152; -----------------------------------------------------------------------------
2153; Logical Drive-Letters
2154NewDriveLetters db LocIPT_MaxPartitions dup (?)
2155
2156 ;~ even
2157
2158; -----------------------------------------------------------------------------
2159; PARTITION SIZE TABLE
2160; -----------------------------------------------------------------------------
2161; Size-Table (6 bytes per partition)
2162PartitionSizeTable db LocIPT_MaxPartitions * 6 dup (?)
2163
2164
2165; -----------------------------------------------------------------------------
2166; PARTITION POINTERS
2167; -----------------------------------------------------------------------------
2168; Maximum is 52 word entries till now
2169PartitionPointers dw 52 dup (?)
2170
2171; Count of total Partition Pointers
2172PartitionPointerCount db ?
2173
2174; -----------------------------------------------------------------------------
2175; XREF TABLE
2176; -----------------------------------------------------------------------------
2177
2178; X-Reference Table (holds new partnr, index is old part nr)
2179PartitionXref db LocIPT_MaxPartitions dup (?)
2180
2181; -----------------------------------------------------------------------------
2182; VOLUME LETTERS
2183; -----------------------------------------------------------------------------
2184
2185; Volume-Letters
2186; 0 - no LVM support
2187; 1 - LVM support, but no letter
2188; 'C'-'Z' - assigned drive letter
2189PartitionVolumeLetters db LocIPT_MaxPartitions dup (?)
2190
2191
2192
2193; -----------------------------------------------------------------------------
2194; MISC VARS AND FLAGS
2195; -----------------------------------------------------------------------------
2196TotalHarddiscs db ? ; Total harddrives (by POST)
2197LBASwitchTable db 128 dup (?) ; Bit 25-18 for CHS/LBA Switching
2198NewPartitions db ? ; Freshly found partitions
2199 ; Independent of SaveConfiguration
2200TooManyPartitions db ? ; Non-zero if too many partitions found
2201
2202VideoIO_Segment dw ? ; Segment for Video I/O
2203
2204ExtendedAbsPos dd ? ; Extended Partition Absolute Position
2205ExtendedAbsPosSet db ? ; If Absolute Position set
2206
2207CurPartition_Location dw 4 dup (?) ; Where did current partition come from?
2208CurIO_UseExtension db ? ; 1-Use INT 13h EXTENSIONS
2209 ; (filled out by PreCrap)
2210CurIO_Scanning db ? ; 1-AiR-BOOT is scanning partitions
2211 ; (for detailed error message)
2212
2213; [Linux support removed since v1.02]
2214;GotLinux db ? ; 1-Linux found
2215
2216
2217; -----------------------------------------------------------------------------
2218; MENU RELATED VARS
2219; -----------------------------------------------------------------------------
2220Menu_EntrySelected db ? ; Which partition we boot this time...
2221Menu_UpperPart db ? ; Which number (Base=0) is the partition upper pos
2222Menu_AbsoluteX db ? ; Pos where Menu stuff starts
2223Menu_TotalParts db ? ; Copy of CFG_BootParts
2224Menu_TotalLines db ? ; Total Lines on Screen used for BootMenu
2225Menu_EntryDefault db ? ; Default Entry in filtered View
2226Menu_EntryLast db ? ; LastBooted Entry in filtered View
2227Menu_EntryAutomatic db ? ; Automatic Entry in filtered View
2228 ; - All adjusted to menu locations
2229
2230; -----------------------------------------------------------------------------
2231; PARTITION RELATED VARS
2232; -----------------------------------------------------------------------------
2233PartSetup_UpperPart db ? ; Partition-Setup (like Menu_UpperPart)
2234PartSetup_ActivePart db ? ; Active Partition
2235PartSetup_HiddenUpper db ? ; (like Menu_UpperPart)
2236PartSetup_HiddenX db ? ; Pos for Hidden-Setup
2237PartSetup_HiddenAdd db ? ; Adjust for Hidden-Setup
2238
2239; -----------------------------------------------------------------------------
2240; TIMER / SETUP RELATED VARS
2241; -----------------------------------------------------------------------------
2242TimedBootEnable db ? ; Local Enable/Disable for timed boot
2243TimedTimeOut dd ? ; TimeOut Timer for TimedBoot (too much time here;)
2244TimedSecondLeft db ? ; How many seconds are left till boom ?
2245TimedSecondBack db ? ; To get a modification noticed
2246TimedBootUsed db ? ; Timed Boot used for bootup ?
2247FloppyGetNameTimer dd ? ; Timer for Floppy-Get-Name
2248SETUP_KeysOnEntry db ? ; which Shift Status was there, when booting ?
2249SETUP_ExitEvent db ? ; Exit Event to end SETUP
2250TempPasswordEntry db 17 dup (?)
2251SETUP_OldPwd db 17 dup (?)
2252SETUP_NewPwd db 17 dup (?)
2253SETUP_VerifyPwd db 17 dup (?)
2254StartSoundPlayed db ?
2255ChangePartNameSave db ? ; Save label after user-edit ?
2256SyncLvmLabels db ? ; Sync LVM labels after user-edit ?
2257
2258
2259; -----------------------------------------------------------------------------
2260; FX RELATED VARS
2261; -----------------------------------------------------------------------------
2262FX_UseCount dw ?
2263FX_OverallTimer dw ?
2264FX_WideScrollerTimer dw ?
2265FX_WideScrollerCurPos dw ?
2266FX_WideScrollerSpeed db ?
2267FX_WideScrollerSpeedState db ?
2268FX_WideScrollerDirection db ?
2269FX_WideScrollerAbsDirection db ?
2270FX_WideScrollerBounceSpeed db ?
2271FX_CooperBarsTimer dw ?
2272
2273; Dynamically Generated Tables - do not need to get initialized with NUL
2274FX_CooperColors db 672 dup (?) ; 7 cooper bars*96 - runtime calculated
2275FX_CooperState db 7 dup (?)
2276FX_SinusPos db 7 dup (?)
2277FX_CooperPos dw 7 dup (?)
2278
2279
2280; -----------------------------------------------------------------------------
2281; CHARSET BUFFER
2282; -----------------------------------------------------------------------------
2283CharsetTempBuffer db 4096 dup (?) ; Uninitialized Charset buffer
2284
2285; -----------------------------------------------------------------------------
2286; LVM CRC TABLE
2287; -----------------------------------------------------------------------------
2288LVM_CRCTable dd 256 dup (?) ; LVM-CRC (->SPECiAL\LVM.asm)
2289
2290;~ ; [Linux support removed since v1.02]
2291;~ FAT16_Drive db ? ; FAT-16: Drive of FAT16-partition
2292;~ FAT16_AbsPartitionBegin dd ? ; FAT-16: LBA Begin of Partition
2293;~ FAT16_SecsPerCluster db ? ; FAT-16: Sectors Per Cluster
2294;~ FAT16_NumOfRootEntries dw ? ; FAT-16: Number of Root Entries
2295;~ FAT16_SecsPerFAT dw ? ; FAT-16: Sectors Per FAT
2296;~ FAT16_AbsFATBegin dd ? ; FAT-16: LBA Begin of FAT
2297;~ FAT16_AbsRootBegin dd ? ; FAT-16: LBA Begin of Root
2298;~ FAT16_AbsClusterBegin dd ? ; FAT-16: LBA Begin of Clusters
2299;~ FAT16_FATCacheSector db ? ; FAT-16: FAT-Sector No in Cache
2300;~ FAT16_FATCache db 512 dup (?) ; FAT-16: FAT-Area Cache
2301;~ LINUX_KernelEntries db 680 dup (?) ; 34*20 -> Space for Kernel-Entries
2302;~ LINUX_KernelNo db ? ; Total of Kernels in KernelEntries
2303;~ LINUX_KernelSizeTable db 120 dup (?) ; Size-Table (6 bytes per kernel)
2304
2305
2306;
2307; Rousseau: added some stuff.
2308;
2309; -----------------------------------------------------------------------------
2310; ECS PHASE1 RELATED
2311; -----------------------------------------------------------------------------
2312Phase1Active db ?
2313OldPartitionCount db ?
2314
2315
2316; -----------------------------------------------------------------------------
2317; DISK PARAMETERS
2318; -----------------------------------------------------------------------------
2319 ;EVEN
2320HugeDisk db MaxDisks dup(?)
2321TrueSecs dd MaxDisks dup(?)
2322
2323; BIOS geometry of the boot-drive
2324; Note that heads cannot be 256 due to legacy DOS/BIOS bug
2325; If Int13X is supported those values are used, otherwise the legacy values.
2326BIOS_Cyls dd MaxDisks dup(?)
2327BIOS_Heads dd MaxDisks dup(?)
2328BIOS_Secs dd MaxDisks dup(?)
2329BIOS_Bytes dw MaxDisks dup(?)
2330BIOS_TotalSecs dq MaxDisks dup(?)
2331
2332; LBA geometry of the boot-drive
2333; Note that these values are taken from the BPB of a partition boot-record
2334LVM_Cyls dd MaxDisks dup(?)
2335LVM_Heads dd MaxDisks dup(?)
2336LVM_Secs dd MaxDisks dup(?)
2337LVM_Bytes dw MaxDisks dup(?)
2338LVM_TotalSecs dq MaxDisks dup(?)
2339
2340; OS/2 geometry of the boot-drive
2341; Note that these values are taken from the BPB of a partition boot-record
2342LOG_Cyls dd MaxDisks dup(?)
2343LOG_Heads dd MaxDisks dup(?)
2344LOG_Secs dd MaxDisks dup(?)
2345LOG_Bytes dw MaxDisks dup(?)
2346LOG_TotalSecs dq MaxDisks dup(?)
2347
2348; Get's initialized at startup to: 00000011111111111111111111111100b
2349; Meaning A,B not free; C-Z free, rest unused. (right to left)
2350; Each partition with an assigned drive-letter clears a bit in this map.
2351FreeDriveletterMap dd ?
2352
2353; LBA address of master LVM sector, zero if non-existant
2354MasterLVMLBA dd ?
2355
2356
2357; -----------------------------------------------------------------------------
2358; I13X BUFFER
2359; -----------------------------------------------------------------------------
2360;
2361; Temporary buffer for 48h INT13X bios call.
2362;
2363
2364 ; Size of the buffer.
2365 ; this param *must* be filled in.
2366 ; Code inserts it.
2367i13xbuf dw 1 dup (?)
2368
2369 ; The buffer itself.
2370 db 126 dup(?)
2371
2372 ; Size of buffer calculated.
2373 ; (excluding the size word at the start).
2374 i13xbuf_size = $-offset i13xbuf-2
2375
2376 ; Some debug area.
2377ott db 512 dup(?)
2378
2379
2380; End of transient variables.
2381EndOfVariables:
2382
2383
2384
2385
2386; -----------------------------------------------------------------------------
2387; OLD AND NEW STACKS
2388; -----------------------------------------------------------------------------
2389
2390;
2391; These need to be outside the variable section because AiR-BOOT can restart
2392; itself in debug-mode. If the OldSP and OldSS would be in the variable area,
2393; they would be cleared on AiR-BOOT restart.
2394;
2395
2396; The variable section is cleared word-wise, so it could clear one byte extra
2397; depending on the alignment and size. This DD prevents the OldSP and OldSS
2398; to be partly overwritten by the clearing routine.
2399 dd ?
2400
2401; SS:SP from before our relocation.
2402; The registers values when the BIOS transferred control to us were pushed
2403; on this stack.
2404
2405OldSP dw ?
2406OldSS dw ?
2407
2408; SS:SP currently in use.
2409; They are temporarily dumped here so we can pop the resgisters from
2410; the old stack to display them in debug mode.
2411CurrentSP dw ?
2412CurrentSS dw ?
2413
2414
2415
2416;
2417; End of BSS segment.
2418;
2419eobss:
2420
2421;
2422; Close BSS segment.
2423;
2424IFDEF SEGMENTED
2425 VOLATILE ENDS
2426ELSE
2427 LDRIMAGE ENDS
2428ENDIF
2429
2430 END AiR_BOOT
2431
Note: See TracBrowser for help on using the repository browser.