Changeset 30 for trunk/BOOTCODE/AIR-BOOT.ASM
- Timestamp:
- May 6, 2011, 4:25:19 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BOOTCODE/AIR-BOOT.ASM
r29 r30 17 17 ; 18 18 19 ; ------------------- 20 ; Rousseau: # Fixes # 21 ; ------------------- 22 ; # Huge Drives and LVM # 23 ; When using disks >512GB under eComStation, the drive geometry changes to 24 ; 127 or 255 sectors per track. Since LVM-info is written at the last sector 25 ; of a track, and AiR-BOOT uses the geometry of the MBR, it cannot find the 26 ; LVM-info and the eCS partition / volume bootsector. 27 ; This has been fixed. 28 ; Now, when an eCS-partition is discovered and the drive is >512GB, AiR-BOOT 29 ; will use the eCS geometry to locate the LVM-info and the bootsector. 30 ; 31 ; # Special loader handling # 32 ; The special handling of partition boot-loaders has been enhanced to 33 ; enable booting of legacy sysems on huge drives with or without OS/2 34 ; extended geometry. 35 ; 36 ; # eComStation boot-through after phase 1 # 37 ; A special functionality is implemented to directly boot the newly 38 ; installed system ; when installing eCS without showing the Boot Menu, 39 ; independant of user settings. 40 ; This works in conjuntion with the OS/2 specific SETABOOT.EXE program, 41 ; also part of this AiR-BOOT package. 42 ; 43 ; # Math, Debug, Conv and Aux modules # 44 ; These are used for 32-bit arithmatic on 16-bit code, 45 ; debug the booting process, converting between data-types 46 ; and outputting log-data to the com-port. 47 48 49 19 50 ;--------------------------------------------------------------------------- 20 51 ; AiR-BOOT / MAIN-CODE 21 52 ;--------------------------------------------------------------------------- 22 ; 23 53 ; 54 55 56 ; ---------------------------- 57 ; Rousseau: # JUMPS disabled # 58 ; ---------------------------- 59 ; We actually don't want to use this directive because it generates extra 60 ; NOP instructions that we can do without. 61 ; Relative conditional jumps that are out-of-range are manually reworked by 62 ; skipping an unconditional jump to the target on base of complementary 63 ; condition logic and temporary labels. 64 ; TASM also has a bug in that when the .ERR2 directive is used when the .386 directive 65 ; is in effect, the JUMPS directive is also active and cannot be turned off. 66 ; NOJUMPS seems to have no effect in this situation. 67 ; In this case 4 NOP instructions are generated after forward referencing jump 68 ; instructions, to allow for automatic recoding by TASM. 69 ; This seems to be a TASM bug. (v2,v3,v4, dunno v5) 70 ; 71 ;JUMPS 72 ; 73 74 ; 75 ; If defined then each module is prefixed with it's name. 76 ; This is used for debugging purposes. 77 ; It should be off in release code. 78 ; 79 ;ModuleNames equ 1 80 81 82 83 ; 84 ; The first harddisk is BIOS coded 80h. 85 ; This makes a total of 128 disk could be supported using this coding. 86 ; This value is used to store disk-information and this info is allocated 87 ; in the BSS. 88 ; 89 MaxDisks equ 16 90 91 ; 92 ; If defined then include DEBUG.ASM and output debug-info to serial-port. 93 ; 94 AuxDebug equ 1 95 96 97 BiosComPort equ 0 ; Com-port for debugging, 0 is disabled 98 99 ; bits 7-5 = datarate (000=110,001=150,010=300,011=600,100=1200,101=2400,110=4800,111=9600 bps) 100 ; bits 4-3 = parity (00 or 10 = none, 01 = odd, 11 = even) 101 ; bit 2 = stop-bits (set = 2 stop-bits, clear = 1 stop-bit) 102 ; bits 1-0 = data-bits (00 = 5, 01 = 6, 10 = 7, 11 = 8) 103 AuxInitParms equ 11100011b ; 9600 bps, no parity, 1 stop-bit, 8 bits per char 104 105 BIOS_AuxParmsDefault equ (AuxInitParms SHL 8) OR BiosComPort ; Default word value for offset 77FEh (BIOS_AuxParms) 106 ; 24 107 ; If ReleaseCode is not defined, it will produce debug-able code... 25 ReleaseCode equ -1 26 27 JUMPS 28 108 ; 109 ReleaseCode equ -1 ; Rousseau: this should be replaced 110 ; by the complementary debug logic some day. 111 ; Then instead of being on or off it would be 112 ; more handy to use positive integers with each 113 ; higher number increasing the debug functionality. 114 115 ; 29 116 ; All Special Equs for this project 30 117 ; 118 119 ; Use different addresses depending on whether in pre-boot or debug environment. 31 120 IFDEF ReleaseCode 32 StartBaseSeg equ 00000h 33 StartBasePtr equ 07C00h ; BIOS starts our MBR at 0:7C00121 StartBaseSeg equ 00000h ; Pre-boot, so we are in low memory 122 StartBasePtr equ 07C00h ; BIOS starts our MBR at 0:7C00 34 123 ELSE 35 StartBaseSeg equ 03A98h ; Adjust to DOS segment36 StartBasePtr equ 00100h 124 StartBaseSeg equ 03A98h ; Adjust to DOS segment ; Rousseau: where does this value come from ? (should be CS; rectified in actual code by ignoring this value) 125 StartBasePtr equ 00100h ; We are a .com file, some DOS is active 37 126 ENDIF 38 BootBaseSeg equ 8000h 39 BootBasePtr equ 0h ; We put our MBR to this location 40 BootBaseExec equ BootBasePtr+offset MBR_RealStart 41 StackSeg equ 7000h 42 127 128 ; Address labels after code-move 129 BootBaseSeg equ 8000h ; Pre-boot, somewhere in the low 640K 130 BootBasePtr equ 0h ; We put our MBR to this location 131 BootBaseExec equ BootBasePtr+offset MBR_RealStart 132 StackSeg equ 7000h ; Put the stack below the code 133 134 ; Video pages, no INT 10h is used for menu-drawing etc. 43 135 VideoIO_Page0 equ 0B800h 44 136 VideoIO_Page1 equ 0B900h … … 47 139 VideoIO_FXSegment equ 0A000h 48 140 141 ; Include 49 142 Include ..\INCLUDE\asm.inc 50 ;Include ..\INCLUDE\DOS\airboot.inc 51 143 ;Include ..\INCLUDE\DOS\airboot.inc ; does not exist anymore 144 145 ; Special line-drawing characters 52 146 TextChar_WinLineRight equ 0C4h ; 'Ä' 53 147 TextChar_WinLineDown equ 0B3h ; '³' … … 60 154 61 155 ; Offsets for Partition-Entries in MBR/EPRs 62 LocBRPT_LenOfEntry equ 16 63 LocBRPT_Flags equ 0 64 LocBRPT_BeginCHS equ 1 65 LocBRPT_BeginHead equ 1 66 LocBRPT_BeginSector equ 2 67 LocBRPT_BeginCylinder equ 3 68 LocBRPT_SystemID equ 4 69 LocBRPT_EndCHS equ 5 156 LocBRPT_LenOfEntry equ 16 ; Length of a standard MBR or EPR entry 157 LocBRPT_Flags equ 0 ; Bootable, Hidden, etc. 158 LocBRPT_BeginCHS equ 1 ; Combined 10-bits cyl with 6 bits 159 LocBRPT_BeginHead equ 1 ; Start head (0<=H<255) 255 is invalid ! 160 LocBRPT_BeginSector equ 2 ; Start sector (1<=S<=255) 161 LocBRPT_BeginCylinder equ 3 ; Start cylinder (0<=C<[1024,16384,65536,n]) 162 LocBRPT_SystemID equ 4 ; Type of system using the partition 163 LocBRPT_EndCHS equ 5 ; Same for end of partition 70 164 LocBRPT_EndHead equ 5 71 165 LocBRPT_EndSector equ 6 72 166 LocBRPT_EndCylinder equ 7 73 LocBRPT_RelativeBegin equ 8 74 LocBRPT_AbsoluteLength equ 12 75 76 LocBR_Magic equ 510 167 LocBRPT_RelativeBegin equ 8 ; Where the ... 168 LocBRPT_AbsoluteLength equ 12 ; ? 169 170 LocBR_Magic equ 510 ; ? 77 171 78 172 ; Offsets for LVM Information Sector 79 LocLVM_SignatureStart equ 0 80 LocLVM_SignatureByte0 equ 2 81 LocLVM_CRC equ 8 ; CRC is a DWORD 82 LocLVM_MaxEntries equ 4 83 LocLVM_StartOfEntries equ 60 ; (contains maximum of 4 entries) 84 LocLVM_LenOfEntry equ 60 85 LocLVM_VolumeID equ 0 ; is DWORD 86 LocLVM_PartitionID equ 4 ; is DWORD 87 LocLVM_PartitionSize equ 8 ; is DWORD 88 LocLVM_PartitionStart equ 12 ; is DWORD 89 LocLVM_VolumeLetter equ 18 ; is BYTE (Letter C-Z or 0) 90 LocLVM_VolumeName equ 20 ; 20 bytes 91 LocLVM_PartitionName equ 40 ; 20 bytes 173 LocLVM_SignatureStart equ 0 ; 174 LocLVM_SignatureByte0 equ 2 ; 175 LocLVM_CRC equ 8 ; CRC is a DWORD 176 LocLVM_MaxEntries equ 4 ; Max entries in the track0 LVM-sector 177 LocLVM_StartOfEntries equ 60 ; (contains maximum of 4 entries) 178 LocLVM_LenOfEntry equ 60 ; ? 179 LocLVM_VolumeID equ 0 ; is DWORD 180 LocLVM_PartitionID equ 4 ; is DWORD 181 LocLVM_PartitionSize equ 8 ; is DWORD 182 LocLVM_PartitionStart equ 12 ; is DWORD 183 LocLVM_VolumeLetter equ 18 ; is BYTE (Letter C-Z or 0) (relative to entry) 184 185 ; Rousseau: added (index in LVM-sector) 186 LocLVM_Secs equ 20h ; Sectors per Track ; Rousseau: this one is used for the OS/2 extended geometry 187 LocLVM_Heads equ 1ch ; Number of heads 188 LocLVM_VolumeLetter2 equ 78 ; is BYTE (Letter C-Z or 0) ; FOUT !! niet entry relative ! 189 LocLVM_Startable equ 77 ; is startable (newly installed system) ; FOUT !! niet entry relative ! 190 LocLVM_OnBootMenu equ 76 ; is on bootmenu ; FOUT !! niet entry relative ! 191 192 LocLVM_VolumeName equ 20 ; 20 bytes 193 LocLVM_PartitionName equ 40 ; 20 bytes 194 195 196 92 197 93 198 ; Offsets for IPT (Internal Partition Table) 94 LocIPT_MaxPartitions equ 30 ; Maximum LocIPT_MaxPartitions 95 LocIPT_LenOfSizeElement equ 6 ; Size of one Size-Element 96 LocIPT_LenOfIPT equ 34 97 LocIPT_Serial equ 0 98 LocIPT_Name equ 4 99 LocIPT_Drive equ 15 ; Drive-ID 100 LocIPT_SystemID equ 16 ; Partition-Type 101 LocIPT_Flags equ 17 ; AiR-BOOT Flags for partition 102 LocIPT_BootRecordCRC equ 18 ; CRC of Boot-Record 103 LocIPT_LocationBegin equ 20 ; Begin of Partition 104 LocIPT_LocationPartTable equ 23 ; PartitionTable of Partition 105 LocIPT_AbsoluteBegin equ 26 ; Absolute Sector of Begin 106 LocIPT_AbsolutePartTable equ 30 ; Absolute Sector of PartTable 107 108 LocIPT_DefaultFlags equ 00000011b ; Don't know if boot-able :) 109 LocIPT_DefaultNonBootFlags equ 00000010b ; ...VIBR Detection is always on 199 LocIPT_MaxPartitions equ partition_count ; Maximum LocIPT_MaxPartitions 200 LocIPT_LenOfSizeElement equ 6 ; Size of one Size-Element 201 LocIPT_LenOfIPT equ 34 ; Length of an IPT-entry 202 LocIPT_Serial equ 0 ; Serial from MBR ? 203 LocIPT_Name equ 4 ; Name from FS or LVM (part/vol) 204 LocIPT_Drive equ 15 ; Drive-ID (80h,81h etc. sub 7fh to get 1-based disk-number) 205 LocIPT_SystemID equ 16 ; Partition-Type (06,07,etc) 206 LocIPT_Flags equ 17 ; AiR-BOOT Flags for partition (see below) 207 LocIPT_BootRecordCRC equ 18 ; CRC of Boot-Record 208 LocIPT_LocationBegin equ 20 ; Begin of Partition 209 LocIPT_LocationPartTable equ 23 ; PartitionTable of Partition 210 LocIPT_AbsoluteBegin equ 26 ; Absolute Sector of Begin 211 LocIPT_AbsolutePartTable equ 30 ; Absolute Sector of PartTable 212 213 ; AiR-BOOT IPT-Flags 214 LocIPT_DefaultFlags equ 00000011b ; Don't know if boot-able :) 215 LocIPT_DefaultNonBootFlags equ 00000010b ; ...VIBR Detection is always on 110 216 111 217 Flags_BootAble equ 00000001b 112 218 Flags_VIBR_Detection equ 00000010b 113 219 Flags_HideFeature equ 00000100b 114 Flags_DriveLetter equ 00001000b ; OS/2 FAT16/HPFS only115 Flags_ExtPartMShack equ 00010000b ; Extended Partition M$-Hack req ?220 Flags_DriveLetter equ 00001000b ; OS/2 FAT16/HPFS only 221 Flags_ExtPartMShack equ 00010000b ; Extended Partition M$-Hack req ? 116 222 Flags_NoPartName equ 01000000b 117 Flags_NowFound equ 10000000b ; temp only in OldPartTable 118 Flags_SpecialMarker equ 10000000b ; temp only for HiddenSetup 119 120 FileSysFlags_BootAble equ 00000001b ; Is this Partition boot-able ? 121 FileSysFlags_FAT32 equ 00010000b ; FAT 32 specific name getting 122 FileSysFlags_NoName equ 00100000b ; No Name - use PartitionName 123 FileSysFlags_DriveLetter equ 01000000b ; DriveLetter Feature possible 124 223 Flags_NowFound equ 10000000b ; temp only in OldPartTable 224 Flags_SpecialMarker equ 10000000b ; temp only for HiddenSetup 225 226 FileSysFlags_BootAble equ 00000001b ; Is this Partition boot-able ? 227 FileSysFlags_FAT32 equ 00010000b ; FAT 32 specific name getting 228 FileSysFlags_NoName equ 00100000b ; No Name - use PartitionName 229 FileSysFlags_DriveLetter equ 01000000b ; DriveLetter Feature possible 230 231 ; Navigation keys 125 232 Keys_Up equ 48h 126 233 Keys_Down equ 50h … … 148 255 Keys_Flags_EnterSetup equ 1100b ; Strg+Alt (AL) 149 256 150 .386p 151 model large, basic 152 257 258 ; ------------------------------------------ 259 ; Rousseau: # Changed this from .386 to .286 260 ; ------------------------------------------ 261 ; Because of the TASM-bug the processor had to be changed to turn JUMPS 262 ; off. Existing movzx instructions were replaced with 286 equivalent code. 263 ; Out of range relative jumps have been recoded. 264 ; AiR-BOOT can now run on a 286 processor :-) 265 .286 266 267 ; This influences the uses directive and other stuff, 268 ; like calling-style. 269 ; The model itself,large, has no effect because we generate 270 ; a binairy image and not a segmented executable. 271 .model large, basic 272 273 ; Our code-segment starts here. 274 ; We are running in 16-bit and we like it 153 275 code_seg segment public use16 154 276 assume cs:code_seg, ds:code_seg, es:nothing, ss:nothing 155 277 156 org 00000h ; Sector 1 278 279 280 ;=============================================================================== 281 ; Sector 1 282 283 284 ; We are not a .com file at 100h but a binary image 285 ; of which only the 1st sector gets loaded at 07c00h. 286 org 00000h ; Sector 1 287 288 ; Start of sector 1 289 ; This is the MBR, note the AiRBOOT signature, it's date (2006), version and 290 ; language. 291 ; Version 1.07 was intruduced in 2011. 292 ; It fixes issues with huge drives and lvm and more. 293 294 sos1: 295 296 ; --------------------------------------------- 297 ; Rousseau: # Combined letter and jump offset # 298 ; --------------------------------------------- 299 ; My guess is Martin had a short jump followed by the AiRBOOT signature at first. 300 ; Then he encountered strange behaviour by some M$ operating-systems if the 301 ; the first insruction was not a CLI. 302 ; But there was no room to insert the CLI and of course he did not want to 303 ; change the location of the AiRBOOT signature. 304 ; He solved this by inserting the M$ needed CLI at offset 0 followed by a short 305 ; jump that uses the 'A' of the AiRBOOT signature as the jump displacement. 306 307 157 308 ;--------------------------------------------------------------------------- 158 AiR_BOOT: cli ; Some M$ operating systems need a CLI 159 ; here otherwise they will go beserk 160 ; and will do funny things during 161 ; boot phase, it's laughable! 162 db 0EBh ; JMP-Short -> MBR_Start 163 db 'AiRBOOT', 13h, 03h, 20h, 06h, 01h, 06h, TXT_LanguageID 309 AiR_BOOT: cli ; Some M$ operating systems need a CLI 310 ; here otherwise they will go beserk ; Rousseau: M$ osses are beserk by definition. 311 ; and will do funny things during 312 ; boot phase, it's laughable! 313 db 0EBh ; JMP-Short -> MBR_Start ; Rousseau: uses the 'A' as the displacement ! 314 db 'AiRBOOT', 13h, 03h, 20h, 06h, 01h, 07h, TXT_LanguageID ; Rousseau: version adjusted to v1.07 315 164 316 ; ID String, Date and Version Number, U for US version 165 db 1 ; Total Sectors Count, 166 ; Will get overwritten by FIXBSET.exe 167 MBR_CheckCode dw 0 ; Check-Sum for Code 168 169 MBR_Start: sti ; This opcode is dedicated to: 170 cld ; =MICROSOFT JUMP DEPARTMENT= 171 mov ax, StartBaseSeg 172 mov ds, ax 173 mov si, StartBasePtr 174 mov ax, BootBaseSeg 317 db 1 ; Total Sectors Count, 318 ; Will get overwritten by FIXBSET.exe 319 MBR_CheckCode dw 0 ; Check-Sum for Code 320 321 ; 322 ; This label is jumped to from the jump after 'eCSRocks'. 323 ; No single instruction below should be changed, added or removed in the code 324 ; below as this will cause the jump-link to go haywire. 325 MBR_Start: sti ; This opcode is dedicated to: 326 cld ; =MICROSOFT JUMP DEPARTMENT= 327 328 ; Setup some base stuff 329 ; AX got loaded wrongly for debug, changed the instructions 330 ; without modifying the number of bytes. 331 ; Don't comment-out the redundant instruction below because this *will* 332 ; change the number of bytes and break the jump-chain. 333 mov ax, StartBaseSeg ; The segment we are moving ourself from (NOT USED) 334 ;mov ds, ax 335 push cs 336 pop ds 337 mov si, StartBasePtr ; The offset we are moving ourself from 338 mov ax, BootBaseSeg ; The target segment we are moving ourself to 175 339 mov es, ax 176 mov di, BootBasePtr 340 mov di, BootBasePtr ; The target offset we are moving ourself to 341 342 ; Depending on pre-boot or debug, 343 ; only move first 512 bytes or the whole she-bang++ (65400 bytes) 177 344 IFDEF ReleaseCode 178 mov cx, 256 345 mov cx, 256 ; Pre-boot environment 179 346 ELSE 180 mov cx, 32700 347 mov cx, 32700 ; Debug environment ; Rousseau: where does 32700 come from ? (30720) 181 348 ENDIF 349 350 ; 351 ; LET's MOVE OURSELVES ! 352 ; 182 353 rep movsw 354 355 ; Code a jump to the 183 356 db 0EAh 184 dw BootBaseExec 185 dw BootBaseSeg 357 dw BootBaseExec ; This is MBR_RealStart + BootBasePtr 358 dw BootBaseSeg ; This is 08000h 186 359 ; jmp far ptr BootBaseSeg:BootBaseExec 187 360 361 362 ; 363 ; Some MBR-functions to provide absolute minimum functionality. 364 ; 365 366 ; 367 ; Entry-point for halting the system. 368 ; 188 369 MBR_HaltSystem: 189 370 mov ax, 8600h … … 194 375 jmp MBR_HaltSys 195 376 196 db 'FUCKMS:>' 377 ; 378 ; Never let this part change it's offset, 379 ; or the first MBR jump will go haywire. 380 ; 381 382 ; db 'FUCKMS:>' ; Sorry Martin, we had to change this. 383 db 'eCSRocks' ; Hope you like this one too :-) 197 384 jmp MBR_Start ; We jump here, because I needed to 198 385 ; insert a CLI on start and did not 199 386 ; want to change AiR-BOOT detection 200 387 ; because of Microsoft inventions... 201 388 ; 389 ; Entry-point when loading fails. 390 ; 202 391 db 'LOAD ERROR!', 0 203 MBR_LoadError Proc Near Uses 204 mov si, offset $-12 205 push cs 206 pop ds 207 call MBR_Teletype 208 MBRLE_Halt: 209 jmp MBRLE_Halt 210 MBR_LoadError EndP 211 392 MBR_LoadError Proc Near 393 mov si, offset $-12 394 push cs 395 pop ds 396 call MBR_Teletype 397 MBRLE_Halt: 398 jmp MBRLE_Halt 399 MBR_LoadError EndP 400 401 402 ; 403 ; Entry-point when saving fails. 404 ; 212 405 db 'SAVE ERROR!', 0 213 MBR_SaveError Proc Near Uses 214 mov si, offset $-12 215 push cs 216 pop ds 217 call MBR_Teletype 218 MBRSE_Halt: 219 jmp MBRSE_Halt 220 MBR_SaveError EndP 221 406 MBR_SaveError Proc Near 407 mov si, offset $-12 408 push cs 409 pop ds 410 call MBR_Teletype 411 MBRSE_Halt: 412 jmp MBRSE_Halt 413 MBR_SaveError EndP 414 415 416 ; Put text on the screen using the BIOS tele-type function. 417 ; No attributes like color are supported. 222 418 ; In: SI - Pointer to begin of string (EOS is 0) 223 419 ; Destroyed: SI 224 420 MBR_Teletype Proc Near Uses ax bx cx 225 movah, 0Eh226 movbx, 7227 MBRT_Loop:228 lodsb229 oral, al230 jzMBRT_End231 int10h232 jmpMBRT_Loop233 MBRT_End:234 ret421 mov ah, 0Eh 422 mov bx, 7 423 MBRT_Loop: 424 lodsb 425 or al, al 426 jz MBRT_End 427 int 10h 428 jmp MBRT_Loop 429 MBRT_End: 430 ret 235 431 MBR_Teletype EndP 432 433 ; 434 ; Rousseau: DO NOT ADD CODE TO THIS SECTION ! 435 ; 236 436 237 437 ; In: BX - Base Check, DS:SI - Pointer to 512-byte-area to be included … … 252 452 MBR_GetCheckOfSector EndP 253 453 454 455 456 457 458 459 ; 460 ; This is where the rest of AiR-BOOT gets loaded. 461 ; 462 254 463 ;--------------------------------------------------------------------------- 255 464 MBR_RealStart: 256 mov ax, StackSeg 465 mov ax, StackSeg ; 07000h, below the moved code 257 466 mov ss, ax 258 mov sp, 7FFFh 259 mov ax, es 260 mov ds, ax ; Set DS==ES to Code Segment 467 ;mov sp, 7FFFh ; Odd stack-pointer ?? 468 mov sp, 7FFEh ; Safe value, could also be 8000h because SP is decremented by 2 before push 469 mov ax, es ; ES holds segment where we moved ourself to. 470 mov ds, ax ; Set DS==ES to Code Segment 471 472 ; If we are in debug-mode, all code is moved already, 473 ; so we can directly jump to it. 474 ; One difference is that in debug-mode, the whole .com image is loaded by dos while 475 ; when air-boot is active from the MBR it does the loading itself. 476 ; When active from the MBR air-boot does not load all sectors ! 477 ; This means that i.e. a value stored at 77E0h is present in the debug-version because the whole 478 ; image is loaded, but is not present in running-mode because this sector is not loaded. 261 479 IFNDEF ReleaseCode 262 480 jmp AiR_BOOT_Start 263 481 ENDIF 482 483 264 484 ; Load missing parts from harddrive... 265 mov ax, cs 266 mov es, ax 485 mov ax, cs ; actually obsolete 486 mov es, ax ; actually obsolete 487 488 ; Load the configuration-sectors from disk. 267 489 mov bx, offset Configuration 268 mov dx, 0080h ; First harddrive, Sector 55 269 mov cx, 0037h 270 mov ax, 0205h ; Read 5 sectors 490 mov dx, 0080h ; First harddrive, Sector 55 491 mov cx, 0037h ; Is 55d is config-sector 492 493 494 495 IF image_size EQ image_size_60secs 496 mov ax, 0205h ; Read 5 sectors (55 - 59) 497 ELSE 498 mov ax, 0207h ; Read 7 sectors (55 - 61) 499 ENDIF 500 271 501 int 13h 272 502 jnc MBR_ConfigCopy_NoError 503 504 ; Some error occured 273 505 MBR_ConfigCopy_LoadError: 274 call MBR_LoadError ; Will Abort BootUp 506 call MBR_LoadError ; Will Abort BootUp 507 508 ; Load the code sectors 275 509 MBR_ConfigCopy_NoError: 276 510 mov bx, offset FurtherMoreLoad 277 mov dx, 0080h ; First harddrive, Sector 2278 mov cx, 0002h 511 mov dx, 0080h ; First harddrive 512 mov cx, 0002h ; Second sector 279 513 mov ah, 02h 280 mov al, ds:[10h] 514 515 mov al, ds:[10h] ; 34h = 52d sectors (35h in extended version) 281 516 int 13h 282 517 jnc MBR_RealStart_NoError … … 288 523 ; Now Check Code with CheckSum 289 524 mov si, offset FurtherMoreLoad 290 movzx cx, bptr ds:[10h] 525 526 ;movzx cx, bptr ds:[10h] 527 mov cl, ds:[10h] 528 mov ch,0 529 291 530 xor bx, bx 292 531 MBR_RealStart_CheckCodeLoop: … … 305 544 jmp AiR_BOOT_Start 306 545 546 547 548 307 549 ;--------------------------------------------------------------------------- 308 550 Include TEXT\TXTMBR.asm ; All translateable Text in MBR 309 551 ;--------------------------------------------------------------------------- 310 org 00200h ; Sector 2 552 553 554 555 ; Comport settings 556 ; DO NOT MOVE THIS VARIABLE !! 557 ; It cannot be in the config-area (sector 55) because that area 558 ; is crc-protected. 559 org 001B0h 560 BIOS_AuxParms dw BIOS_AuxParmsDefault ; Initialized at start when developing 561 562 org 00200h 563 ; End of sector 1 564 eos1: 565 566 ; Check for overlap 567 slack01 = sos2 - eos1 568 IF slack01 LT 0 569 .ERR2 "Location Overlap slack01 !" 570 ENDIF 571 572 573 ;=============================================================================== 574 ; Sector 2 575 576 ; 577 ; Here starts the second sector, sector 2 578 ; 579 org 00200h 580 ; Start of sector 2. 581 sos2: 582 583 311 584 ; Everything beyond this point is loaded on startup and is NOT existant at first 312 585 FurtherMoreLoad: 586 587 ; 588 ; Filesystem table correlating id with name. 589 ; 590 313 591 ; first Normal-Partition-ID, Hidden-Partition-ID 314 592 ; and Default-Partition-Flags. … … 344 622 ; -> 44 Partition-Types 345 623 346 ;--------------------------------------------------------------------------- 347 org 00400h ; Sector 3 348 AiR_BOOT_Start: mov ax, VideoIO_Page1 349 call VideoIO_BackUpTo ; Copy BIOS POST to Second Page 350 mov si, offset Copyright 351 call MBR_Teletype 624 ; End of sector 2. 625 eos2: 626 627 628 629 ; Check for overlap 630 slack02 = sos3 - eos2 631 IF slack02 LT 0 632 .ERR2 "Location Overlap slack02 !" 633 ENDIF 634 635 636 637 638 639 ;=============================================================================== 640 ; Sector 3 641 org 00400h 642 ; Start of sector 3. 643 sos3: 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 ; ############################################## 660 ; ## ENTRY-POINT AFTER ALL THE INITIAL HASSLE ## 661 ; ############################################## 662 663 664 665 AiR_BOOT_Start: nop 666 667 ;jmp skip 668 669 ; Rousseau: 670 ; I should cleanup my garbage here... 671 352 672 ; Initialize Variable-Tables, Detections, etc. 353 673 call PRECRAP_Main 674 675 ; Number of harddisks is now known 676 354 677 call PARTSCAN_ScanForPartitions 355 MBR_Main_ReEnterSetup: 678 679 680 ; Number of disks found 681 mov si, offset DisksFound 682 call MBR_Teletype 683 684 mov al, [TotalHarddiscs] 685 call VideoIO_SyncPos 686 call VideoIO_PrintByteDynamicNumber 687 xor si,si 688 call MBR_TeletypeNL 689 690 ; Number of bootable systems indicator 691 mov si, offset PartitionsFound 692 call MBR_Teletype 693 694 mov al, [CFG_Partitions] 695 call VideoIO_SyncPos 696 call VideoIO_PrintByteDynamicNumber 697 698 xor si,si 699 call MBR_TeletypeNL 700 call MBR_TeletypeNL 701 702 call VideoIO_SyncPos 703 704 mov dl,80h 705 call VideoIO_DumpDiskInfo 706 707 ; 708 ; Enumberate Bootable Systemen by name 709 ; And prepare Phase 1 if active 710 ; 711 mov si, offset PartitionTable 712 xor cx,cx 713 mov cl,[CFG_Partitions] 714 MBR_Parts: 715 add si, 4 716 push si 717 push si 718 ;call MBR_TeletypeVolName 719 pop si 720 call PART_IsInstallVolume 721 jnc MBR_Parts_NI 722 723 ; install volume 724 mov al,' ' 725 mov bl,7 726 mov ah, 0eh 727 int 10h 728 729 mov al,'(' 730 mov bl,7 731 mov ah, 0eh 732 int 10h 733 734 mov al,[CFG_Partitions] 735 sub al,cl 736 ;inc al 737 ;mov [Menu_EntryAutomatic],al 738 mov [CFG_PartAutomatic],al ; Rousseau: setup entry for install-volume 739 mov [CFG_PartLast],al 740 mov ah, [eCS_InstallVolume] ; 1st byte is 0 if no phase 1 active 741 test ah,ah ; test the byte, ZF is 0 if phase 1 active 742 lahf ; flags in ah 743 xor ah, 40h ; complement ZF 744 and ah, 40h ; mask ZF 745 shr ah, 6 ; move ZF to LSB 746 mov [CFG_AutomaticBoot], ah ; automatic boot if phase 1 is active 747 mov [eCS_InstallVolume], 0 ; disable phase 1 for next boot 748 749 add al,'1' 750 mov bl,7 751 mov ah, 0eh 752 int 10h 753 754 mov al,')' 755 mov bl,7 756 mov ah, 0eh 757 int 10h 758 759 mov bx,cx 760 761 MBR_Parts_NI: 762 xor si,si 763 ;call MBR_TeletypeNL 764 pop si 765 add si, 30 766 loop MBR_Parts 767 768 769 770 771 ; Index of automatic start partition 772 ; mov si, offset AutoStartPart 773 ;call MBR_Teletype 774 775 mov al, [CFG_PartAutomatic] 776 add al, 31h 777 mov ah, 09h 778 mov bx, 15 779 mov cx, 1 780 ;int 10h 781 782 mov al, [CFG_PartAutomatic] 783 add al, 31h 784 mov ah, 0eh 785 mov bx, 15 786 mov cx, 1 787 ;int 10h 788 789 xor si,si 790 call MBR_TeletypeNL 791 xor si,si 792 call MBR_TeletypeNL 793 794 mov ax,[BIOS_AuxParms] 795 ;call VideoIO_SyncPos 796 push ax 797 add al,'0' 798 mov bl,7 799 mov ah, 0eh 800 ;int 10h 801 pop ax 802 xchg al,ah 803 sub al,0a2h 804 mov bl,7 805 mov ah, 0eh 806 ;int 10h 807 808 809 call MBR_TeletypeSyncPos 810 811 xor si,si 812 call MBR_TeletypeNL 813 call MBR_TeletypeNL 814 815 816 817 mov si, offset ShowMenu 818 call MBR_TeletypeBold 819 820 821 skip: 822 823 824 825 ; 826 ; ########################### WAIT FOR KEY ################################ 827 ; 828 829 830 ; Rousseau: 831 ; Wait for key so we can see debug log if ab-menu hangs. 832 ;;xor ax, ax 833 ;;int 16h 834 835 ;call SOUND_Beep 836 837 ; Rousseau: delayed save of video-page 838 839 mov ax, VideoIO_Page1 840 call VideoIO_BackUpTo ; Copy BIOS POST to Second Page 841 842 ;call SOUND_Beep 843 844 845 ; 846 ; COM-PORT DEBUG 847 ; 848 call AuxIO_TeletypeNL 849 mov si, offset PartitionTable 850 call AuxIO_DumpSector 851 call AuxIO_TeletypeNL 852 853 ; 854 ; RE-ENTER SETUP 855 ; 856 MBR_Main_ReEnterSetup: ; Rousseau: SETUP re-enters here ! 356 857 call SETUP_CheckEnterSETUP 357 call AFTERCRAP_Main 858 859 ;call SOUND_Beep 860 861 862 863 864 ; Rousseau: Prematurely save configuration 865 call DriveIO_SaveConfiguration ; Rousseau: added SAVE CONFIG 866 867 868 call AFTERCRAP_Main ; Rousseau: Every time I see "AfterCrap" I have to laugh :-) 358 869 359 870 ; [Linux support removed since v1.02] … … 364 875 ; MBR_Main_NoLinuxKrnlPartition: 365 876 877 878 MBR_Main_ReEnterBootMenuPre: 879 366 880 ; SetUp PartitionPointers for BootMenu (filter non-bootable) 367 881 call PART_CalculateMenuPartPointers … … 373 887 call MBR_Teletype 374 888 jmp MBR_HaltSystem 375 889 376 890 MBR_Main_SomethingBootAble: 377 891 ; FixUp Values, define Timed Setup booting, etc. 378 892 call PART_FixUpDefaultPartitionValues 893 894 379 895 380 896 ; -------------------------------------------------- BOOT-MENU … … 389 905 call PASSWORD_AskSystemPwd 390 906 mov al, Menu_EntryAutomatic 907 908 ;mov al, 2 ; Rousseau: 0-based 909 391 910 mov Menu_EntrySelected, al 392 jmp MBR_Main_NoBootMenu 911 jmp MBR_Main_NoBootMenu ; Rousseau: NO-BOOT-MENU 393 912 394 913 MBR_Main_NoAutomaticBooting: 914 915 ;call SOUND_Beep 916 395 917 test CFG_BootMenuActive, 0FFh 396 918 jnz MBR_Main_GotBootMenu … … 398 920 ; Select default partition and boot system... 399 921 call PASSWORD_AskSystemPwd 922 923 ;call VideoIO_DBG_WriteString2 ; Rousseau 924 400 925 mov al, Menu_EntryDefault 926 ;mov al,0 ; Rousseau: 0-based 401 927 mov Menu_EntrySelected, al 402 928 jmp MBR_Main_NoBootMenu … … 405 931 ; ------------------------------------------ BOOT-MENU VISUALS 406 932 call FX_StartScreen 933 934 ;call SOUND_Beep 935 407 936 call BOOTMENU_BuildBackground 408 937 call BOOTMENU_BuildMain … … 410 939 call PASSWORD_AskSystemPwd 411 940 call BOOTMENU_ResetTimedBoot 941 942 ;call SOUND_Beep 943 412 944 call BOOTMENU_Execute 945 946 ;call SOUND_Beep 947 413 948 jc MBR_Main_ReEnterSetup 414 949 call BOOTMENU_SetVarsAfterMenu 950 951 ;call SOUND_Beep 952 415 953 ; ------------------------------------------------- BOOTING... 416 954 MBR_Main_NoBootMenu: … … 432 970 call ANTIVIR_SaveBackUpMBR 433 971 mov dl, Menu_EntrySelected 434 call PART_StartPartition 435 972 call PART_StartPartition ; Rousseau: START PARTITION 973 974 975 976 ; 977 ; Include other code-modules here. 978 ; Because TASM is a multiple pass assembler, forward references 979 ; are possible. 980 ; 981 b_std_txt: 436 982 Include REGULAR\STD_TEXT.asm ; Standard (non-translateable text) 983 size_std_txt = $-b_std_txt 984 985 b_driveio: 437 986 Include REGULAR\DRIVEIO.asm ; Drive I/O, Config Load/Save 987 size_driveio = $-b_driveio 988 989 b_videoio: 438 990 Include REGULAR\ViDEOIO.asm ; Video I/O 991 size_videoio = $-b_videoio 992 993 b_timer: 439 994 Include REGULAR\TIMER.asm ; Timer 995 size_timer = $-b_timer 996 997 b_partmain: 440 998 Include REGULAR\PARTMAIN.asm ; Regular Partition Routines 999 size_partmain = $-b_partmain 1000 1001 b_partscan: 441 1002 Include REGULAR\PARTSCAN.asm ; Partition Scanning 1003 size_partscan = $-b_partscan 1004 1005 b_bootmenu: 442 1006 Include REGULAR\BOOTMENU.asm ; Boot-Menu 1007 size_bootmenu = $-b_bootmenu 1008 1009 b_password: 443 1010 Include REGULAR\PASSWORD.asm ; Password related 1011 size_password = $-b_password 1012 1013 b_other: 444 1014 Include REGULAR\OTHER.asm ; Other Routines 445 1015 size_other = $-b_other 1016 1017 ; Rousseau: Special modules moved upwards. 1018 b_main: 446 1019 Include SETUP\MAiN.ASM ; The whole AiR-BOOT SETUP 1020 size_main = $-b_main 1021 1022 1023 IFDEF TXT_IncludeCyrillic 1024 b_ccharset: 1025 Include SPECiAL\CHARSET.asm ; Charset Support (e.g. Cyrillic) 1026 size_ccharset = $-b_ccharset 1027 ENDIF 1028 1029 b_math: 1030 Include REGULAR\MATH.ASM ; Math functions (like 32-bit multiply) 1031 size_math = $-b_math 1032 1033 b_conv: 1034 Include REGULAR\CONV.ASM ; Various conversion routines 1035 size_conv = $-b_conv 1036 1037 IFDEF AuxDebug 1038 b_debug: 1039 Include REGULAR\DEBUG.ASM ; Various debugging routines, uses AUXIO and CONV 1040 size_debug = $-b_debug 1041 ENDIF 1042 1043 b_auxio: 1044 Include REGULAR\AUXIO.ASM ; Com-port support for debugging 1045 size_auxio = $-b_auxio 1046 1047 ; Rousseau: moved upwards 1048 ;IFDEF TXT_IncludeCyrillic 1049 ; Include SPECiAL\CHARSET.asm ; Charset Support (e.g. Cyrillic) 1050 ;ENDIF 1051 1052 ; End of sector 3. 1053 eos3: 1054 1055 1056 ; Check for overlap 1057 slack03 = sos36 - eos3 1058 IF slack03 LT 0 1059 .ERR2 "Location Overlap slack03 !" 1060 ENDIF 1061 1062 1063 ;=============================================================================== 1064 1065 ; 1066 ; This is the AiR-BOOT MBR-Protection Image. 1067 ; 04600 / 200h = 23h = 35d sectors are before this point. 1068 ; The stuff generated here gets overwritten when the MBR_PROT.ASM 1069 ; module, which is assembled separately, gets merged. 1070 ; So you won't find the string below in the generated binary. 1071 ; 1072 org 04600h ; Sector 36-37 1073 1074 ; Start of sector 36. 1075 sos36: 1076 1077 MBR_Protection: db 'AiR-BOOT MBR-Protection Image' 1078 ; Hardcoded to 1k (1024 bytes) 1079 db 1024-($-MBR_Protection) dup('X') 1080 1081 ; End of sector 37, yes this section is 2 sectors long. 1082 eos37: 1083 1084 1085 1086 ; Check for overlap 1087 slack04 = sos38 - eos37 1088 IF slack04 LT 0 1089 .ERR2 "Location Overlap slack04 !" 1090 ENDIF 1091 1092 1093 1094 1095 ;=============================================================================== 1096 ; Sector 38-x 1097 ; 1098 ; This section contains translatable texts. 1099 ; 1100 org 04A00h 1101 1102 ; Start of sector 28. 1103 sos38: 1104 1105 b_txtother: 1106 Include TEXT\TXTOTHER.asm ; All translateable Text-Strings 1107 size_txtother = $-b_txtother 1108 1109 b_txtmenus: 1110 Include TEXT\TXTMENUS.asm ; All translateable Menu-text 1111 size_txtmenus = $-b_txtmenus 1112 1113 b_charset: 1114 Include TEXT\CHARSET.asm ; Special Video Charsets (if needed) 1115 size_charset = $-b_charset 1116 1117 1118 ; 1119 ; Here is room for more code. 1120 ; Let's move the special modules here... 1121 ; The come from the previous section. 1122 ; 1123 b_virus: 447 1124 Include SPECiAL\ViRUS.asm ; Virus Detection / Anti-Virus 1125 size_virus = $-b_virus 448 1126 ; [Linux support removed since v1.02] 449 1127 ;Include SPECiAL\FAT16.asm ; FAT-16 Support 450 1128 ;Include SPECiAL\LINUX.asm ; Linux Kernel Support 1129 b_billsuxx: 451 1130 Include SPECiAL\F00K\BILLSUXX.asm ; Extended Partition - Microsoft-Hack 1131 size_billsuxx = $-b_billsuxx 1132 1133 b_sound: 452 1134 Include SPECiAL\SOUND.asm ; Sound 1135 size_sound = $-b_sound 1136 1137 b_apm: 453 1138 Include SPECiAL\APM.asm ; Power Managment Support 1139 size_apm = $-b_apm 1140 1141 b_fx: 454 1142 Include SPECiAL\FX.asm ; l33t Cooper-Bars/Scrolling <bg> 1143 size_fx = $-b_fx 1144 1145 b_lvm: 455 1146 Include SPECiAL\LVM.asm ; LVM-specific code 456 IFDEF TXT_IncludeCyrillic 457 Include SPECiAL\CHARSET.asm ; Charset Support (e.g. Cyrillic) 1147 size_lvm = $-b_lvm 1148 1149 1150 1151 1152 1153 ; 1154 ; Let's make this always the last module in this section. 1155 ; 1156 Include BLDDATE.asm ; Build Date generated by _build.cmd 1157 1158 ; End of sector x depending on size of translatable texts. 1159 eosx: 1160 1161 org 06A00h - 4 1162 ;db 'BABE' 1163 1164 org 06A00h 1165 ; db 'FACE' 1166 1167 ; Check for overlap 1168 slack05 = sos55 - eosx 1169 IF slack05 LT 0 1170 .ERR2 "Location Overlap slack05 !" 458 1171 ENDIF 459 1172 460 ;--------------------------------------------------------------------------- 461 org 04600h ; Sector 36-37 462 MBR_Protection: db 'AiR-BOOT MBR-Protection Image' 463 ; Hardcoded to 1k (1024 bytes) 464 465 ;--------------------------------------------------------------------------- 466 org 04A00h ; Sector 38-x 467 Include TEXT\TXTOTHER.asm ; All translateable Text-Strings 468 Include TEXT\TXTMENUS.asm ; All translateable Menu-text 469 Include TEXT\CHARSET.asm ; Special Video Charsets (if needed) 470 471 ;--------------------------------------------------------------------------- 472 org 06C00h ; Sector 55 1173 1174 1175 ;=============================================================================== 1176 ; Sector 55 1177 1178 ; 1179 ; This section contains the AiR-BOOT configuration. 1180 ; Note that it has a version that should be updated 1181 ; when stuff is added. 1182 ; Also add stuff to the end so that offsets of other 1183 ; variables remain vaild. 1184 ; 1185 org 06C00h 1186 sos55: 1187 1188 473 1189 Configuration: 474 db 'AiRCFG-TABLE' 475 db 01h, 02h, 'U' ; "Compressed" ID String 476 ; This is still version 1.02, because nothing got 477 ; changed... 1190 db 'AiRCFG-TABLE' ; Rousseau: THERE IS AN INVISIBLE CHAR HERE !! 1191 db 01h, 07h, 'U' ; "Compressed" ID String 1192 ; This is now version 1.07 to have it in sync with the new code version for eCS. 1193 ; Version 1.02 was for code 1.06, 1.03 was internal and 1.04,1.05 and 1.06 do not exist. 1194 ; It is not required for the config to have the same version as the code, so in the future 1195 ; the code version might be higher than the config version if there are no changes to the latter. 478 1196 479 1197 CFG_LastTimeEditLow dw 0 ; Last Time Edited Stamp (will incr every setup) … … 490 1208 CFG_TimedSecs db 15 ; Timed Boot - How Many Seconds Till Boot 491 1209 CFG_TimedDelay dw 123 ; Timed Boot - Delay 492 CFG_TimedBootLast db 0; Timed Boot - Boot From Last Drive Booted From1210 CFG_TimedBootLast db 1 ; Timed Boot - Boot From Last Drive Booted From 493 1211 CFG_RememberBoot db 1 ; Remember Manual Boot Choice 494 1212 CFG_RememberTimed db 0 ; Remember if Timed Boot (if both disabled: Boot Default) 495 CFG_IncludeFloppy db 1; Include Floppy Drives in Boot-Menu1213 CFG_IncludeFloppy db 0 ; Include Floppy Drives in Boot-Menu 496 1214 CFG_BootMenuActive db 1 ; Display Boot-Menu (if Disabled: Boot Default) 497 1215 ; v0.29+ -> 2 - Detailed Bootmenu … … 503 1221 CFG_IgnoreWriteToMBR db 0 ; Just ignore writes to MBR, otherwise crash 504 1222 CFG_FloppyBootGetName db 0 ; Gets floppy name for display purposes 505 CFG_DetectVirus db 1 ; Detect Virus ?506 CFG_DetectStealth db 1 ; Detect Stealth-Virus ?507 CFG_DetectVIBR db 1 ; Detect BootRecord-Virus ?508 CFG_AutoEnterSetup db 1 ; Automatic Enter Setup (first install!)1223 CFG_DetectVirus db 0 ; Detect Virus ? // Rousseau: disabled 1224 CFG_DetectStealth db 0 ; Detect Stealth-Virus ? // Rousseau: disabled 1225 CFG_DetectVIBR db 0 ; Detect BootRecord-Virus ? // Rousseau: disabled 1226 CFG_AutoEnterSetup db 0 ; Automatic Enter Setup (first install!) // Rousseau: disabled 509 1227 CFG_MasterPassword dw 0101Fh ; Encoded Password (this is just CR) 510 1228 dw 07A53h … … 537 1255 CFG_AutomaticBoot db 0 ; Automatic Booting (only one bootup) 538 1256 CFG_PartAutomatic db 0 ; Partition-No for automatic booting 539 CFG_ForceLBAUsage db 0 ; LBA-BIOS-API forced on any HDD I/O1257 CFG_ForceLBAUsage db 1 ; LBA-BIOS-API forced on any HDD I/O // Rousseau: enabled config (LBA) 540 1258 CFG_IgnoreLVM db 0 ; Ignores any LVM-Information 1259 1260 1261 ; 1262 ; THERE IS ROOM RESERVED HERE FOR MORE VARIABLES 1263 ; 1264 1265 1266 eoc: 1267 1268 ; Check for overlap 1269 slack05a = soiv - eoc 1270 IF slack05a LT 0 1271 .ERR2 "Location Overlap slack05a !" 1272 ENDIF 1273 1274 ; Allways have the name of the installation volume 1275 ; at this offset. 1276 ; So future config changes will not break auto-install. 1277 org 06D00h 1278 1279 soiv: 1280 1281 ; Rousseau: added 1282 ;eCS_InstallVolume db 12 dup (0) ; Rousseau: new install-volume 1283 ;eCS_InstallVolume db 'HIGHLOG' ,0 ; Rousseau: new install-volume 1284 eCS_InstallVolume db 0,'NOPHASEONE' ,0 ; Rousseau: new install-volume 1285 ;eCS_InstallVolume db 'ECS-MIDDLE',0,0 ; Rousseau: new install-volume 1286 ;eCS_InstallVolume db 'ECS-HIGH',0,0,0,0 ; Rousseau: new install-volume 1287 ;eCS_InstallVolume db 'ECS-HIGH',0,'NO',0 ; Rousseau: new install-volume 1288 1289 1290 1291 ; End of sector 55. 1292 eos55: 1293 1294 1295 1296 ; Check for overlap 1297 slack06 = sosvs - eos55 1298 IF slack06 LT 0 1299 .ERR2 "Location Overlap slack06 !" 1300 ENDIF 1301 1302 541 1303 542 1304 ; VIR variables are for the AiR-BOOT Anti Virus Code … … 544 1306 ; stealth virus is on-line, we can intercept its call. 545 1307 ; Normal (non stealth) virus are trapped simply by rereading the MBR sector. 546 ; If a virus is found, we will restore MBR from Sektor 60 and stop the system1308 ; If a virus is found, we will restore MBR from Sektor 60/62 and stop the system 547 1309 ; from working, so the user has to press reset. That's saver than a Reboot. 548 1310 ; … … 554 1316 ; off or just reset it by switching 'VIBR Detection'. 555 1317 1318 1319 ; 1320 ; 06DABh - 06C00h = 01ABh = 427 bytes. 1321 ; 556 1322 org 06DABh ; 427 Boundry 1323 1324 sosvs: 1325 557 1326 AutoDrvLetter db 0 558 1327 AutoDrvLetterSerial dd 0 559 1328 1329 ; This entry is also 34 bytes long 560 1330 BIOScontIPTentry: 561 1331 db 0, 0, 0, 0, ' ' … … 571 1341 CFG_VIR_INT1C dd 0 ; pointer to saved 1Ch entry point 572 1342 573 ; 478 Boundry 1343 ; 478 Boundry 1344 ; This entry is also 34 bytes long 574 1345 FloppyIPTentry: db 0, 0, 0, 0, 'FloppyDrive' 575 1346 db 0, 0FFh, Flags_BootAble … … 579 1350 dd 0, 0 580 1351 ;--------------------------------------------------------------------------- 581 org 06E00h ; Sector 56-57 1352 1353 eosvs: 1354 1355 ; Check for overlap 1356 slack07 = sos56 - eosvs 1357 IF slack07 LT 0 1358 .ERR2 "Location Overlap slack07 !" 1359 ENDIF 1360 1361 1362 ;org 06E00h ; Sector 56-57 1363 org image_size - 0a00h - (image_size - image_size_60secs) 1364 sos56: 1365 1366 1367 1368 ; Rousseau: This is the start of the AiR-BOOT IPT 1369 582 1370 PartitionTable: ; no-partitions detected... :] 583 1371 ; db 1, 0, 0, 0, 'Harddisc 1' … … 600 1388 ; AbsoluteBegin * 4 (where the partition begins, in absolute sectors) 601 1389 ; AbsolutePartTab * 4 (where the partition table is, in absolute sectors) 602 ; --------------------> 34 Bytes (total maximum = 30) 603 604 org 071F6h 1390 ; --------------------> 34 Bytes (total maximum partition-entries = 30) 1391 1392 db (partition_count * 34) dup ('P') 1393 1394 eos56: 1395 1396 ; Check for overlap 1397 slack08 = eoiptsig - eos56 1398 IF slack08 LT 0 1399 .ERR2 "Location Overlap slack08 !" 1400 ENDIF 1401 1402 1403 ;org 071F6h 1404 org image_size - 600h - (image_size - image_size_60secs) / 2 - 0ah 1405 soiptsig: 605 1406 db 'AiRBOOTPAR' ; 1K internal partition table 1407 1408 1409 1410 eoiptsig: 1411 1412 ; Check for overlap 1413 slack09 = soipt - eoiptsig 1414 IF slack09 LT 0 1415 .ERR2 "Location Overlap slack09 !" 1416 ENDIF 1417 606 1418 ;--------------------------------------------------------------------------- 607 org 07200h ; Sector 58 608 HidePartitionTable: db 900 dup (0FFh) 1419 ;org 07200h ; Sector 58 1420 org image_size - 600h - (image_size - image_size_60secs) / 2 ; Sector 58 1421 soipt: 1422 sos58: 1423 1424 HidePartitionTable: db (partition_count * 30) dup (0FFh) 609 1425 ; Format is: 610 1426 ;============ … … 612 1428 ; --------------------> 30 Bytes * 30 613 1429 614 DriveLetters: db 30dup (0)1430 DriveLetters: db partition_count dup (0) 615 1431 ; Format is: 616 1432 ;============ 617 1433 ; Drive-Letter : BYTE (80h-C:, 81h-D:) 618 1434 ; --------------------> 1 Byte * 30 619 620 org 075F6h 1435 eos58: 1436 eoipt: 1437 1438 ; Check foroverlap 1439 slack10 = sohidsig - eoipt 1440 IF slack10 LT 0 1441 .ERR2 "Location Overlap slack10 !" 1442 ENDIF 1443 1444 1445 1446 ;org 075F6h 1447 org image_size - 200h -0ah 1448 1449 sohidsig: 621 1450 db 'AiRBOOTHID' ; 1K internal Hide-partition table 1451 1452 eohidsig: 1453 1454 ; Check for overlap 1455 slack11 = sohid - eohidsig 1456 IF slack11 LT 0 1457 .ERR2 "Location Overlap slack11 !" 1458 ENDIF 1459 1460 1461 1462 622 1463 ;--------------------------------------------------------------------------- 623 org 07600h ; Sector 60 624 MBR_BackUpMBR db 'AiR-BOOT MBR-BackUp - Just to fill this sector with something' 625 626 org 077FFh 627 db 0 1464 ;org 07600h ; Sector 60 1465 org image_size - 200h ; Sector 60 1466 sohid: 1467 sos60: 1468 MBR_BackUpMBR db 'AiR-BOOT MBR-BackUp - Just to fill this sector with something',0 1469 AirBootRocks db 'AiR-BOOT Rocks!',0 1470 1471 eos60: 1472 eohid: 1473 1474 ; Check for overlap 1475 slack12 = eoab - eohid 1476 IF slack12 LT 0 1477 .ERR2 "Location Overlap slack12 !" 1478 ENDIF 1479 1480 1481 ;org 077FEh 1482 org image_size - 2 1483 dw 0BABEh 1484 ;dw 0 1485 ;BIOS_AuxParms dw BIOS_AuxParmsDefault ; Initialized at start when developing 1486 1487 eoab: 1488 1489 ; 1490 ; Rousseau: 1491 ; End of AiR-BOOT code and data. 1492 ; 1493 1494 1495 ; 1496 ; Rousseau: 1497 ; Below functions like a BSS segment, thus uninitialized data. 1498 ; 1499 sobss: 628 1500 ;--------------------------------------------------------------------------- 629 1501 org 0A000h ; Uninitialized … … 633 1505 LVMSector: db 512 dup (?) ; Temporary Sector for LVM 634 1506 TmpSector: db 512 dup (?) ; Temporary Sector 635 TmpSector2: 1507 636 1508 ; Everything used to build a new IPT and reference it to the old one 637 NewPartTable: db 1 024dup (?) ; New Partition Table638 NewHidePartTable: db 900 dup (?) ; New Hide-Partition Table639 NewDriveLetters: db 30dup (?) ; Logical Drive-Letters640 641 PartitionSizeTable: db 180dup (?) ; Size-Table (6 bytes per partition)1509 NewPartTable: db 1536 dup (?) ; New Partition Table 1510 NewHidePartTable: db partition_count * 30 dup (?) ; New Hide-Partition Table 1511 NewDriveLetters: db partition_count dup (?) ; Logical Drive-Letters 1512 1513 PartitionSizeTable: db partition_count * 6 dup (?) ; Size-Table (6 bytes per partition) 642 1514 PartitionPointers dw 52 dup (?) ; Maximum is 52 entries till now 643 1515 PartitionPointerCount db ? ; Count of total Partition Pointers 644 PartitionXref db 30dup (?) ; X-Reference Table645 PartitionVolumeLetters db 30dup (?) ; Volume-Letters1516 PartitionXref db partition_count dup (?) ; X-Reference Table 1517 PartitionVolumeLetters db partition_count dup (?) ; Volume-Letters 646 1518 ; 0 - no LVM support 647 1519 ; 1 - LVM support, but no letter … … 650 1522 TotalHarddiscs db ? ; Total harddrives (by POST) 651 1523 LBASwitchTable db 128 dup (?) ; Bit 25-18 for CHS/LBA Switching 652 NewPartitions db ? ; Freshly found partitions 1524 NewPartitions db ? ; Freshly found partitions ; Independent of SaveConfiguration 653 1525 654 1526 VideoIO_Segment dw ? ; Segment for Video I/O … … 723 1595 ;LINUX_KernelNo db ? ; Total of Kernels in KernelEntries 724 1596 ;LINUX_KernelSizeTable db 120 dup (?) ; Size-Table (6 bytes per kernel) 725 EndOfVariables:1597 ;EndOfVariables: 726 1598 727 1599 ; Dynamically Generated Tables - do not need to get initialized with NUL … … 733 1605 LVM_CRCTable: dd 256 dup (?) ; LVM-CRC (->SPECiAL\LVM.asm) 734 1606 1607 1608 1609 ; 1610 ; Rousseau: added some stuff. 1611 ; 1612 1613 1614 ;EVEN 1615 HugeDisk db MaxDisks dup(?) 1616 TrueSecs dd MaxDisks dup(?) 1617 1618 ; BIOS geometry of the boot-drive 1619 ; Note that heads cannot be 256 due to legacy DOS/BIOS bug 1620 ; If Int13X is supported those values are used, otherwise the legacy values. 1621 BIOS_Cyls dd MaxDisks dup(?) 1622 BIOS_Heads dd MaxDisks dup(?) 1623 BIOS_Secs dd MaxDisks dup(?) 1624 BIOS_Bytes dw MaxDisks dup(?) 1625 BIOS_TotalSecs dq MaxDisks dup(?) 1626 1627 ; LBA geometry of the boot-drive 1628 ; Note that these values are taken from the BPB of a partition boot-record 1629 LVM_Cyls dd MaxDisks dup(?) 1630 LVM_Heads dd MaxDisks dup(?) 1631 LVM_Secs dd MaxDisks dup(?) 1632 LVM_Bytes dw MaxDisks dup(?) 1633 LVM_TotalSecs dq MaxDisks dup(?) 1634 1635 ; OS/2 geometry of the boot-drive 1636 ; Note that these values are taken from the BPB of a partition boot-record 1637 LOG_Cyls dd MaxDisks dup(?) 1638 LOG_Heads dd MaxDisks dup(?) 1639 LOG_Secs dd MaxDisks dup(?) 1640 LOG_Bytes dw MaxDisks dup(?) 1641 LOG_TotalSecs dq MaxDisks dup(?) 1642 1643 ; Rousseau: moved here 1644 EndOfVariables: 1645 1646 ; Temporary buffer for 48h INT13X bios call 1647 ; Word aligned 1648 ;even 1649 ;align 2 1650 1651 ;db 1 dup(?) 1652 1653 i13xbuf dw 1 dup (?) ; Size of the buffer; this param *must* be present. Code inserts it. 1654 db 126 dup(?) ; The buffer itself. 1655 i13xbuf_size = $-offset i13xbuf-2 ; Size of buffer (excluding the size word at the start). 1656 1657 eobss: 1658 1659 735 1660 code_seg ends 736 1661 end air_boot
Note:
See TracChangeset
for help on using the changeset viewer.