| 1 |
|
|---|
| 2 | ; Disclaimer:
|
|---|
| 3 | ;=============
|
|---|
| 4 | ; The sourcecode is released via www.netlabs.org CVS *ONLY*.
|
|---|
| 5 | ; You MUST NOT upload it to other servers nor republish it in any way.
|
|---|
| 6 | ; The sourcecode is still COPYRIGHTED and NOT RELEASED UNDER GPL.
|
|---|
| 7 | ; It's (c) Copyright 1998-2003 by Martin Kiewitz.
|
|---|
| 8 | ; You may recompile the source and do *PRIVATE* modifications, but please keep
|
|---|
| 9 | ; in mind that modifying this code needs at least *some* assembly skill. If
|
|---|
| 10 | ; you mess up your system, because you needed to hack your way through, don't
|
|---|
| 11 | ; blame me. Releasing a customized version of AiR-BOOT, selling it in any form
|
|---|
| 12 | ; or reusing parts of this source is *PROHIBITED*. Ask me, if you have some
|
|---|
| 13 | ; idea about new functionality *before* developing the code, otherwise I will
|
|---|
| 14 | ; definitely reject it. Also please accept, that I have some basic design
|
|---|
| 15 | ; rules on AiR-BOOT and I will maintain them at all costs, so this won't get
|
|---|
| 16 | ; another GRUB.
|
|---|
| 17 |
|
|---|
| 18 | ;---------------------------------------------------------------------------
|
|---|
| 19 | ; AiR-BOOT / MAIN-CODE
|
|---|
| 20 | ;---------------------------------------------------------------------------
|
|---|
| 21 |
|
|---|
| 22 | ; If ReleaseCode is not defined, it will produce debug-able code...
|
|---|
| 23 | ReleaseCode equ -1
|
|---|
| 24 | ; ReleaseCommercial equ -1
|
|---|
| 25 |
|
|---|
| 26 | JUMPS
|
|---|
| 27 |
|
|---|
| 28 | ; All Special Equs for this project
|
|---|
| 29 |
|
|---|
| 30 | IFDEF ReleaseCode
|
|---|
| 31 | ExecBaseSeg equ 00000h
|
|---|
| 32 | ExecBasePtr equ 07C00h ; BIOS starts our MBR at 0:7C00
|
|---|
| 33 | ELSE
|
|---|
| 34 | ExecBaseSeg equ 03567h ; Adjust to DOS segment
|
|---|
| 35 | ExecBasePtr equ 00100h
|
|---|
| 36 | ENDIF
|
|---|
| 37 | BootBaseSeg equ 8000h
|
|---|
| 38 | BootBasePtr equ 0h ; We put our MBR to this location
|
|---|
| 39 | BootBaseExec equ BootBasePtr+offset MBR_RealStart
|
|---|
| 40 | StackSeg equ 7000h
|
|---|
| 41 |
|
|---|
| 42 | VideoIO_Page0 equ 0B800h
|
|---|
| 43 | VideoIO_Page1 equ 0B900h
|
|---|
| 44 | VideoIO_Page2 equ 0BA00h
|
|---|
| 45 | VideoIO_Page4 equ 0BC00h
|
|---|
| 46 | VideoIO_FXSegment equ 0A000h
|
|---|
| 47 |
|
|---|
| 48 | Include ..\..\..\JimiHelp\asm.inc\stdmacro.inc
|
|---|
| 49 | Include ..\INSTALL\GLOBAL.ASM\airboot.inc
|
|---|
| 50 |
|
|---|
| 51 | TextChar_WinLineRight equ 0C4h ; 'Ä'
|
|---|
| 52 | TextChar_WinLineDown equ 0B3h ; '³'
|
|---|
| 53 | TextChar_WinRep1 equ 0D1h ; 'Ñ'
|
|---|
| 54 | TextChar_WinRep2 equ 0C5h ; 'Å'
|
|---|
| 55 | TextChar_WinRep3 equ 0CFh ; 'Ï'
|
|---|
| 56 | TextChar_WinRep4 equ 0B5h ; 'µ'
|
|---|
| 57 | TextChar_WinRep5 equ 0C6h ; 'Æ'
|
|---|
| 58 | TextChar_WinRep6 equ 0D8h ; 'Ø'
|
|---|
| 59 |
|
|---|
| 60 | ; Offsets for Partition-Entries in MBR/EPRs
|
|---|
| 61 | LocBRPT_LenOfEntry equ 16
|
|---|
| 62 | LocBRPT_Flags equ 0
|
|---|
| 63 | LocBRPT_BeginCHS equ 1
|
|---|
| 64 | LocBRPT_BeginHead equ 1
|
|---|
| 65 | LocBRPT_BeginSector equ 2
|
|---|
| 66 | LocBRPT_BeginCylinder equ 3
|
|---|
| 67 | LocBRPT_SystemID equ 4
|
|---|
| 68 | LocBRPT_EndCHS equ 5
|
|---|
| 69 | LocBRPT_EndHead equ 5
|
|---|
| 70 | LocBRPT_EndSector equ 6
|
|---|
| 71 | LocBRPT_EndCylinder equ 7
|
|---|
| 72 | LocBRPT_RelativeBegin equ 8
|
|---|
| 73 | LocBRPT_AbsoluteLength equ 12
|
|---|
| 74 |
|
|---|
| 75 | LocBR_Magic equ 510
|
|---|
| 76 |
|
|---|
| 77 | ; Offsets for IPT (Internal Partition Table)
|
|---|
| 78 | LocIPT_MaxPartitions equ 30 ; Maximum LocIPT_MaxPartitions
|
|---|
| 79 | LocIPT_LenOfSizeElement equ 6 ; Size of one Size-Element
|
|---|
| 80 | LocIPT_LenOfIPT equ 34
|
|---|
| 81 | LocIPT_Serial equ 0
|
|---|
| 82 | LocIPT_Name equ 4
|
|---|
| 83 | LocIPT_Drive equ 15 ; Drive-ID
|
|---|
| 84 | LocIPT_SystemID equ 16 ; Partition-Type
|
|---|
| 85 | LocIPT_Flags equ 17 ; AiR-BOOT Flags for partition
|
|---|
| 86 | LocIPT_BootRecordCRC equ 18 ; CRC of Boot-Record
|
|---|
| 87 | LocIPT_LocationBegin equ 20 ; Begin of Partition
|
|---|
| 88 | LocIPT_LocationPartTable equ 23 ; PartitionTable of Partition
|
|---|
| 89 | LocIPT_AbsoluteBegin equ 26 ; Absolute Sector of Begin
|
|---|
| 90 | LocIPT_AbsolutePartTable equ 30 ; Absolute Sector of PartTable
|
|---|
| 91 |
|
|---|
| 92 | LocIPT_DefaultFlags equ 00000011b ; Don't know if boot-able :)
|
|---|
| 93 | LocIPT_DefaultNonBootFlags equ 00000010b ; ...VIBR Detection is always on
|
|---|
| 94 |
|
|---|
| 95 | Flags_BootAble equ 00000001b
|
|---|
| 96 | Flags_VIBR_Detection equ 00000010b
|
|---|
| 97 | Flags_HideFeature equ 00000100b
|
|---|
| 98 | Flags_DriveLetter equ 00001000b ; OS/2 FAT16/HPFS only
|
|---|
| 99 | Flags_ExtPartMShack equ 00010000b ; Extended Partition M$-Hack req ?
|
|---|
| 100 | Flags_NoPartName equ 01000000b
|
|---|
| 101 | Flags_NowFound equ 10000000b ; temp only in OldPartTable
|
|---|
| 102 | Flags_SpecialMarker equ 10000000b ; temp only for HiddenSetup
|
|---|
| 103 |
|
|---|
| 104 | FileSysFlags_BootAble equ 00000001b ; Is this Partition boot-able ?
|
|---|
| 105 | FileSysFlags_FAT32 equ 00010000b ; FAT 32 specific name getting
|
|---|
| 106 | FileSysFlags_NoName equ 00100000b ; No Name - use PartitionName
|
|---|
| 107 |
|
|---|
| 108 | Keys_Up equ 48h
|
|---|
| 109 | Keys_Down equ 50h
|
|---|
| 110 | Keys_Left equ 4Bh
|
|---|
| 111 | Keys_Right equ 4Dh
|
|---|
| 112 | Keys_PageUp equ 49h
|
|---|
| 113 | Keys_PageDown equ 51h
|
|---|
| 114 | Keys_GrayPlus equ 4Eh
|
|---|
| 115 | Keys_GrayMinus equ 4Ah
|
|---|
| 116 | Keys_Plus equ 1Bh
|
|---|
| 117 | Keys_Minus equ 35h
|
|---|
| 118 | Keys_Enter equ 1Ch
|
|---|
| 119 | Keys_ESC equ 1h
|
|---|
| 120 | Keys_F1 equ 3Bh
|
|---|
| 121 | Keys_F10 equ 44h
|
|---|
| 122 | Keys_C equ 2Eh ; Add. Check auf Ctrl!
|
|---|
| 123 | Keys_Y equ 2Ch
|
|---|
| 124 | Keys_Z equ 15h
|
|---|
| 125 | Keys_N equ 31h
|
|---|
| 126 | Keys_TAB equ 0Fh
|
|---|
| 127 | Keys_Delete equ 53h
|
|---|
| 128 | Keys_Backspace equ 0Eh
|
|---|
| 129 | Keys_Space equ 20h
|
|---|
| 130 |
|
|---|
| 131 | Keys_Flags_EnterSetup equ 1100b ; Strg+Alt (AL)
|
|---|
| 132 |
|
|---|
| 133 | .386p
|
|---|
| 134 | model large, basic
|
|---|
| 135 |
|
|---|
| 136 | code_seg segment public use16
|
|---|
| 137 | assume cs:code_seg, ds:code_seg, es:nothing, ss:nothing
|
|---|
| 138 |
|
|---|
| 139 | org 00000h ; Sector 1
|
|---|
| 140 | ;---------------------------------------------------------------------------
|
|---|
| 141 | AiR_BOOT: cli
|
|---|
| 142 | db 0EBh ; JMP-Short -> MBR_Start
|
|---|
| 143 | db 'AiRBOOT', 02h, 03h, 20h, 03h, 01h, 01h, TXT_LanguageID
|
|---|
| 144 | ; ID String, Date and Version Number, U for US version
|
|---|
| 145 | db 1 ; Total Sectors Count,
|
|---|
| 146 | ; Will get overwritten by FIXBSET.exe
|
|---|
| 147 | MBR_CheckCode dw 0 ; Check-Sum for Code
|
|---|
| 148 |
|
|---|
| 149 | MBR_Start: sti ; This opcode is dedicated to:
|
|---|
| 150 | cld ; =FUCK MICROSOFT=
|
|---|
| 151 | mov ax, ExecBaseSeg ; fuck every M$-coder,
|
|---|
| 152 | mov ds, ax ; fuck every M$-executive,
|
|---|
| 153 | mov si, ExecBasePtr ; fuck every M$-supporter and
|
|---|
| 154 | mov ax, BootBaseSeg ; fuck everyone that is working for
|
|---|
| 155 | mov es, ax ; that evil business. k?thx
|
|---|
| 156 | mov di, BootBasePtr
|
|---|
| 157 | IFDEF ReleaseCode
|
|---|
| 158 | mov cx, 256
|
|---|
| 159 | ELSE
|
|---|
| 160 | mov cx, 32700
|
|---|
| 161 | ENDIF
|
|---|
| 162 | rep movsw
|
|---|
| 163 | db 0EAh
|
|---|
| 164 | dw BootBaseExec
|
|---|
| 165 | dw BootBaseSeg
|
|---|
| 166 | ; jmp far ptr BootBaseSeg:BootBaseExec
|
|---|
| 167 |
|
|---|
| 168 | MBR_HaltSystem:
|
|---|
| 169 | mov ax, 8600h
|
|---|
| 170 | xor cx, cx
|
|---|
| 171 | mov dx, 500
|
|---|
| 172 | int 15h ; Wait to display the whole screen :]
|
|---|
| 173 | MBR_FuckUpSys:cli
|
|---|
| 174 | jmp MBR_FuckUpSys
|
|---|
| 175 |
|
|---|
| 176 | db 'FUCKMS:>'
|
|---|
| 177 | jmp MBR_Start ; WE HAVE TO DO THIS CAUSE MICKEYSOFT
|
|---|
| 178 | ; This needs to be at THIS fixed
|
|---|
| 179 | ; location, don't modify it.
|
|---|
| 180 |
|
|---|
| 181 | db 'LOAD ERROR!', 0
|
|---|
| 182 | MBR_LoadError Proc Near Uses
|
|---|
| 183 | mov si, offset $-12
|
|---|
| 184 | push cs
|
|---|
| 185 | pop ds
|
|---|
| 186 | call MBR_Teletype
|
|---|
| 187 | MBRLE_Halt:
|
|---|
| 188 | jmp MBRLE_Halt
|
|---|
| 189 | MBR_LoadError EndP
|
|---|
| 190 |
|
|---|
| 191 | db 'SAVE ERROR!', 0
|
|---|
| 192 | MBR_SaveError Proc Near Uses
|
|---|
| 193 | mov si, offset $-12
|
|---|
| 194 | push cs
|
|---|
| 195 | pop ds
|
|---|
| 196 | call MBR_Teletype
|
|---|
| 197 | MBRSE_Halt:
|
|---|
| 198 | jmp MBRSE_Halt
|
|---|
| 199 | MBR_SaveError EndP
|
|---|
| 200 |
|
|---|
| 201 | ; In: SI - Pointer to begin of string (EOS is 0)
|
|---|
| 202 | ; Destroyed: SI
|
|---|
| 203 | MBR_Teletype Proc Near Uses ax bx cx
|
|---|
| 204 | mov ah, 0Eh
|
|---|
| 205 | mov bx, 7
|
|---|
| 206 | MBRT_Loop:
|
|---|
| 207 | lodsb
|
|---|
| 208 | or al, al
|
|---|
| 209 | jz MBRT_End
|
|---|
| 210 | int 10h
|
|---|
| 211 | jmp MBRT_Loop
|
|---|
| 212 | MBRT_End:
|
|---|
| 213 | ret
|
|---|
| 214 | MBR_Teletype EndP
|
|---|
| 215 |
|
|---|
| 216 | ; In: BX - Base Check, DS:SI - Pointer to 512-byte-area to be included
|
|---|
| 217 | ; Out: BX - Base Check Result
|
|---|
| 218 | ; Destroyed: SI will get updated (+512)
|
|---|
| 219 | MBR_GetCheckOfSector Proc Near Uses ax cx
|
|---|
| 220 | mov cx, 256
|
|---|
| 221 | MBRGCOS_Loop:
|
|---|
| 222 | lodsw
|
|---|
| 223 | xor ax, 0BABEh
|
|---|
| 224 | xor bx, ax
|
|---|
| 225 | loop MBRGCOS_Loop
|
|---|
| 226 | or bx, bx
|
|---|
| 227 | jnz MBRGCOS_NoFixUp
|
|---|
| 228 | mov bx, 1 ; dont allow 0, cause 0 == empty
|
|---|
| 229 | MBRGCOS_NoFixUp:
|
|---|
| 230 | ret
|
|---|
| 231 | MBR_GetCheckOfSector EndP
|
|---|
| 232 |
|
|---|
| 233 | ;---------------------------------------------------------------------------
|
|---|
| 234 | MBR_RealStart:
|
|---|
| 235 | mov ax, StackSeg
|
|---|
| 236 | mov ss, ax
|
|---|
| 237 | mov sp, 7FFFh
|
|---|
| 238 | mov ax, es
|
|---|
| 239 | mov ds, ax ; Set DS==ES to Code Segment
|
|---|
| 240 | IFNDEF ReleaseCode
|
|---|
| 241 | jmp AiR_BOOT_Start
|
|---|
| 242 | ENDIF
|
|---|
| 243 | ; Load missing parts from harddrive...
|
|---|
| 244 | mov ax, cs
|
|---|
| 245 | mov es, ax
|
|---|
| 246 | mov bx, offset Configuration
|
|---|
| 247 | mov dx, 0080h ; First harddrive, Sector 55
|
|---|
| 248 | mov cx, 0037h
|
|---|
| 249 | mov ax, 0205h ; Read 5 sectors
|
|---|
| 250 | int 13h
|
|---|
| 251 | jnc MBR_ConfigCopy_NoError
|
|---|
| 252 | call MBR_LoadError ; Will Abort BootUp
|
|---|
| 253 | MBR_ConfigCopy_NoError:
|
|---|
| 254 | mov bx, offset FurtherMoreLoad
|
|---|
| 255 | mov dx, 0080h ; First harddrive, Sector 2
|
|---|
| 256 | mov cx, 0002h
|
|---|
| 257 | mov ah, 02h
|
|---|
| 258 | mov al, ds:[TotalSectorsUsedPtr]
|
|---|
| 259 | int 13h
|
|---|
| 260 | jnc MBR_RealStart_NoError
|
|---|
| 261 | call MBR_LoadError ; Will Abort BootUp
|
|---|
| 262 | MBR_RealStart_NoError:
|
|---|
| 263 | ; Now Check Code with CheckSum
|
|---|
| 264 | mov si, offset FurtherMoreLoad
|
|---|
| 265 | movzx cx, bptr ds:[TotalSectorsUsedPtr]
|
|---|
| 266 | xor bx, bx
|
|---|
| 267 | MBR_RealStart_CheckCodeLoop:
|
|---|
| 268 | call MBR_GetCheckOfSector
|
|---|
| 269 | loop MBR_RealStart_CheckCodeLoop
|
|---|
| 270 | cmp MBR_CheckCode, bx
|
|---|
| 271 | je MBR_RealStart_CheckSuccess
|
|---|
| 272 | mov si, offset TXT_ERROR_Attention
|
|---|
| 273 | call MBR_Teletype
|
|---|
| 274 | mov si, offset TXT_ERROR_CheckCode
|
|---|
| 275 | call MBR_Teletype
|
|---|
| 276 | mov si, offset TXT_ERROR_CheckFailed
|
|---|
| 277 | call MBR_Teletype
|
|---|
| 278 | jmp MBR_HaltSystem
|
|---|
| 279 | MBR_RealStart_CheckSuccess:
|
|---|
| 280 | jmp AiR_BOOT_Start
|
|---|
| 281 |
|
|---|
| 282 | ;---------------------------------------------------------------------------
|
|---|
| 283 | Include TEXT\TXTMBR.asm ; All translateable Text in MBR
|
|---|
| 284 | ;---------------------------------------------------------------------------
|
|---|
| 285 | org 00200h ; Sector 2
|
|---|
| 286 | ; Everything beyond this point is loaded on startup and is NOT existant at first
|
|---|
| 287 | FurtherMoreLoad:
|
|---|
| 288 | ; first Normal-Partition-ID, Hidden-Partition-ID
|
|---|
| 289 | ; and Default-Partition-Flags.
|
|---|
| 290 | ; 01h -> Boot-Able
|
|---|
| 291 | ; 10h -> FAT32 - Name Getting Scheme
|
|---|
| 292 | ; 20h -> No Name To Get (use Partition Name)
|
|---|
| 293 | db 'AiRSYS-TABLE'
|
|---|
| 294 | FileSysIDs: db 01h, 11h,01h, 04h,014h,01h, 06h,016h,01h, 0Eh,00Eh,01h
|
|---|
| 295 | db 07h, 17h,01h, 08h,017h,21h, 35h,035h,00h,0EBh,0EBh,01h
|
|---|
| 296 | db 09h, 19h,11h, 0Bh,01Bh,11h, 0Ch,01Ch,11h, 01h,001h,01h
|
|---|
| 297 | db 63h, 63h,21h, 81h,081h,21h, 83h,083h,21h, 40h,040h,21h
|
|---|
| 298 | db 0A5h,0A5h,21h,0A6h,0A6h,21h, 82h,082h,20h,0A7h,0A7h,21h
|
|---|
| 299 | db 63h, 63h,21h, 4Dh,04Dh,21h, 4Eh,04Eh,21h, 4Fh,04Fh,21h
|
|---|
| 300 | db 01h, 01h,01h, 01h,001h,01h, 01h,001h,01h, 01h,001h,01h
|
|---|
| 301 | db 01h, 01h,01h, 01h,001h,01h, 01h,001h,01h, 01h,001h,01h
|
|---|
| 302 | db 01h, 01h,01h, 01h,001h,01h, 01h,001h,01h, 01h,001h,01h
|
|---|
| 303 | db 01h, 01h,01h,0FDh,0FDh,20h, 84h,084h,20h,0A0h,0A0h,20h
|
|---|
| 304 | db 0Ah, 0Ah,20h,0FEh,0FEh,21h,0FFh,0FFh,21h, 00h,000h,21h
|
|---|
| 305 | db 16 dup (0)
|
|---|
| 306 |
|
|---|
| 307 | FileSysNames: db 'FAT12 ', 'FAT16 ', 'FAT16Big', 'FAT16Big'
|
|---|
| 308 | db 'HPFS ', 'NTFS ', 'LVM-Data', 'BeOS '
|
|---|
| 309 | db 'FAT32 ', 'FAT32 ', 'FAT32 ', ' '
|
|---|
| 310 | db 'Unix ', 'Minix ', 'Linux ', 'Venix ' ; x row ;)
|
|---|
| 311 | db 'BSD/386 ', 'OpenBSD ', 'LinuxSwp', 'NeXTSTEP'
|
|---|
| 312 | db 'GNU HURD', 'QNX ', 'QNX ', 'QNX '
|
|---|
| 313 | db ' ', ' ', ' ', ' '
|
|---|
| 314 | db ' ', ' ', ' ', ' '
|
|---|
| 315 | db ' ', ' ', ' ', ' '
|
|---|
| 316 | db ' ', 'Kernel ', ' ', '0V-Award'
|
|---|
| 317 | db 'OS/2 Man', 'via BIOS', 'Floppy ', 'Unknown '
|
|---|
| 318 | ; -> 44 Partition-Types
|
|---|
| 319 |
|
|---|
| 320 | ;---------------------------------------------------------------------------
|
|---|
| 321 | org 00400h ; Sector 3
|
|---|
| 322 | AiR_BOOT_Start: mov ax, VideoIO_Page1
|
|---|
| 323 | call VideoIO_BackUpTo ; Copy BIOS POST to Second Page
|
|---|
| 324 | mov si, offset Copyright
|
|---|
| 325 | call MBR_Teletype
|
|---|
| 326 | ; Initialize Variable-Tables, Detections, etc.
|
|---|
| 327 | call PRECRAP_Main
|
|---|
| 328 | call PARTSCAN_ScanForPartitions
|
|---|
| 329 | MBR_Main_ReEnterSetup:
|
|---|
| 330 | call SETUP_CheckEnterSETUP
|
|---|
| 331 | call AFTERCRAP_Main
|
|---|
| 332 |
|
|---|
| 333 | ; Now get FAT16-Linux Kernel Partition, If requested
|
|---|
| 334 | cmp [CFG_LinuxKrnlPartition], 0FFh
|
|---|
| 335 | je MBR_Main_NoLinuxKrnlPartition
|
|---|
| 336 | call LINUX_InitFAT16access
|
|---|
| 337 | MBR_Main_NoLinuxKrnlPartition:
|
|---|
| 338 |
|
|---|
| 339 | ; SetUp PartitionPointers for BootMenu (filter non-bootable)
|
|---|
| 340 | call PART_CalculateMenuPartPointers
|
|---|
| 341 |
|
|---|
| 342 | ; ...and count that one...
|
|---|
| 343 | cmp PartitionPointerCount, 0
|
|---|
| 344 | jne MBR_Main_SomethingBootAble
|
|---|
| 345 | mov si, offset TXT_NoBootAble
|
|---|
| 346 | call MBR_Teletype
|
|---|
| 347 | jmp MBR_HaltSystem
|
|---|
| 348 |
|
|---|
| 349 | MBR_Main_SomethingBootAble:
|
|---|
| 350 | ; FixUp Values, define Timed Setup booting, etc.
|
|---|
| 351 | call PART_FixUpDefaultPartitionValues
|
|---|
| 352 |
|
|---|
| 353 | ; -------------------------------------------------- BOOT-MENU
|
|---|
| 354 | MBR_Main_ReEnterBootMenu:
|
|---|
| 355 | call BOOTMENU_ResetMenuVars ; reset has to be done
|
|---|
| 356 | test CFG_AutomaticBoot, 1
|
|---|
| 357 | jz MBR_Main_NoAutomaticBooting
|
|---|
| 358 | ; ------------------------------------------ AUTOMATIC BOOTING
|
|---|
| 359 | ; Select automatic partition, disable automatic booting for
|
|---|
| 360 | ; next time and boot system...
|
|---|
| 361 | mov CFG_AutomaticBoot, 0
|
|---|
| 362 | call PASSWORD_AskSystemPwd
|
|---|
| 363 | mov al, Menu_EntryAutomatic
|
|---|
| 364 | mov Menu_EntrySelected, al
|
|---|
| 365 | jmp MBR_Main_NoBootMenu
|
|---|
| 366 |
|
|---|
| 367 | MBR_Main_NoAutomaticBooting:
|
|---|
| 368 | test CFG_BootMenuActive, 0FFh
|
|---|
| 369 | jnz MBR_Main_GotBootMenu
|
|---|
| 370 | ; ----------------------------------------------- NO BOOT-MENU
|
|---|
| 371 | ; Select default partition and boot system...
|
|---|
| 372 | call PASSWORD_AskSystemPwd
|
|---|
| 373 | mov al, Menu_EntryDefault
|
|---|
| 374 | mov Menu_EntrySelected, al
|
|---|
| 375 | jmp MBR_Main_NoBootMenu
|
|---|
| 376 |
|
|---|
| 377 | MBR_Main_GotBootMenu:
|
|---|
| 378 | ; ------------------------------------------ BOOT-MENU VISUALS
|
|---|
| 379 | call FX_StartScreen
|
|---|
| 380 | call BOOTMENU_BuildBackground
|
|---|
| 381 | call BOOTMENU_BuildMain
|
|---|
| 382 | call FX_EndScreenRight
|
|---|
| 383 | call PASSWORD_AskSystemPwd
|
|---|
| 384 | call BOOTMENU_ResetTimedBoot
|
|---|
| 385 | call BOOTMENU_Execute
|
|---|
| 386 | jc MBR_Main_ReEnterSetup
|
|---|
| 387 | call BOOTMENU_SetVarsAfterMenu
|
|---|
| 388 | ; ------------------------------------------------- BOOTING...
|
|---|
| 389 | MBR_Main_NoBootMenu:
|
|---|
| 390 | call FX_StartScreen
|
|---|
| 391 | call BOOTMENU_BuildGoodBye
|
|---|
| 392 | call FX_EndScreenRight
|
|---|
| 393 | call PASSWORD_AskChangeBootPwd
|
|---|
| 394 |
|
|---|
| 395 | IFNDEF ReleaseCode
|
|---|
| 396 | mov ax, 6200h
|
|---|
| 397 | int 21h
|
|---|
| 398 | mov es, bx
|
|---|
| 399 | mov ax, 4C00h ; Quit program
|
|---|
| 400 | int 21h
|
|---|
| 401 | ENDIF
|
|---|
| 402 | call ANTIVIR_SaveBackUpMBR
|
|---|
| 403 | mov dl, Menu_EntrySelected
|
|---|
| 404 | call PART_StartPartition
|
|---|
| 405 |
|
|---|
| 406 | Include REGULAR\STD_TEXT.asm ; Standard (non-translateable text)
|
|---|
| 407 | Include REGULAR\DRIVEIO.asm ; Drive I/O, Config Load/Save
|
|---|
| 408 | Include REGULAR\ViDEOIO.asm ; Video I/O
|
|---|
| 409 | Include REGULAR\TIMER.asm ; Timer
|
|---|
| 410 | Include REGULAR\PARTMAIN.asm ; Regular Partition Routines
|
|---|
| 411 | Include REGULAR\PARTSCAN.asm ; Partition Scanning
|
|---|
| 412 | Include REGULAR\BOOTMENU.asm ; Boot-Menu
|
|---|
| 413 | Include REGULAR\PASSWORD.asm ; Password related
|
|---|
| 414 | Include REGULAR\OTHER.asm ; Other Routines
|
|---|
| 415 |
|
|---|
| 416 | Include SETUP\MAiN.ASM ; The whole AiR-BOOT SETUP
|
|---|
| 417 | Include SPECiAL\ViRUS.asm ; Virus Detection / Anti-Virus
|
|---|
| 418 | Include SPECiAL\FAT16.asm ; FAT-16 Support
|
|---|
| 419 | Include SPECiAL\LINUX.asm ; Linux Kernel Support
|
|---|
| 420 | Include SPECiAL\F00K\BILLSUXX.asm ; Extended Partition - Micro$haft-Hack
|
|---|
| 421 | Include SPECiAL\SOUND.asm ; Sound
|
|---|
| 422 | Include SPECiAL\APM.asm ; Power Managment Support
|
|---|
| 423 | Include SPECiAL\FX.asm ; l33t Cooper-Bars/Scrolling <bg>
|
|---|
| 424 | IFDEF TXT_IncludeCyrillic
|
|---|
| 425 | Include SPECiAL\CHARSET.asm ; Charset Support (e.g. Cyrillic)
|
|---|
| 426 | ENDIF
|
|---|
| 427 |
|
|---|
| 428 | ;---------------------------------------------------------------------------
|
|---|
| 429 | org 04600h ; Sector 36-37
|
|---|
| 430 | MBR_Protection: db 'AiR-BOOT MBR-Protection Image'
|
|---|
| 431 | ; Hardcoded to 1k (1024 bytes)
|
|---|
| 432 |
|
|---|
| 433 | ;---------------------------------------------------------------------------
|
|---|
| 434 | org 04A00h ; Sector 38-x
|
|---|
| 435 | Include TEXT\TXTOTHER.asm ; All translateable Text-Strings
|
|---|
| 436 | Include TEXT\TXTMENUS.asm ; All translateable Menu-text
|
|---|
| 437 | Include TEXT\CHARSET.asm ; Special Video Charsets (if needed)
|
|---|
| 438 |
|
|---|
| 439 | ;---------------------------------------------------------------------------
|
|---|
| 440 | org 06C00h ; Sector 55
|
|---|
| 441 | Configuration:
|
|---|
| 442 | db 'AiRCFG-TABLE'
|
|---|
| 443 | db 01h, 00h, 'U' ; "Compressed" ID String
|
|---|
| 444 |
|
|---|
| 445 | CFG_LastTimeEditLow dw 0 ; Last Time Edited Stamp (will incr every setup)
|
|---|
| 446 | CFG_LastTimeEditHi dw 0 ; second 16 bit part...
|
|---|
| 447 |
|
|---|
| 448 | CFG_CheckConfig dw 0 ; Check-Sum for Configuration
|
|---|
| 449 |
|
|---|
| 450 | CFG_Partitions db 0 ; Count of partitions in IPT
|
|---|
| 451 | db 0 ; Was BootParts - Removed since v0.28b
|
|---|
| 452 | CFG_PartDefault db 0 ; Default-Partition (Base=0)
|
|---|
| 453 |
|
|---|
| 454 | CFG_PartLast db 0 ; Which Partition was booted last time ? (Base=0)
|
|---|
| 455 | CFG_TimedBoot db 1 ; Timed Boot Enable (for REAL Enable look TimedBootEnable)
|
|---|
| 456 | CFG_TimedSecs db 15 ; Timed Boot - How Many Seconds Till Boot
|
|---|
| 457 | CFG_TimedDelay dw 123 ; Timed Boot - Delay
|
|---|
| 458 | CFG_TimedBootLast db 0 ; Timed Boot - Boot From Last Drive Booted From
|
|---|
| 459 | CFG_RememberBoot db 1 ; Remember Manual Boot Choice
|
|---|
| 460 | CFG_RememberTimed db 0 ; Remember if Timed Boot (if both disabled: Boot Default)
|
|---|
| 461 | CFG_IncludeFloppy db 1 ; Include Floppy Drives in Boot-Menu
|
|---|
| 462 | CFG_BootMenuActive db 1 ; Display Boot-Menu (if Disabled: Boot Default)
|
|---|
| 463 | ; v0.29+ -> 2 - Detailed Bootmenu
|
|---|
| 464 | CFG_PartitionsDetect db 1 ; Autodetect New Partitions (Auto-Add!)
|
|---|
| 465 | CFG_PasswordSetup db 0 ; Ask Password when entering Setup
|
|---|
| 466 | CFG_PasswordSystem db 0 ; Ask Password when booting System
|
|---|
| 467 | CFG_PasswordChangeBoot db 0 ; Ask Password when changing boot partition
|
|---|
| 468 | CFG_ProtectMBR db 0 ; Protect MBR via TSR ?
|
|---|
| 469 | CFG_IgnoreWriteToMBR db 0 ; Just ignore writes to MBR, otherwise crash
|
|---|
| 470 | CFG_FloppyBootGetName db 0 ; Gets floppy name for display purposes
|
|---|
| 471 | CFG_DetectVirus db 1 ; Detect Virus ?
|
|---|
| 472 | CFG_DetectStealth db 1 ; Detect Stealth-Virus ?
|
|---|
| 473 | CFG_DetectVIBR db 1 ; Detect BootRecord-Virus ?
|
|---|
| 474 | CFG_AutoEnterSetup db 1 ; Automatic Enter Setup (first install!)
|
|---|
| 475 | CFG_MasterPassword dw 0101Fh ; Encoded Password (this is just CR)
|
|---|
| 476 | dw 07A53h
|
|---|
| 477 | dw 0E797h
|
|---|
| 478 | dw 0A896h
|
|---|
| 479 | CFG_BootPassword dw 0101Fh ; Another CR... ;-)
|
|---|
| 480 | dw 07A53h
|
|---|
| 481 | dw 0E797h
|
|---|
| 482 | dw 0A896h
|
|---|
| 483 | db 0 ; Rude-Protection - Removed since v0.28b
|
|---|
| 484 | CFG_LinuxRootPartition db 0 ; Linux Root Partition (Base=0)
|
|---|
| 485 | CFG_TimedKeyHandling db 0 ; Timed Key Handling (for Timed Boot)
|
|---|
| 486 | ; 0 - Do Nothing
|
|---|
| 487 | ; 1 - Reset Time
|
|---|
| 488 | ; 2 - Stop Time
|
|---|
| 489 | CFG_MakeSound db 0 ; Should be clear ;)
|
|---|
| 490 | CFG_FloppyBootGetTimer db 0 ; Floppy Name will get updated every 2 secs
|
|---|
| 491 | CFG_ResumeBIOSbootSeq db 0 ; If BIOS Boot Sequence should be resumed
|
|---|
| 492 | ; 0 - Disabled
|
|---|
| 493 | ; 1 - CD-ROM
|
|---|
| 494 | ; 2 - Network
|
|---|
| 495 | ; 3 - ZIP/LS120
|
|---|
| 496 | CFG_CooperBars db 0 ; If Cooper Bars should be shown
|
|---|
| 497 | CFG_LinuxCommandLine db 75 dup (0) ; Linux Command Line
|
|---|
| 498 | CFG_LinuxKrnlPartition db 0FFh ; FAT-16 Linux Kernel Partition (Base=0)
|
|---|
| 499 | ; FFh -> Disabled
|
|---|
| 500 | CFG_LinuxDefaultKernel db 'DEFAULT', 4 dup (32), 0 ; Default Kernel Name
|
|---|
| 501 | CFG_LinuxLastKernel db 11 dup (32), 0 ; Last-Booted Kernel Name
|
|---|
| 502 | CFG_ExtPartitionMShack db 0 ; Extended Partition M$-Hack Global Enable
|
|---|
| 503 | CFG_AutomaticBoot db 0 ; Automatic Booting (only one bootup)
|
|---|
| 504 | CFG_PartAutomatic db 0 ; Partition-No for automatic booting
|
|---|
| 505 | CFG_ForceLBAUsage db 0 ; LBA-BIOS-API forced on any HDD I/O
|
|---|
| 506 |
|
|---|
| 507 | ; VIR variables are for the AiR-BOOT Anti Virus Code
|
|---|
| 508 | ; Most of them are backups of Interrupt Points, so we can check, if a
|
|---|
| 509 | ; stealth virus is on-line, we can intercept its call.
|
|---|
| 510 | ; Normal (non stealth) virus are trapped simply by rereading the MBR sector.
|
|---|
| 511 | ; If a virus is found, we will restore MBR from Sektor 60 and stop the system
|
|---|
| 512 | ; from working, so the user has to press reset. That's saver than a Reboot.
|
|---|
| 513 | ;
|
|---|
| 514 | ; If a virus is found on the partition to boot, the system will ONLY halt,
|
|---|
| 515 | ; nothing more, because we can not remove it. The user shall do it :)
|
|---|
| 516 | ; Those viruses are detected via a real nasty method...Checksum-Checking of the
|
|---|
| 517 | ; boot-record, which is to be executed. If it does not match the one in our
|
|---|
| 518 | ; internal partition table, we will stop. You may however switch this detection
|
|---|
| 519 | ; off or just reset it by switching 'VIBR Detection'.
|
|---|
| 520 |
|
|---|
| 521 | org 06DABh ; 427 Boundry
|
|---|
| 522 | AutoDrvLetter db 0
|
|---|
| 523 | AutoDrvLetterSerial dd 0
|
|---|
| 524 |
|
|---|
| 525 | BIOScontIPTentry:
|
|---|
| 526 | db 0, 0, 0, 0, ' '
|
|---|
| 527 | db 0, 0FEh, Flags_BootAble
|
|---|
| 528 | dw 0 ; No Checksum :)
|
|---|
| 529 | db 0, 1, 0
|
|---|
| 530 | db 0, 1, 0 ; Location of Partition/Boot Record
|
|---|
| 531 | dd 0, 0
|
|---|
| 532 |
|
|---|
| 533 | ; 466 Sub-Part
|
|---|
| 534 | CFG_VIR_INT08 dd 0 ; pointer to saved 08h entry point
|
|---|
| 535 | CFG_VIR_INT13 dd 0 ; pointer to saved 13h entry point
|
|---|
| 536 | CFG_VIR_INT1C dd 0 ; pointer to saved 1Ch entry point
|
|---|
| 537 |
|
|---|
| 538 | ; 478 Boundry
|
|---|
| 539 | FloppyIPTentry: db 0, 0, 0, 0, 'FloppyDrive'
|
|---|
| 540 | db 0, 0FFh, Flags_BootAble
|
|---|
| 541 | dw 0 ; No Checksum :)
|
|---|
| 542 | db 0, 1, 0
|
|---|
| 543 | db 0, 1, 0 ; Location of Partition/Boot Record
|
|---|
| 544 | dd 0, 0
|
|---|
| 545 | ;---------------------------------------------------------------------------
|
|---|
| 546 | org 06E00h ; Sector 56-57
|
|---|
| 547 | PartitionTable: ; no-partitions detected... :]
|
|---|
| 548 | ; db 1, 0, 0, 0, 'Harddisc 1'
|
|---|
| 549 | ; db 0, 0FFh, Flags_BootAble
|
|---|
| 550 | ; dw 0 ; No Checksum :)
|
|---|
| 551 | ; db 0, 0, 1
|
|---|
| 552 | ; db 0, 0, 1 ; Location of Partition/Boot Record
|
|---|
| 553 | ; dd 0, 0
|
|---|
| 554 |
|
|---|
| 555 | ; Format is:
|
|---|
| 556 | ;============
|
|---|
| 557 | ; SerialNumber * 4
|
|---|
| 558 | ; PartitionName * 11
|
|---|
| 559 | ; Drive * 1
|
|---|
| 560 | ; SystemID * 1 (means the partition type)
|
|---|
| 561 | ; Flags * 1
|
|---|
| 562 | ; Checksum * 2 (for virus checking)
|
|---|
| 563 | ; LocationBegin * 3 (where the partition begins)
|
|---|
| 564 | ; LocationPartTab * 3 (where the partition table is)
|
|---|
| 565 | ; AbsoluteBegin * 4 (where the partition begins, in absolute sectors)
|
|---|
| 566 | ; AbsolutePartTab * 4 (where the partition table is, in absolute sectors)
|
|---|
| 567 | ; --------------------> 34 Bytes (total maximum = 30)
|
|---|
| 568 |
|
|---|
| 569 | org 071F6h
|
|---|
| 570 | db 'AiRBOOTPAR' ; 1K internal partition table
|
|---|
| 571 | ;---------------------------------------------------------------------------
|
|---|
| 572 | org 07200h ; Sector 58
|
|---|
| 573 | HidePartitionTable: db 900 dup (0FFh)
|
|---|
| 574 | ; Format is:
|
|---|
| 575 | ;============
|
|---|
| 576 | ; PartitionPtr : BYTE * 30
|
|---|
| 577 | ; --------------------> 30 Bytes * 30
|
|---|
| 578 |
|
|---|
| 579 | DriveLetters: db 30 dup (0)
|
|---|
| 580 | ; Format is:
|
|---|
| 581 | ;============
|
|---|
| 582 | ; Drive-Letter : BYTE (80h-C:, 81h-D:)
|
|---|
| 583 | ; --------------------> 1 Byte * 30
|
|---|
| 584 |
|
|---|
| 585 | org 075F6h
|
|---|
| 586 | db 'AiRBOOTHID' ; 1K internal Hide-partition table
|
|---|
| 587 | ;---------------------------------------------------------------------------
|
|---|
| 588 | org 07600h ; Sector 60
|
|---|
| 589 | MBR_BackUpMBR db 'AiR-BOOT MBR-BackUp - Just to fill this sector with something'
|
|---|
| 590 |
|
|---|
| 591 | org 077FFh
|
|---|
| 592 | db 0
|
|---|
| 593 | ;---------------------------------------------------------------------------
|
|---|
| 594 | org 0A000h ; Uninitialized
|
|---|
| 595 | ; This space actually gets initialized in PreCrap to NUL (till EndOfVariables)
|
|---|
| 596 | BeginOfVariables:
|
|---|
| 597 | TmpSector: db 512 dup (?) ; Temporary Sector
|
|---|
| 598 | TmpSector2:
|
|---|
| 599 | ; Everything used to build a new IPT and reference it to the old one
|
|---|
| 600 | NewPartTable: db 1024 dup (?) ; New Partition Table
|
|---|
| 601 | NewHidePartTable: db 900 dup (?) ; New Hide-Partition Table
|
|---|
| 602 | NewDriveLetters: db 30 dup (?) ; Logical Drive-Letters
|
|---|
| 603 |
|
|---|
| 604 | PartitionSizeTable: db 180 dup (?) ; Size-Table (6 bytes per partition)
|
|---|
| 605 | PartitionPointers dw 52 dup (?) ; Maximum is 52 entries till now
|
|---|
| 606 | PartitionPointerCount db ? ; Count of total Partition Pointers
|
|---|
| 607 | PartitionXref db 30 dup (?) ; X-Reference Table
|
|---|
| 608 |
|
|---|
| 609 | TotalHarddiscs db ? ; Total harddrives (by POST)
|
|---|
| 610 | NewPartitions db ? ; Freshly found partitions
|
|---|
| 611 |
|
|---|
| 612 | VideoIO_Segment dw ? ; Segment for Video I/O
|
|---|
| 613 |
|
|---|
| 614 | ExtendedAbsPos dd ? ; Extended Partition Absolute Position
|
|---|
| 615 | ExtendedAbsPosSet db ? ; If Absolute Position set
|
|---|
| 616 |
|
|---|
| 617 | CurPartition_Location dw 4 dup (?) ; Where did current partition came from?
|
|---|
| 618 | CurIO_UseExtension db ? ; 1-Use INT 13h EXTENSIONS
|
|---|
| 619 | ; Filled out by PreCrap
|
|---|
| 620 |
|
|---|
| 621 | GotLinux db ? ; 1-Linux found
|
|---|
| 622 |
|
|---|
| 623 | Menu_EntrySelected db ? ; Which partition we boot this time...
|
|---|
| 624 | Menu_UpperPart db ? ; Which number (Base=0) is the partition upper pos
|
|---|
| 625 | Menu_AbsoluteX db ? ; Pos where Menu stuff starts
|
|---|
| 626 | Menu_TotalParts db ? ; Copy of CFG_BootParts
|
|---|
| 627 | Menu_TotalLines db ? ; Total Lines on Screen used for BootMenu
|
|---|
| 628 | Menu_EntryDefault db ? ; Default Entry in filtered View
|
|---|
| 629 | Menu_EntryLast db ? ; LastBooted Entry in filtered View
|
|---|
| 630 | Menu_EntryAutomatic db ? ; Automatic Entry in filtered View
|
|---|
| 631 | ; - All adjusted to menu locations
|
|---|
| 632 |
|
|---|
| 633 | PartSetup_UpperPart db ? ; Partition-Setup (like Menu_UpperPart)
|
|---|
| 634 | PartSetup_ActivePart db ? ; Active Partition
|
|---|
| 635 | PartSetup_HiddenUpper db ? ; (like Menu_UpperPart)
|
|---|
| 636 | PartSetup_HiddenX db ? ; Pos for Hidden-Setup
|
|---|
| 637 | PartSetup_HiddenAdd db ? ; Adjust for Hidden-Setup
|
|---|
| 638 |
|
|---|
| 639 | TimedBootEnable db ? ; Local Enable/Disable for timed boot
|
|---|
| 640 | TimedTimeOut dd ? ; TimeOut Timer for TimedBoot (too much time here ;)
|
|---|
| 641 | TimedSecondLeft db ? ; How many seconds are left till boom ?
|
|---|
| 642 | TimedSecondBack db ? ; To get a modification noticed
|
|---|
| 643 | TimedBootUsed db ? ; Timed Boot used for bootup ?
|
|---|
| 644 | FloppyGetNameTimer dd ? ; Timer for Floppy-Get-Name
|
|---|
| 645 | SETUP_KeysOnEntry db ? ; which Shift Status was there, when booting ?
|
|---|
| 646 | SETUP_ExitEvent db ? ; Exit Event to end SETUP
|
|---|
| 647 | TempPasswordEntry db 17 dup (?)
|
|---|
| 648 | SETUP_OldPwd db 17 dup (?)
|
|---|
| 649 | SETUP_NewPwd db 17 dup (?)
|
|---|
| 650 | SETUP_VerifyPwd db 17 dup (?)
|
|---|
| 651 | StartSoundPlayed db ?
|
|---|
| 652 |
|
|---|
| 653 | FX_UseCount dw ?
|
|---|
| 654 | FX_OverallTimer dw ?
|
|---|
| 655 | FX_WideScrollerTimer dw ?
|
|---|
| 656 | FX_WideScrollerCurPos dw ?
|
|---|
| 657 | FX_WideScrollerSpeed db ?
|
|---|
| 658 | FX_WideScrollerSpeedState db ?
|
|---|
| 659 | FX_WideScrollerDirection db ?
|
|---|
| 660 | FX_WideScrollerAbsDirection db ?
|
|---|
| 661 | FX_WideScrollerBounceSpeed db ?
|
|---|
| 662 | FX_CooperBarsTimer dw ?
|
|---|
| 663 |
|
|---|
| 664 | FAT16_Drive db ? ; FAT-16: Drive of FAT16-partition
|
|---|
| 665 | FAT16_AbsPartitionBegin dd ? ; FAT-16: LBA Begin of Partition
|
|---|
| 666 | FAT16_SecsPerCluster db ? ; FAT-16: Sectors Per Cluster
|
|---|
| 667 | FAT16_NumOfRootEntries dw ? ; FAT-16: Number of Root Entries
|
|---|
| 668 | FAT16_SecsPerFAT dw ? ; FAT-16: Sectors Per FAT
|
|---|
| 669 | FAT16_AbsFATBegin dd ? ; FAT-16: LBA Begin of FAT
|
|---|
| 670 | FAT16_AbsRootBegin dd ? ; FAT-16: LBA Begin of Root
|
|---|
| 671 | FAT16_AbsClusterBegin dd ? ; FAT-16: LBA Begin of Clusters
|
|---|
| 672 | FAT16_FATCacheSector db ? ; FAT-16: FAT-Sector No in Cache
|
|---|
| 673 | FAT16_FATCache db 512 dup (?) ; FAT-16: FAT-Area Cache
|
|---|
| 674 |
|
|---|
| 675 | LINUX_KernelEntries db 680 dup (?) ; 34*20 -> Space for Kernel-Entries
|
|---|
| 676 | LINUX_KernelNo db ? ; Total of Kernels in KernelEntries
|
|---|
| 677 | LINUX_KernelSizeTable db 120 dup (?) ; Size-Table (6 bytes per kernel)
|
|---|
| 678 | EndOfVariables:
|
|---|
| 679 |
|
|---|
| 680 | FX_CooperColors db 672 dup (?) ; 7 cooper bars*96 - runtime calculated
|
|---|
| 681 | FX_CooperState: db 7 dup (?)
|
|---|
| 682 | FX_SinusPos: db 7 dup (?)
|
|---|
| 683 | FX_CooperPos: dw 7 dup (?)
|
|---|
| 684 | CharsetTempBuffer db 4096 dup (?) ; Uninitialized Charset buffer
|
|---|
| 685 |
|
|---|
| 686 | code_seg ends
|
|---|
| 687 | end air_boot
|
|---|