source: trunk/bootcode/airboot.asm@ 185

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

Made non-EN language versions build again [v1.1.1-testing]

This was done by excuding the FX-module for non-EN builds.
Because the EN-build for REALEASE-v1.1.2 was already distributed with
ArcaOS v5, that is the only build with FX still included.

When FX is not compiled-in and Cooper Bars is enabled in the SETUP,
the TAB-key used for switching between MENU and PRE-BOOT screens will
not work.

Upcoming releases will completely remove FX related code and SETUP
options.

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.0-manual.pdf

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