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

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

JWasm version working [2012-02-16]

WARNING!!

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

Info

o DOS linkage calculates correct offsets
o RAW linkage calculates relative offsets (no fixups)

Problem

o Something goes wrong between the end of the image and the BSS.

Moving the BSS just after the image gives corruption.
(all floppy entries, FFH)
So, the start of the BSS gets overwrittenby something...

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