source: trunk/bootcode/airboot.asm@ 231

Last change on this file since 231 was 221, checked in by Ben Rietbroek, 8 years ago

Also disabled FX-module for EN-version [v1.1.3-testing]

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.2-manual.pdf

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