Changeset 46
- Timestamp:
- Apr 12, 2014, 8:23:32 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 13 added
- 9 deleted
- 44 edited
- 10 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/.clean
r45 r46 2 2 3 3 make clean 4 make 4 -
trunk/1README.TXT
r37 r46 1 =============================================================================== 2 1README.TXT -- General Information about AiR-BOOT v1.0.8 3 =============================================================================== 4 1 5 AiR-BOOT (c) Copyright 1998-2009 M. Kiewitz 2 6 … … 18 22 19 23 20 Note: 21 ----- 24 Preface: 25 -------- 26 When you are reading this file you are either browsing the AiR-BOOT sources 27 or you have 'checked-them-out' from the Netlabs repository. 28 Either way, this is what you should be aware of: 29 - AiR-BOOT was originally invented and designed by Martin Kiewitz. 30 - Martin seems to not develop it anymore and his last version (v1.06) 31 can be found on sourceforge. 32 - *This* version is a 'fork' and although the name is the same, 33 it's sources reside on Netlabs and an other developer maintains it. 34 So, please do not bother Martin with bugs in this 'fork'. 35 - This AiR-BOOT fork has been enhanced to cope with issues like 'huge disks' 36 and it's goal is to be a replacement for the ancient IBM Boot Manager 37 (formerly) used by eComStation. 38 - With the release of eComStation v2.1, in may 2011, this AiR-BOOT 'fork' 39 is distributed with it and positioned as the 'preferred bootmanager' 40 for eComStation. 41 - While AiR-BOOT is 'operating-system agnostinc', meaning that it is not tied 42 to any particular OS, the main effort of this 'fork' is to replace IBM-BM 43 and be highly compatible with eComStation. 44 - The secondary goal of this 'fork' is to support even more operating-systems, 45 new 'boot-technologies' like UEFI, new partitioning schemes like GPT 46 and more. 47 48 49 Note 1: 50 ------- 22 51 This is the "eComStation fork" of AiR-BOOT and it is maintained by a 23 52 different developer. The file you are currently reading, 1README.TXT, 24 53 replaces the original README.TXT as created by Martin Kiewitz. 25 The latter can be found in README.MKW but note that the information54 The latter can be found in README.MKW, but note that the information 26 55 in there about building AiR-BOOT is completely outdated. 56 Please refer to BUILD.NFO for more information about building AiR-BOOT. 57 58 59 Note 2: 60 ------- 61 Martin, at the time (1998+), found that it was important that AiR-BOOT could 62 be completely built on a DOS-system. In that 'era' this was a reasonable 63 requirement. With AiR-BOOT replacing IBM Boot Manager for eComStation 64 as of 2011, and upcoming stuff like EFI and GPT, AiR-BOOT itself and 65 it's 'build-environment' need to break out of the 'DOS-box'. 66 67 This means that the 8.3 filename format cannot be retained in some situations 68 and that building AiR-BOOT cannot use DOS .BAT files anymore. 69 70 Therefore, the 'build environment' has been 'revamped' to use Makefiles 71 and the Open Watcom tool-chain in combination with the JWasm Assembler. 72 This tool-chain can operate under DOS,Win32,OS/2 and Linux. 73 74 While care has been taken that the major components of AiR-BOOT can still be 75 built on DOS (or DOS-emulation environments), 76 the preferred build-environment is now eComStation -or- Linux. 77 78 If you really need to build on DOS, beware that: 79 - The DOS build-environment has limitations regarding memory and filenames. 80 - An eCS DOS-Session needs to have DPMI set from 'auto' to 'enabled' 81 and the XMS mem-limit needs to be set to 0, to be able the use of JWasmD. 82 - It has not been tested as thoroughly as the eCS and Linux environments. 83 - It will be dropped in the future. 84 85 86 Note 3: 87 ------- 88 An other 'operating-system' from a company that thinks it owns all computers, 89 all the disks in them, all it's users, their pets, and whatnot, 90 is also supported. AiR-BOOT can boot Windows and there is also a Win32 version 91 of the installer. (AIRBOOTW.EXE) 92 93 However, the AiR-BOOT Installer code for Win32 is much less tested than 94 the eComStation version. This however, does not apply to the AiR-BOOT loader, 95 which will do it's very best to boot any Windows it finds. 96 97 98 Note 4: 99 ------- 100 AiR-BOOT can also boot Linux, or more accurately, chainload GRUB. 101 For this to work, GRUB needs to be installed on the partition Linux resides 102 on, since the MBR is taken by AiR-BOOT. If GRUB is installed in the MBR it 103 needs to be moved to the PBR. The procedure for such an action depends 104 on the GRUB and Linux versions used. 105 106 27 107 28 108 Building AiR-BOOT 29 109 ----------------- 30 110 - Checkout the sources from http://svn.netlabs.org/air-boot. 31 - Setup yourOpen Watcom build-environment for your OS.111 - Setup the Open Watcom build-environment for your OS. 32 112 - Download JWasm for your OS. 33 - Run wmake help to see a list of build options -or-34 113 - Run wmake without paramaters to build AiR-BOOT for all languages. 35 114 36 115 See BUILD.NFO for more information. 37 116 117 38 118 Rousseau. -
trunk/BOOTCODE/.build
r37 r46 1 1 #!/bin/bash 2 2 3 export ASM=jwasm 3 4 make dev -
trunk/BOOTCODE/.dist
r45 r46 1 1 #!/bin/bash 2 2 3 make d ev3 make dist -
trunk/BOOTCODE/AIR-BOOT.ASM
r45 r46 20 20 21 21 ;------------------------------------------------------------------------------ 22 ; AiR-BOOT / MAIN-CODE22 ; AiR-BOOT / DEFINITIONS 23 23 ;------------------------------------------------------------------------------ 24 24 ; 25 26 ; 27 ; Include AiR-BOOT Version Information. 28 ; 29 Include VERSION.INC 30 31 ; 32 ; Include OS/2 BLDLEVEL Information. 33 ; 34 Include BLDLEVEL.INC 25 35 26 36 … … 66 76 ; Include Debug Modules and enable COM-port debugging. 67 77 ; 68 AUX_DEBUG EQU78 ;~ AUX_DEBUG EQU 69 79 70 80 … … 132 142 VideoIO_FXSegment equ 0A000h 133 143 134 ; Include 144 ; Include some macro's 135 145 Include ../INCLUDE/ASM.INC 136 146 … … 239 249 Flags_HideFeature equ 00000100b 240 250 Flags_DriveLetter equ 00001000b ; OS/2 FAT16/HPFS only 241 Flags_ExtPartMShack equ 00010000b ; Ext endedPartition M$-Hack req ?251 Flags_ExtPartMShack equ 00010000b ; Ext. Partition M$-Hack req ? 242 252 Flags_NoPartName equ 01000000b 243 253 Flags_NowFound equ 10000000b ; temp only in OldPartTable … … 276 286 277 287 288 289 290 291 292 ;------------------------------------------------------------------------------ 293 ; AiR-BOOT / MAIN-CODE 294 ;------------------------------------------------------------------------------ 295 278 296 ; ------------------------------------------ 279 297 ; Rousseau: # Changed this from .386 to .286 … … 297 315 ; Tasm needs a memory model for USES on PROC to work. 298 316 IFDEF TASM 299 ; .model large, basic317 ;~ .model large, basic 300 318 .model tiny,c 301 319 ENDIF … … 321 339 322 340 ; Our code-segment starts here. 323 LDRIMAGE SEGMENT USE16 PUBLIC ' MIXED'341 LDRIMAGE SEGMENT USE16 PUBLIC 'CODE' 324 342 325 343 IFDEF SEGMENTED … … 332 350 ; Sector 1 333 351 334 335 ; We are not a .com file at 100h but a binary image 336 ; of which only the 1st sector gets loaded at 07c00h. 352 ;############################################################################## 353 ; We are not a .COM file at 100h but a BINARY image 354 ; of which only the 1st sector gets loaded at 0000:07c00h 355 ; by the BIOS. The code in this 1st sector is position 356 ; independent and moves itself to a new location at 8000:0000h. 357 ; Then it jumps to a new entry-point and loads the rest of 358 ; the image to the new location. 337 359 org 00000h ; Sector 1 338 360 ;############################################################################## 361 362 363 ; 339 364 ; Start of sector 1 340 ; This is the MBR, note the AiRBOOT signature, it's date (2006), version and 341 ; language. 342 ; Version 1.07 was intruduced in 2011. 343 ; It fixes issues with huge drives and lvm and more. 344 345 365 ; This is the MBR. 366 ; Note the AiRBOOT signature, it's date, version and language. 367 ; Version 1.07 was intruduced in 2011, version 1.0.8 in 2012. 368 ; These new versions fix issues with huge drives, lvm and more. 369 ; For a detailed description see AIR-BOOT.HIS. 370 ; 371 372 ; 346 373 ; --------------------------------------------- 347 374 ; Rousseau: # Combined letter and jump offset # 348 375 ; --------------------------------------------- 349 ; M y guess is Martin had a short jump followed by the AiRBOOT signature at first.350 ; Then he encountered strange behaviour by some M$ operating-systems if the351 ; the first insruction was not a CLI.376 ; Martin had a short jump followed by the AiRBOOT signature at first. 377 ; Then he encountered strange behaviour by some M$ operating-systems 378 ; if the the first insruction was not a CLI. 352 379 ; But there was no room to insert the CLI and of course he did not want to 353 380 ; change the location of the AiRBOOT signature. 354 381 ; He solved this by inserting the M$ needed CLI at offset 0 followed by a short 355 382 ; jump that uses the 'A' of the AiRBOOT signature as the jump displacement. 383 ; 356 384 357 385 … … 359 387 AiR_BOOT: 360 388 361 ; Some M$ operating systems need a CLI 362 ; here otherwise they will go beserk 363 ; and will do funny things during 364 ; boot phase, it's laughable! 365 cli 366 367 ; JMP-Short -> MBR_Start 368 ; Uses the 'A' from the signature as the displacement ! 369 db 0EBh 370 371 ; ID String, Date (DD,MM,CC,YY), Version Number, Language ID 372 db 'AiRBOOT', 24h, 02h, 20h, 12h, 01h, 08h, TXT_LanguageID 373 374 ; Total Sectors Count. 375 ; Will get overwritten by FIXCODE. 376 db 1 377 378 ; Total Sectors Count, 379 ; Dynamic calculation. 380 ;~ db (code_end-$)/512 389 ; Some M$ operating systems need a CLI 390 ; here otherwise they will go beserk 391 ; and will do funny things during 392 ; boot phase, it's laughable! 393 cli 394 395 ; JMP-Short -> MBR_Start 396 ; Uses the 'A' from the signature as the displacement ! 397 db 0EBh 398 399 ; ID String, Date (DD,MM,CC,YY), Version Number, Language ID 400 ;~ db 'AiRBOOT', 24h, 02h, 20h, 12h, 01h, 08h, TXT_LanguageID 401 InsertAirbootSignature TXT_LanguageID 402 403 ; Total Sectors Count. 404 ; Will get overwritten by FIXCODE. 405 db 1 406 407 ; Total Sectors Count, 408 ; Dynamic calculation. 409 ;~ db (code_end-$)/512 381 410 382 411 … … 420 449 ; Code an intersegment jump to the new location 421 450 db 0EAh 422 dw BootBaseExec 423 dw BootBaseSeg 451 dw BootBaseExec ; This is MBR_RealStart + BootBasePtr 452 dw BootBaseSeg ; This is 08000h 424 453 ;jmp far ptr BootBaseSeg:BootBaseExec 425 454 … … 436 465 xor cx, cx 437 466 mov dx, 500 438 int 15h ; Wait to display the whole screen :] 439 MBR_HaltSys: cli 467 int 15h ; Wait to display the whole screen :] 468 MBR_HaltSys: 469 cli 440 470 jmp MBR_HaltSys 441 471 ;db 100 dup (0) … … 485 515 jmp MBRLE_Halt 486 516 MBR_LoadError EndP 487 488 517 489 518 ; … … 749 778 db 16 dup (0) 750 779 751 FileSysNames db 752 db 753 db 754 db 755 db 756 db 757 db 758 db 759 db 760 db 761 ; db 762 db 780 FileSysNames db 'FAT12 ', 'FAT16 ', 'FAT16Big', 'FAT16Big' 781 db 'HPFS ', 'NTFS ', 'LVM-Data', 'JFS ' 782 db 'FAT32 ', 'FAT32 ', 'FAT32 ', 'BeOS ' 783 db 'Unix ', 'Minix ', 'Linux ', 'Venix ' ; x row ;) 784 db 'BSD/386 ', 'OpenBSD ', 'LinuxSwp', 'NeXTSTEP' 785 db 'GNU HURD', 'QNX ', 'QNX ', 'QNX ' 786 db ' ', ' ', ' ', ' ' 787 db ' ', ' ', ' ', ' ' 788 db ' ', ' ', ' ', ' ' 789 db ' ', 'Kernel ', ' ', '0V-Award' 790 ; db 'OS/2 Man', 'via BIOS', 'Floppy ', 'Unknown ' 791 db 'OS2-BMGR', 'via BIOS', 'Floppy ', 'Unknown ' 763 792 ; -> 44 Partition-Types 764 793 … … 1011 1040 ; 1012 1041 ;call AuxIO_TeletypeNL 1013 mov si, offset PartitionTable1042 ;mov si, offset PartitionTable 1014 1043 ;call AuxIO_DumpSector 1015 1044 ;call AuxIO_TeletypeNL … … 1020 1049 ; Moved here to fix that Esc out of SETUP would also save. 1021 1050 ; So moved above the MBR_Main_ReEnterSetup label. 1022 mov [eCS_InstallVolume], 0 ; disable phase 1 for next boot1051 mov byte ptr [eCS_InstallVolume], 0 ; disable phase 1 for next boot 1023 1052 call DriveIO_SaveConfiguration 1024 1053 … … 1044 1073 1045 1074 1075 1046 1076 MBR_Main_ReEnterBootMenuPre: 1047 1077 … … 1050 1080 1051 1081 ; ...and count that one... 1052 cmp PartitionPointerCount, 01082 cmp byte ptr [PartitionPointerCount], 0 1053 1083 jne MBR_Main_SomethingBootAble 1054 1084 mov si, offset TXT_NoBootAble … … 1065 1095 MBR_Main_ReEnterBootMenu: 1066 1096 call BOOTMENU_ResetMenuVars ; reset has to be done 1067 test CFG_AutomaticBoot, 11097 test byte ptr [CFG_AutomaticBoot], 1 1068 1098 jz MBR_Main_NoAutomaticBooting 1069 1099 ; ------------------------------------------ AUTOMATIC BOOTING 1070 1100 ; Select automatic partition, disable automatic booting for 1071 1101 ; next time and boot system... 1072 mov CFG_AutomaticBoot, 01102 mov byte ptr [CFG_AutomaticBoot], 0 1073 1103 call PASSWORD_AskSystemPwd 1074 1104 mov al, Menu_EntryAutomatic … … 1083 1113 ;call SOUND_Beep 1084 1114 1085 test CFG_BootMenuActive, 0FFh1115 test byte ptr [CFG_BootMenuActive], 0FFh 1086 1116 jnz MBR_Main_GotBootMenu 1087 1117 ; ----------------------------------------------- NO BOOT-MENU … … 1212 1242 IFDEF AUX_DEBUG 1213 1243 b_debug: 1214 Include REGULAR/DEBUG.ASM 1244 Include REGULAR/DEBUG.ASM ; Debug module 1215 1245 size_debug = $-b_debug 1216 1246 b_auxio: … … 1225 1255 1226 1256 ; 1257 ; Moved up. 1258 ; 1259 1260 ; 1227 1261 ; This is the AiR-BOOT MBR-Protection Image. 1228 1262 ; 04600 / 200h = 23h = 35d sectors are before this point. 1229 ; The stuff generated here gets overwritten when the MBR_PROT.ASM 1230 ; module, which is assembled separately, gets merged. 1263 ; The stuff generated here gets overwritten when the 1264 ; MBR_PROT.ASM module, which is assembled separately, 1265 ; gets merged. 1231 1266 ; So you won't find the string below in the generated binary. 1232 1267 ; … … 1238 1273 1239 1274 1240 1275 ; Rousseau: It needed a sector alignment, so moved it up to 1276 ; have as much space as possible for the modules 1277 ; included here. 1241 1278 1242 1279 … … 1276 1313 1277 1314 1315 1278 1316 ; 1279 1317 ; Critical end of code marker. … … 1302 1340 1303 1341 1304 ; 1305 ; Let's make this always the last module in this section. 1306 ; 1307 Include BLDDATE.ASM ; Build Date generated by _build.cmd 1342 ; If we are debugging, we overwrite the FX code. 1343 ; As long as no FX is disabled this will do no harm. 1344 IFDEF AUX_DEBUG 1345 ORG 06780h 1346 ENDIF 1347 1348 bld_level: 1349 ; 1350 ; Here we insert the OS/2 BLDLEVEL Information. 1351 ; It is composed of the AiR-BOOT version-info and other 1352 ; information. 1353 ; It is unique for each release of AiR-BOOT. 1354 ; 1355 InsertBuildLevel 1308 1356 1309 1357 ; … … 1318 1366 ; 1319 1367 ; AiR-BOOT Protection Image. 1368 ; Moved from below to have it not break the included modules 1369 ; with it's sector alignment requirement. 1320 1370 ; 1321 1371 ORIGIN 06800h … … 1324 1374 ; This is the AiR-BOOT MBR-Protection Image. 1325 1375 ; 06800 / 200h = 34h = 52d sectors are before this point. 1326 ; The stuff generated here gets overwritten when the MBR_PROT.ASM 1327 ; module, which is assembled separately, gets merged. 1376 ; The stuff generated here gets overwritten when the 1377 ; MBR_PROT.ASM module, which is assembled separately, 1378 ; gets merged. 1328 1379 ; So you won't find the string below in the generated binary. 1329 1380 ; 1381 1382 ; 06800-068FF 1383 ; 06900-069FF 1384 ; 06A00-06AFF 1385 ; 06B00-06BFF 1386 1387 ; 1330 1388 ; Hardcoded to 1k (1024 bytes) (MBR_PROT.ASM) 1389 ; The string below is searched for by the FIXCODE helper and *must* be 1390 ; sector (512-bytes) aligned. 1391 ; 1331 1392 MBR_Protection db 'AiR-BOOT MBR-Protection Image' 1332 1393 … … 1334 1395 db 1024-($-MBR_Protection) dup('M') 1335 1396 1336 ;LDRIMAGE ENDS1337 ;DATA_SEG SEGMENT USE16 PUBLIC 'CODE'1338 1339 1340 1341 ;~ MYDATA SEGMENT COMMON 'MIXED'1342 ;~ qqqq dw 'QQ'1343 ;~ MYDATA ENDS1344 1397 1345 1398 ;============================================================================== … … 1356 1409 1357 1410 Configuration: 1358 ; THERE IS A N INVISIBLECHAR HERE !!1359 ; Your editor may not display th e invisible1411 ; THERE IS A NON-ASCII CHAR HERE !! 1412 ; Your editor may not display this non-ASCII 1360 1413 ; character at the end if the 'AiRCFG-TABLE' 1361 1414 ; string. When this character get's deleted, 1362 1415 ; AiR-BOOT will not function because it cannot 1363 1416 ; find the config-signature which includes this 1364 ; invisible character. The code is: 0x0ad.1417 ; invisible character. The code of the char is: 0x0ad. 1365 1418 db 'AiRCFG-TABLE' 1366 db 01h, 07h, 'U' ; "Compressed" ID String 1367 ; This is now version 1.07 to have it in sync with 1368 ; the new code version for eCS. 1419 db 01h, 08h, 'U' ; "Compressed" ID String 1369 1420 ; Version 1.02 was for code 1.06, 1.03 was internal 1370 1421 ; and 1.04,1.05 and 1.06 do not exist. 1422 ; 1423 ; 1.07 was used with AB v1.07 and introduced the phase1 1424 ; system-name. For the rest it is compatible with v1.02. 1425 ; 1426 ; 1.0.8 is introduced with AB v1.0.8 and indicates the movement 1427 ; of several components and the packing of the hideparttable. 1428 ; The core configuration has not changed but the generated 1429 ; configuration has. The v1.0.8 installer handles upgrading. 1430 ; 1371 1431 ; It is not required for the config to have the 1372 1432 ; same version as the code, so in the future 1373 1433 ; the code version might be higher than the 1374 1434 ; config version if there are no changes to the latter. 1435 ; 1375 1436 1376 1437 CFG_LastTimeEditLow dw 0 ; Last Time Edited Stamp (will incr every setup) … … 1483 1544 ; Entries allocated down from 06E00 boundary. 1484 1545 ; 1485 ORIGIN %06DABh ; 427 Boundry1546 ORIGIN 06DABh ; 427 Boundry 1486 1547 1487 1548 ; (432 - 5 = 427) … … 1502 1563 ; stealth virus is on-line, we can intercept its call. 1503 1564 ; Normal (non stealth) virus are trapped simply by rereading the MBR sector. 1504 ; If a virus is found, we will restore MBR from Sektor 60/62 and stop the system 1505 ; from working, so the user has to press reset. That's saver than a Reboot. 1565 ; If a virus is found, we will restore MBR from Sektor 60/62 and stop the 1566 ; system from working, so the user has to press reset. 1567 ; That's saver than a Reboot. 1506 1568 ; 1507 1569 ; If a virus is found on the partition to boot, the system will ONLY halt, … … 1546 1608 ; dw 0 ; No Checksum :) 1547 1609 ; db 0, 0, 1 1548 ; db 0, 0, 1 1610 ; db 0, 0, 1 ; Location of Partition/Boot Record 1549 1611 ; dd 0, 0 1550 1612 … … 1616 1678 1617 1679 1618 MBR_BackUpMBR db 'AiR-BOOT MBR-BackUp - Just to fill this sector with something',0 1680 MBR_BackUpMBR db 'AiR-BOOT MBR-BackUp',\ 1681 ' - Just to fill this sector with something',0 1619 1682 AirBootRocks db 'AiR-BOOT Rocks!',0 1620 1683 … … 1649 1712 ENDIF 1650 1713 1714 1715 1651 1716 sobss: 1652 1717 ;------------------------------------------------------------------------------ 1718 1653 1719 ; 1654 ; Removed orgfor BSS data to be more compatible1720 ; Removed ORG for BSS data to be more compatible 1655 1721 ; with segment-concatenated layout. 1656 1722 ; 1657 1723 ; What happens before this space ?? 1658 1724 ; If org 0 corruption occurs. 1725 ; 1726 1727 ; 1659 1728 ; Filling hiddenparttable goes out-of-bounds ! 1729 ; Fixed with 6-bit packing. 1660 1730 ; 1661 org 02400h ; Uninitialized 1662 ;~ org 00200h ; 200h geeft 3 floppies ! 1731 1732 ; 1733 ; If segmented, offsets are relative to the BSS segment. 1734 ; They are resolved at link-time. 1735 ; If not segmented, offsets are relative to the CODE segment. 1736 ; 1737 IFDEF SEGMENTED 1738 ORG 02400h 1739 ELSE 1740 ORG 0A000h 1741 ENDIF 1742 1663 1743 1664 1744 ; This space actually gets initialized in PreCrap to NUL (till EndOfVariables) 1665 1745 BeginOfVariables: 1666 PartitionSector db 512 dup (?) ; Temporary Sector for Partition 1667 JfsPBR db 512 dup (?) ; Temporary Sector for JFS PBR writeback 1668 LVMSector db 512 dup (?) ; Temporary Sector for LVM 1669 TmpSector db 512 dup (?) ; Temporary Sector 1746 PartitionSector db 512 dup (?) ; Temporary Sector for Partition 1747 JfsPBR db 512 dup (?) ; Temporary Sector for JFS PBR writeback 1748 LVMSector db 512 dup (?) ; Temporary Sector for LVM 1749 TmpSector db 512 dup (?) ; Temporary Sector 1750 Scratch db 256 dup (?) ; Scratch buffer 1670 1751 1671 1752 ; Everything used to build a new IPT and reference it to the old one 1672 1753 ; IETS OVERSCHRIJFT DIT !! 1673 NewPartTable db 1536 dup (?) ; New Partition Table 1674 1675 NewHidePartTable db partition_count * LocHPT_LenOfHPT dup (?) ; New Hide-Partition Table 1676 NewDriveLetters db partition_count dup (?) ; Logical Drive-Letters 1677 1678 PartitionSizeTable db partition_count * 6 dup (?) ; Size-Table (6 bytes per partition) 1679 PartitionPointers dw 52 dup (?) ; Maximum is 52 entries till now 1680 PartitionPointerCount db ? ; Count of total Partition Pointers 1681 PartitionXref db partition_count dup (?) ; X-Reference Table (holds new partnr, index is old part nr) 1682 PartitionVolumeLetters db partition_count dup (?) ; Volume-Letters 1683 ; 0 - no LVM support 1684 ; 1 - LVM support, but no letter 1685 ; 'C'-'Z' - assigned drive letter 1686 1687 TotalHarddiscs db ? ; Total harddrives (by POST) 1688 LBASwitchTable db 128 dup (?) ; Bit 25-18 for CHS/LBA Switching 1689 NewPartitions db ? ; Freshly found partitions 1754 NewPartTable db 1536 dup (?) ; New Partition Table 1755 1756 ; New Hide-Partition Table 1757 NewHidePartTable db partition_count * LocHPT_LenOfHPT dup (?) 1758 1759 ; Logical Drive-Letters 1760 NewDriveLetters db partition_count dup (?) 1761 1762 ; Size-Table (6 bytes per partition) 1763 PartitionSizeTable db partition_count * 6 dup (?) 1764 1765 ; Maximum is 52 entries till now 1766 PartitionPointers dw 52 dup (?) 1767 1768 ; Count of total Partition Pointers 1769 PartitionPointerCount db ? 1770 1771 ; X-Reference Table (holds new partnr, index is old part nr) 1772 PartitionXref db partition_count dup (?) 1773 1774 ; Volume-Letters 1775 ; 0 - no LVM support 1776 ; 1 - LVM support, but no letter 1777 ; 'C'-'Z' - assigned drive letter 1778 PartitionVolumeLetters db partition_count dup (?) 1779 1780 1781 1782 1783 TotalHarddiscs db ? ; Total harddrives (by POST) 1784 LBASwitchTable db 128 dup (?) ; Bit 25-18 for CHS/LBA Switching 1785 NewPartitions db ? ; Freshly found partitions 1690 1786 ; Independent of SaveConfiguration 1691 TooManyPartitions 1692 1693 VideoIO_Segment 1694 1695 ExtendedAbsPos 1696 ExtendedAbsPosSet 1697 1698 CurPartition_Location 1699 CurIO_UseExtension 1700 1701 CurIO_Scanning 1787 TooManyPartitions db ? ; Non-zero if too many partitions found 1788 1789 VideoIO_Segment dw ? ; Segment for Video I/O 1790 1791 ExtendedAbsPos dd ? ; Extended Partition Absolute Position 1792 ExtendedAbsPosSet db ? ; If Absolute Position set 1793 1794 CurPartition_Location dw 4 dup (?) ; Where did current partition come from? 1795 CurIO_UseExtension db ? ; 1-Use INT 13h EXTENSIONS 1796 ; (filled out by PreCrap) 1797 CurIO_Scanning db ? ; 1-AiR-BOOT is scanning partitions 1702 1798 ; (for detailed error message) 1703 1799 … … 1705 1801 ;GotLinux db ? ; 1-Linux found 1706 1802 1707 Menu_EntrySelected 1708 Menu_UpperPart 1709 Menu_AbsoluteX 1710 Menu_TotalParts 1711 Menu_TotalLines 1712 Menu_EntryDefault 1713 Menu_EntryLast 1714 Menu_EntryAutomatic 1803 Menu_EntrySelected db ? ; Which partition we boot this time... 1804 Menu_UpperPart db ? ; Which number (Base=0) is the partition upper pos 1805 Menu_AbsoluteX db ? ; Pos where Menu stuff starts 1806 Menu_TotalParts db ? ; Copy of CFG_BootParts 1807 Menu_TotalLines db ? ; Total Lines on Screen used for BootMenu 1808 Menu_EntryDefault db ? ; Default Entry in filtered View 1809 Menu_EntryLast db ? ; LastBooted Entry in filtered View 1810 Menu_EntryAutomatic db ? ; Automatic Entry in filtered View 1715 1811 ; - All adjusted to menu locations 1716 1812 1717 PartSetup_UpperPart 1718 PartSetup_ActivePart 1719 PartSetup_HiddenUpper 1720 PartSetup_HiddenX 1721 PartSetup_HiddenAdd 1722 1723 TimedBootEnable 1724 TimedTimeOut dd ? ; TimeOut Timer for TimedBoot (too much time here;)1725 TimedSecondLeft 1726 TimedSecondBack 1727 TimedBootUsed 1728 FloppyGetNameTimer 1729 SETUP_KeysOnEntry 1730 SETUP_ExitEvent 1731 TempPasswordEntry 1732 SETUP_OldPwd 1733 SETUP_NewPwd 1734 SETUP_VerifyPwd 1735 StartSoundPlayed 1736 ChangePartNameSave 1737 SyncLvmLabels 1813 PartSetup_UpperPart db ? ; Partition-Setup (like Menu_UpperPart) 1814 PartSetup_ActivePart db ? ; Active Partition 1815 PartSetup_HiddenUpper db ? ; (like Menu_UpperPart) 1816 PartSetup_HiddenX db ? ; Pos for Hidden-Setup 1817 PartSetup_HiddenAdd db ? ; Adjust for Hidden-Setup 1818 1819 TimedBootEnable db ? ; Local Enable/Disable for timed boot 1820 TimedTimeOut dd ? ; TimeOut Timer for TimedBoot (too much time here;) 1821 TimedSecondLeft db ? ; How many seconds are left till boom ? 1822 TimedSecondBack db ? ; To get a modification noticed 1823 TimedBootUsed db ? ; Timed Boot used for bootup ? 1824 FloppyGetNameTimer dd ? ; Timer for Floppy-Get-Name 1825 SETUP_KeysOnEntry db ? ; which Shift Status was there, when booting ? 1826 SETUP_ExitEvent db ? ; Exit Event to end SETUP 1827 TempPasswordEntry db 17 dup (?) 1828 SETUP_OldPwd db 17 dup (?) 1829 SETUP_NewPwd db 17 dup (?) 1830 SETUP_VerifyPwd db 17 dup (?) 1831 StartSoundPlayed db ? 1832 ChangePartNameSave db ? ; Save label after user-edit ? 1833 SyncLvmLabels db ? ; Sync LVM labels after user-edit ? 1738 1834 1739 1835 FX_UseCount dw ? … … 1748 1844 FX_CooperBarsTimer dw ? 1749 1845 1750 ; [Linux support removed since v1.02] 1751 ;FAT16_Drive db ? ; FAT-16: Drive of FAT16-partition 1752 ;FAT16_AbsPartitionBegin dd ? ; FAT-16: LBA Begin of Partition 1753 ;FAT16_SecsPerCluster db ? ; FAT-16: Sectors Per Cluster 1754 ;FAT16_NumOfRootEntries dw ? ; FAT-16: Number of Root Entries 1755 ;FAT16_SecsPerFAT dw ? ; FAT-16: Sectors Per FAT 1756 ;FAT16_AbsFATBegin dd ? ; FAT-16: LBA Begin of FAT 1757 ;FAT16_AbsRootBegin dd ? ; FAT-16: LBA Begin of Root 1758 ;FAT16_AbsClusterBegin dd ? ; FAT-16: LBA Begin of Clusters 1759 ;FAT16_FATCacheSector db ? ; FAT-16: FAT-Sector No in Cache 1760 ;FAT16_FATCache db 512 dup (?) ; FAT-16: FAT-Area Cache 1761 ; 1762 ;LINUX_KernelEntries db 680 dup (?) ; 34*20 -> Space for Kernel-Entries 1763 ;LINUX_KernelNo db ? ; Total of Kernels in KernelEntries 1764 ;LINUX_KernelSizeTable db 120 dup (?) ; Size-Table (6 bytes per kernel) 1765 ;EndOfVariables: 1846 ;~ ; [Linux support removed since v1.02] 1847 ;~ FAT16_Drive db ? ; FAT-16: Drive of FAT16-partition 1848 ;~ FAT16_AbsPartitionBegin dd ? ; FAT-16: LBA Begin of Partition 1849 ;~ FAT16_SecsPerCluster db ? ; FAT-16: Sectors Per Cluster 1850 ;~ FAT16_NumOfRootEntries dw ? ; FAT-16: Number of Root Entries 1851 ;~ FAT16_SecsPerFAT dw ? ; FAT-16: Sectors Per FAT 1852 ;~ FAT16_AbsFATBegin dd ? ; FAT-16: LBA Begin of FAT 1853 ;~ FAT16_AbsRootBegin dd ? ; FAT-16: LBA Begin of Root 1854 ;~ FAT16_AbsClusterBegin dd ? ; FAT-16: LBA Begin of Clusters 1855 ;~ FAT16_FATCacheSector db ? ; FAT-16: FAT-Sector No in Cache 1856 ;~ FAT16_FATCache db 512 dup (?) ; FAT-16: FAT-Area Cache 1857 ;~ LINUX_KernelEntries db 680 dup (?) ; 34*20 -> Space for Kernel-Entries 1858 ;~ LINUX_KernelNo db ? ; Total of Kernels in KernelEntries 1859 ;~ LINUX_KernelSizeTable db 120 dup (?) ; Size-Table (6 bytes per kernel) 1766 1860 1767 1861 ; Dynamically Generated Tables - do not need to get initialized with NUL 1768 FX_CooperColors db 672 dup (?) ; 7 cooper bars*96 - runtime calculated 1769 FX_CooperState db 7 dup (?) 1770 FX_SinusPos db 7 dup (?) 1771 FX_CooperPos dw 7 dup (?) 1772 CharsetTempBuffer db 4096 dup (?) ; Uninitialized Charset buffer 1773 LVM_CRCTable dd 256 dup (?) ; LVM-CRC (->SPECiAL\LVM.asm) 1862 FX_CooperColors db 672 dup (?) ; 7 cooper bars*96 - runtime calculated 1863 FX_CooperState db 7 dup (?) 1864 FX_SinusPos db 7 dup (?) 1865 FX_CooperPos dw 7 dup (?) 1866 CharsetTempBuffer db 4096 dup (?) ; Uninitialized Charset buffer 1867 LVM_CRCTable dd 256 dup (?) ; LVM-CRC (->SPECiAL\LVM.asm) 1868 1774 1869 1775 1870 … … 1809 1904 LOG_TotalSecs dq MaxDisks dup(?) 1810 1905 1811 ; Rousseau: moved here1906 ; End of transient variables. 1812 1907 EndOfVariables: 1813 1908 1814 ; Temporary buffer for 48h INT13X bios call 1815 ; Word aligned 1816 ;even 1817 ;align 2 1818 1819 ;db 1 dup(?) 1820 1821 i13xbuf dw 1 dup (?) ; Size of the buffer; 1822 ; this param *must* be present. 1823 ; Code inserts it. 1824 db 126 dup(?) ; The buffer itself. 1825 i13xbuf_size = $-offset i13xbuf-2 ; Size of buffer 1826 ; (excluding the size word at the start). 1827 1909 1910 ; 1911 ; Temporary buffer for 48h INT13X bios call. 1912 ; 1913 1914 ; Size of the buffer. 1915 ; this param *must* be filled in. 1916 ; Code inserts it. 1917 i13xbuf dw 1 dup (?) 1918 1919 ; The buffer itself. 1920 db 126 dup(?) 1921 1922 ; Size of buffer calculated. 1923 ; (excluding the size word at the start). 1924 i13xbuf_size = $-offset i13xbuf-2 1925 1926 ; Some debug area. 1828 1927 ott db 512 dup(?) 1829 1928 … … 1831 1930 1832 1931 IFDEF SEGMENTED 1833 VOLATILE ENDS1932 VOLATILE ENDS 1834 1933 ELSE 1835 LDRIMAGE ENDS1934 LDRIMAGE ENDS 1836 1935 ENDIF 1837 1936 -
trunk/BOOTCODE/AIR-BOOT.HIS
r45 r46 23 23 ; Rousseau: Fixes and Enhancements 24 24 ; --------------------------------- 25 ; 26 ; v1.0.8-rc2-bld20120224 27 ;----------------------- 25 ; v1.0.8-rc2-bld201204??+ 26 ; --------------------- 27 28 29 ; v1.0.8-pre-rc2-bld20120330 30 ; -------------------------- 31 ; # Merged 16-bit Assembler bitfield code to the Installer # 32 ; The installer needs to handle the v1.0.8 configuration. 33 ; This requires access to the 6-bit packed 'hideparttable'. 34 ; To 'not-reinvent-the-wheel', by coding this in C, the Assembler 35 ; bitfield functions are integrated using Open Watcom's '_asm' capability. 36 ; It may not be pretty and the functions themselves are limited, 37 ; but this method prevents maintaining seperate Asm and C implementations. 38 ; Will be improved later. 39 ; 40 ; # Implemented BLDLEVEL support # 41 ; AIRBOOT.BIN, the Installers and SET(A)BOOT now support OS/2 BLDLEVEL 42 ; information. This enhances identification and problem tracking/solving. 43 ; While BLDLEVEL is an OS/2 command, the BLDLEVEL information itself can 44 ; be embedded in any binary. Invoking BLDLEVEL from within OS/2 on, let's 45 ; say, the AIRBOOTL.ELF Linux executable, will also show the BLDLEVEL info. 46 ; A slight deficiency of BLDLEVEL is that is forces a format on the version. 47 ; So, AiR-BOOT v1.0.8 will be shown as v1.00.8. 48 ; 49 ; # Added support for Masm6 and Wasm v1.9 -- Experimental use only # 50 ; Trying to assemble with Masm6 or Wasm v1.9 reveiled some interesting 51 ; behavior aspects in general. While this version can now be assembled with 52 ; Masm6 and Wasm too, this was only done to get a 'cross-feeling' for this 53 ; project. Future versions will drop support for Tasm, Masm6 and Wasm since 54 ; much conditional assembly is needed to support all of them. This was an 55 ; experimental excercise only. JWasm is the assembler of choise for this 56 ; project and any future versions. 57 ; 28 58 ; # Implemented stop scanning when max. partitions limit exceeded # 29 59 ; Previous versions halted the system when the maximum number of partitions … … 73 103 ; AiR-BOOT and it's helpers can now be built on: DOS, Win32, OS/2 and Linux. 74 104 ; 75 ; # Rewrote FIXCODE.ASM in C so the tool-chain is not dependent on a DOS .COM 76 ; program for embedding the MBR-protection. DOS,Win32,OS/2 and Linux 77 ; versions of FIXCODE are now used. (EXE[MZ|PE|LX] and ELF) 105 ; # Rewrote FIXCODE.ASM in C so the tool-chain is not dependent on a DOS .COM # 106 ; Now FIXCODE is built platform-specific and takes care of the embedding 107 ; of MPR-protection image. 108 ; 109 ; # Created FIXCODE bash-script to accomplish embedding of MBR-protection # 110 ; Building on Linux requires that no DOS-tools are used in the tool-chain. 111 ; This script essentially performs the same functionality but does not check 112 ; certain conditions, like image-too-big, etc. 113 ; It is a 'quick-hack' until the Linux version of FIXCODE is operational. 78 114 ; 79 115 ; v1.0.8-rc1-bld20120124 -
trunk/BOOTCODE/MBR-PROT/.build
r37 r46 1 1 #!/bin/bash 2 2 3 make clean3 #make clean 4 4 make -
trunk/BOOTCODE/MBR-PROT/MBR-PROT.ASM
r45 r46 24 24 ; 25 25 .286 26 ;.model large,c 26 27 ; Tasm needs a memory model for USES on PROC to work. 28 IFDEF TASM 29 ;~ .model large, basic 30 .model tiny,c 31 ENDIF 27 32 28 33 ;_TEXT SEGMENT USE16 PUBLIC 'CODE' … … 38 43 39 44 org 0000h 40 .386p 45 ;.386p 46 ;.286 41 47 42 ; Yes you are :-) 43 ;OldInterrupt10 dd 'kcuf' ; we are nice aren't we ;-) 44 ;OldInterrupt13 dd 'kcuf' 45 48 ; 49 ; Storage for old interrupt vectors. 50 ; 46 51 OldInterrupt10 dd 0 47 52 OldInterrupt13 dd 0 … … 172 177 MBRP_Line3 db 'ÔÍÍÍŽAiR-BOOT (c) Copyright by M. Kiewitz 1999-2012ÃÍÍŸ' 173 178 179 xxx: 180 174 181 org 1023 175 182 db 0 -
trunk/BOOTCODE/MBR-PROT/Makefile
r37 r46 1 ############################################################### 2 # Makefile :: Builds the MBR Protection Image.#3 ############################################################### 1 ############################################################################### 2 # Makefile :: Builds the MBR-PROT.BIN 16-bits RAW Protection Image. # 3 ############################################################################### 4 4 # rousseau@ecomstation.com 5 5 # … … 45 45 # Source Level base-name of Target to build. 46 46 # 47 BASENAME=MBR _PROT47 BASENAME=MBR-PROT 48 48 49 49 # … … 81 81 # -Cp = case sensitive symbols 82 82 # -zcw = no _ prefix on symbols (C model) 83 ASM_FLAGS_D0=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q - zcw -nt='CODE_SEG' -nd='DATA_SEG' -Fo$^.-Fw$^&.ERR84 ASM_FLAGS_D1=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q - zcw -Zd -Zi -Fo$^.-Sa -Fl=$^&.LST -Fw$^&.ERR85 ASM_FLAGS_D2=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q - zcw -Zd -Zi -Fo$^.-Sa -Fl=$^&.LST -Fw$^&.ERR83 ASM_FLAGS_D0=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -Cp -zcw -Fo$^&.OBJ -Sa -Fl=$^&.LST -Fw$^&.ERR 84 ASM_FLAGS_D1=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -Cp -zcw -Zd -Zi -Fo$^&.OBJ -Sa -Fl=$^&.LST -Fw$^&.ERR 85 ASM_FLAGS_D2=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -Cp -zcw -Zd -Zi -Fo$^&.OBJ -Sa -Fl=$^&.LST -Fw$^&.ERR 86 86 !elseif "$(ASM)"=="masm" 87 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dMASM -zq -fo=$^ .-fr=$^&.ERR88 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dMASM -zq -d1 -fo=$^ .-fr=$^&.ERR89 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dMASM -zq -d1 -fo=$^ .-fr=$^&.ERR87 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dMASM -zq -fo=$^&.OBJ -fr=$^&.ERR 88 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dMASM -zq -d1 -fo=$^&.OBJ -fr=$^&.ERR 89 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dMASM -zq -d1 -fo=$^&.OBJ -fr=$^&.ERR 90 90 !elseif "$(ASM)"=="wasm" 91 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dWASM -zq -fo=$^ .-fr=$^&.ERR92 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dWASM -zq -d1 -fo=$^ .-fr=$^&.ERR93 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dWASM -zq -d1 -fo=$^ .-fr=$^&.ERR91 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dWASM -zq -fo=$^&.OBJ -fr=$^&.ERR 92 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dWASM -zq -d1 -fo=$^&.OBJ -fr=$^&.ERR 93 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dWASM -zq -d1 -fo=$^&.OBJ -fr=$^&.ERR 94 94 !elseif "$(ASM)"=="tasm" 95 95 # -ml = case sensitive symbols 96 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -m 9 -l97 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -m 9 -z -zi -c -la98 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -m 9 -z -zi -c -la96 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -ml -m9 -l 97 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -ml -m9 -z -zi -c -la 98 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -ml -m9 -z -zi -c -la 99 99 !elseif "$(ASM)"=="alp" 100 100 ASM_FLAGS_D0=-D:DEBUG_LEVEL=$(DEBUG_LEVEL) -D:ALP -Mb +Feo:OBJ +Fl +Fel:LST +Fm +Fem:ERR … … 133 133 134 134 # 135 # This builds all the languagesusing normal dependency rules.135 # This builds the target using normal dependency rules. 136 136 # If this Makefile was modified, all targets are forcefully rebuilt. 137 # At the end all intermediate files are deleted. 138 # Use wmake dev to to development; this generated one image and leaves 139 # the intermediate files intact. 140 # 141 all: .SYMBOLIC Makefile.bu $(TARGET) footer 142 # @echo ALL !! 143 # @#MAKE $(BLD_LANGUAGES) 144 # @for %%i in ($(BLD_LANGUAGES)) do @%MAKE AB-%%i 145 # @echo $< 146 # @%MAKE clean 147 148 149 # 150 # Some targets have the .MULTIPLE directive defined. 151 # This is because the iteration "calls" for the creation of other (meta) 152 # targets. If .MULTIPLE would not be defined these (meta) targets would not 153 # be "built" anymore because the are considered up-to-date. 154 # With multiple this assumption is removed and the target is "rebuilt" for 155 # every target that depends on it. 156 # This mostly concerns meta operations like clean etc., 157 # but of course also the main building of the AIRBOOT.BIN module. 158 # 137 # 138 all: .SYMBOLIC Makefile.bu header $(TARGET) footer 139 159 140 160 141 # 161 142 # Show the header. 162 143 # 163 header: .SYMBOLIC .MULTIPLE144 header: .SYMBOLIC 164 145 @echo. 165 146 @echo ===================================================================== 166 @echo = MODULE: $(TARGET) [$(%BLD_LANG)] [16-bits Raw Binary Loader] =147 @echo = MODULE: $(TARGET) [16-bits Raw Protection Image] = 167 148 @echo ===================================================================== 168 149 # @echo. … … 200 181 # 16-bits RAW :: MBR virus protection to be embedded in the AIRBOOT.BIN image. 201 182 ############################################################################### 202 $(TARGET): .MULTIPLE$(BASENAME).COM183 #$(TARGET): $(BASENAME).COM 203 184 # $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys dos com 204 $(CP) $(BASENAME).COM $(TARGET)185 # $(CP) $(BASENAME).COM $(TARGET) 205 186 # @echo $(%BLD_LANG)>$^. 206 @if exist $^. @echo $^. $(MSG_SUCCESS) - [$(%BLD_LANG) version]187 # @if exist $^. @echo $^. $(MSG_SUCCESS) - [$(%BLD_LANG) version] 207 188 # $(RM) $(TARGET) 208 189 # @echo. … … 211 192 212 193 ############################################################################### 213 # 16-bits COM :: Intermediate image without embedded MBR-prot. and code count. 214 ############################################################################### 215 $(BASENAME).COM: .MULTIPLE $(BASENAME).OBJ 194 # 16-bits RAW :: MBR virus protection to be embedded in the AIRBOOT.BIN image. 195 ############################################################################### 196 $(TARGET): $(BASENAME).ASM 197 @echo TARGET: $^. [DOS 16-bits Raw Image] 198 $(ASM) $(ASM_FLAGS) $(BASENAME).ASM 199 @wdis -fi $^&.OBJ > $^&.WDA 216 200 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys dos com 217 201 # $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. form raw 218 # @if exist $^. @echo $^. $(MSG_SUCCESS) 219 # @echo. 220 221 $(BASENAME).OBJ: .MULTIPLE $(BASENAME).ASM 222 # @echo. 223 @echo TARGET: $^. [DOS 16-bits Raw Image] 224 $(ASM) $(ASM_FLAGS) $(BASENAME).ASM 225 @wdis $^. > $^&.WDA 202 @if exist $^. @echo $^. $(MSG_SUCCESS) 203 @ndisasm -k9,0 $^. > $^&.NDA 204 # @echo. 205 206 #$(BASENAME).OBJ: $(BASENAME).ASM 207 # @echo. 208 # @echo TARGET: $^. [DOS 16-bits Raw Image] 209 # $(ASM) $(ASM_FLAGS) $(BASENAME).ASM 210 # @wdis -fi $^. > $^&.WDA 226 211 227 212 … … 242 227 # Remove all generated files. 243 228 # 244 clean: .SYMBOLIC .MULTIPLE229 clean: .SYMBOLIC 245 230 # @echo CLEANING UP 246 231 # @for %%i in ($(TARGET)) do @if exist %%i $(RM) %%i 247 232 @if exist *.COM $(RM) *.COM 233 @if exist *.BIN $(RM) *.BIN 248 234 @if exist *.OBJ $(RM) *.OBJ 249 235 @if exist *.WDA $(RM) *.WDA 236 @if exist *.NDA $(RM) *.NDA 250 237 @if exist *.MAP $(RM) *.MAP 251 238 @if exist *.LST $(RM) *.LST -
trunk/BOOTCODE/Makefile
r45 r46 31 31 # 32 32 # This embedding proccess consists of three parts: 33 # - Assembling the virus-detection code, which always results33 # - Assembling the virus-detection code, MBR_PROT.ASM, which always results 34 34 # in a 1024 bytes image. 35 35 # - Compiling the FIXCODE program that does the actual embedding. … … 39 39 40 40 # 41 # After these operations have completed, the AIRBOOT.BIN image41 # After these operations have been completed, the AIRBOOT.BIN image 42 42 # is ready to be installed. 43 43 # … … 54 54 55 55 56 # 56 57 58 59 # DEFINITIONS AND STUFF 60 # _____________________________________________________________________________ 61 62 57 63 # Include a Master Makefile with several cross-platform definitions and macros. 58 64 # This is used to compensate for the differences between the target platforms. 59 #60 65 !include ../INCLUDE/MAKEFILE.MIF 61 66 62 # 67 63 68 # Specifies the level of debugging. 64 69 # Level 0 is no debugging (release) and each higher level may use other 65 70 # assembler / compiler / linker flags and define jammed-in constants 66 71 # to influence source assembly / compilation. 67 #68 72 DEBUG_LEVEL=0 69 73 MAX_DEBUG_LEVEL=2 70 74 71 #72 75 # Protect against missing or invalid debug-levels. 73 #74 76 !ifndef DEBUG_LEVEL 75 77 !error DEBUG_LEVEL not defined ! … … 82 84 !endif 83 85 84 #85 86 # Source Level base-name of Target to build. 86 87 # The various language versions are created by replacing TXT-files 87 88 # and reassembling this file. 88 #89 89 BASENAME=AIR-BOOT 90 90 91 #92 91 # When you are developing, you might want to do that using your own language. 93 # Using wmake devwill built a module called AIRBOOT.BIN with this language92 # Using 'wmake dev' will built a module called AIRBOOT.BIN with this language 94 93 # and leave all the intermediate files intact. 95 # You also want to set this to RU because for this language an extra charset 96 # in included, taking up extra space. If it builds with RU it will build 97 # with all other languages. 98 # 94 # When developing on a non-RU language version, you need to do a 'wmake RU' 95 # from time-to-time to verify that you do not run out of space. 96 # This is needed because for this language the cyrillic charset is in included, 97 # taking up extra space. If it builds for RU it will build for all other 98 # languages. 99 99 DEV_BLD_LANG=EN 100 100 101 #102 101 # These are the languages that AiR-BOOT can be assembled with. 103 102 # Adding a new language requires creating the relevant TXT-files, 104 103 # placing then in the correct language directory and then add the lang-ID here. 105 # RU is last in the list since it includes a charset will run out-of-space 106 # sooner that the other languages. If that happens at least a few will be 107 # built for analysis. 108 # 109 BLD_LANGUAGES=EN DE NL FR IT SW RU 104 # RU is last in the list since it includes the cyrillic charset and thus 105 # will run out-of-space sooner that the other languages. 106 # If that happens at least the others will be built. 107 BLD_LANGUAGES=EN DE NL FR IT SW #RU 110 108 #BLD_LANGUAGES=EN DE NL 111 109 112 #113 110 # For each language the Assembler source is compiled to a binary image 114 # with this basename. Note that it differs from the source basename. 115 # 111 # with this basename. When building one or more language versions, the 112 # final image is renamed to contain the language it was built for. 113 # When developing the final image is not renamed. 114 # Note that it differs from the source basename. 116 115 MODULE=AIRBOOT 117 116 118 #119 117 # This is a list of the Targets to be built. 120 118 # For AiR-BOOT there is only one real target: AIRBOOT.BIN. … … 122 120 # Only a dev-build does not rename it so it can directly be used by 123 121 # the installer. 124 #125 122 TARGET=$(MODULE).BIN 126 123 127 # 128 # Assembler Tools. 129 # 124 #~ %AB_DEV=FALSE 125 126 # Assembler Selection. 127 # Uncomment to enable. 128 # May be overridden by environment or platform choise ! 129 130 # JWTM -- JWasm, Wasm, Tasm and Masm. 131 ASM=jwasm 132 #ASM=wasm 133 #ASM=tasm 130 134 #ASM=masm 131 135 #ASM=alp 132 ASM=tasm 133 #ASM=wasm 134 #ASM=jwasm 135 136 # 137 # JWasm does not work on DOS, so we override it. 138 # 136 137 138 139 # If there is an assembler specified in the environment, override 140 # the choise made above, if any. 141 !if "$(%ASM)"!="" 142 ASM=$(%ASM) 143 !endif 144 145 # If no assembler is specified then default to JWasm. 146 !ifndef ASM 147 ASM=jwasm 148 !endif 149 150 # JWasmD needs special settings in an OS/2 VDM so we override it for DOS. 151 # To run JWasmD in an OS/2 VDM, change DPMI from AUTO to ENABLED and 152 # set the XMS memory limit to 0. 153 # JWasmR will probably run out of memory and cannot be used. 139 154 !ifdef __MSDOS__ 140 155 ASM=tasm 141 156 !endif 142 157 143 #144 158 # There are no masm or alp for Linux and the yasm tasm-mode is incompatible. 145 159 # So we override to jwasm when a non-jwasm assembler is specified and 146 160 # we are building on Linux. 147 #148 161 !ifdef __LINUX__ 149 162 !if "$(ASM)"=="masm" | "$(ASM)"=="tasm" | "$(ASM)"=="alp" … … 152 165 !endif 153 166 167 # 168 # Assembler Flags. 169 # 170 171 # JWASM 154 172 !if "$(ASM)"=="jwasm" 155 173 # -Cp = case sensitive symbols … … 157 175 # -Zm = Masm51 compat -- don't use ! (Will generate incorrect offsets) 158 176 ASM_FLAGS_D0=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -Cp -zcw -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR 159 ASM_FLAGS_D1=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -zcw -Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR 160 ASM_FLAGS_D2=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -zcw -Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR 161 !elseif "$(ASM)"=="masm" 162 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dMASM -zq -fo=$^. -fr=$^&.ERR 163 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dMASM -zq -d1 -fo=$^. -fr=$^&.ERR 164 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dMASM -zq -d1 -fo=$^. -fr=$^&.ERR 177 ASM_FLAGS_D1=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -Cp -zcw -Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR 178 ASM_FLAGS_D2=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -Cp -zcw -Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR 179 180 # WASM 165 181 !elseif "$(ASM)"=="wasm" 166 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dWASM -zq -fo=$^. -fr=$^&.ERR 182 # -w0 = suppress warnings (wasm is nice to check for missing size qualifiers) 183 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dWASM -zq -w0 -fo=$^. -fr=$^&.ERR 167 184 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dWASM -zq -d1 -fo=$^. -fr=$^&.ERR 168 185 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dWASM -zq -d1 -fo=$^. -fr=$^&.ERR 186 187 # TASM 169 188 !elseif "$(ASM)"=="tasm" 170 189 # -ml = case sensitive symbols 171 190 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -ml -m9 -l 172 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -m9 -z -zi -c -la 173 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -m9 -z -zi -c -la 191 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -ml -m9 -z -zi -c -la 192 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -ml -m9 -z -zi -c -la 193 194 # MASM 195 !elseif "$(ASM)"=="masm" 196 ASM_FLAGS_D0=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DMASM -c -nologo -Cp -Fo$^. -Sa -Fl$^&.LST 197 ASM_FLAGS_D1=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DMASM -c -nologo -Cp -Zd -Zi -Fo$^. -Sa -Fl$^&.LST 198 ASM_FLAGS_D2=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DMASM -c -nologo -Cp -Zd -Zi -Fo$^. -Sa -Fl$^&.LST 199 200 # ALP -- Does not support '/' for includes so it cannot be used for now. 174 201 !elseif "$(ASM)"=="alp" 175 202 ASM_FLAGS_D0=-D:DEBUG_LEVEL=$(DEBUG_LEVEL) -D:ALP -Mb +Feo:OBJ +Fl +Fel:LST +Fm +Fem:ERR 176 203 ASM_FLAGS_D1=-D:DEBUG_LEVEL=$(DEBUG_LEVEL) -D:ALP -Mb +Od:MS16 +Feo:OBJ +Fl +Fel:LST +Fm +Fem:ERR 177 204 ASM_FLAGS_D2=-D:DEBUG_LEVEL=$(DEBUG_LEVEL) -D:ALP 205 206 # UNKNOWN 178 207 !else 179 !error Unknown Assembler specified ! 208 !error Unknown Assembler specified ! *$(ASM)* 180 209 !endif 181 210 ASM_FLAGS=$(ASM_FLAGS_D$(DEBUG_LEVEL)) 182 211 183 # 184 # 16-bits C Compiler 185 # 212 213 # 214 # Compiler Flags. 215 # 216 217 218 # 16-bits C Compiler. 186 219 CC16=wcc 187 220 CC16_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -w4 -e25 -zq -od -fo=$^. … … 190 223 CC16_FLAGS=$(CC16_FLAGS_D$(DEBUG_LEVEL)) 191 224 192 # 193 # 32-bits C Compiler 194 # 225 # 32-bits C Compiler. 195 226 CC32=wcc386 196 227 CC32_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -w4 -e25 -zq -od -6r -mf -fo=$^. 197 228 CC32_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -6r -mf -fo=$^. 198 229 CC32_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -6r -mf -fo=$^. 199 CC32_FLAGS_R=-w4 -e25 -zq -od -6r -mf -fo=$^.200 230 CC32_FLAGS=$(CC32_FLAGS_D$(DEBUG_LEVEL)) 201 231 202 232 # 203 # Linker 204 # 233 # Linker Flags. 234 # 235 236 # Open Watcom Linker. 205 237 LNK=wlink 206 238 LNK_FLAGS_D0=op q op v disa {1014 1023} op map=$^&.MAP … … 209 241 LNK_FLAGS=$(LNK_FLAGS_D$(DEBUG_LEVEL)) 210 242 211 212 # 213 # This is executed before Makefile processing. 214 # 243 # These need to be built 244 DEPTARGETS=MBR-PROT ..$(DS)TOOLS$(DS)INTERNAL 245 246 247 248 # BEFORE AND AFTER TARGETS 249 # _____________________________________________________________________________ 250 251 252 # ----------------------------------------------------------------------------- 253 # ANY PROCESSING BEFOREHAND 254 # ----------------------------------------------------------------------------- 215 255 .BEFORE 216 256 # @echo == BEFORE == 217 257 218 # 219 # This is executed after Makefile processing. 220 # 258 259 # ----------------------------------------------------------------------------- 260 # ANY PROCESSING AFTERWARDS 261 # ----------------------------------------------------------------------------- 221 262 .AFTER 222 263 # @echo == AFTER == … … 224 265 @echo $(WARN_DOS_BLD_ENV) 225 266 !endif 226 227 228 # 267 !if "$(ASM)"=="wasm" | "$(ASM)"=="masm" 268 @echo $(WARN_OVERLAP_NOT_SUPPORTED) 269 !endif 270 271 272 273 274 # PSEUDO TARGETS FOR PREPARATION 275 # _____________________________________________________________________________ 276 277 278 # ----------------------------------------------------------------------------- 279 # BUILD ALL 280 # ----------------------------------------------------------------------------- 229 281 # This builds all the languages using normal dependency rules. 230 282 # If this Makefile was modified, all targets are forcefully rebuilt. 231 283 # At the end all intermediate files are deleted. 232 # Use wmake dev to to development; this generated one image and leaves284 # Use wmake dev to do development; that will generate one image and leave 233 285 # the intermediate files intact. 234 # 286 # ----------------------------------------------------------------------------- 235 287 all: .SYMBOLIC Makefile.bu mbrprot $(BLD_LANGUAGES) footer 236 288 # @echo ALL !! … … 240 292 @%MAKE clean 241 293 242 # 294 295 # ----------------------------------------------------------------------------- 296 # LANGUAGE SETUP 297 # ----------------------------------------------------------------------------- 243 298 # Setup the relevant language files. 244 # 299 # This is done by generating include-files for the specified language. 300 # This is a 'pre-action' before assembling the AiR-BOOT.ASM source. 301 # ----------------------------------------------------------------------------- 245 302 langsetup: .SYMBOLIC .MULTIPLE 303 # Default to development language is none defined. 304 !if "$(%BLD_LANG)"=="" 305 %BLD_LANG=DEV_BLD_LANG 306 !endif 307 # Generate include-files for specified language. 308 # After this, the Assembly sources are setup for the specified language. 309 # Note that this target is not used as a 'dependency' but 'called' explicitly 310 # by the $(BLD_LANGUAGES) target. 246 311 @echo Include TEXT/$(%BLD_LANG)/MBR.ASM > TEXT$(DS)TXTMBR.ASM 247 312 @echo Include TEXT/$(%BLD_LANG)/MENUS.ASM > TEXT$(DS)TXTMENUS.ASM 248 @echo Include TEXT/$(%BLD_LANG)/OTHER.ASM > TEXT$(DS)TXTOTHER.ASM 249 250 # 251 # For every language we Assemble and Link steps are performed. 252 # This is the symbolic meta-target for that. 253 # If functions as an iteration (for-next loop). 254 # 313 @echo Include TEXT/$(%BLD_LANG)/OTHER.ASM > TEXT$(DS)TXTOTHER.ASM 314 315 316 # ----------------------------------------------------------------------------- 317 # BUILD ALL LANGUAGES 318 # ----------------------------------------------------------------------------- 319 # For every language we Assemble and Link these steps are performed. 320 # This is the symbolic meta-target for building a language version. 321 # If functions as an iteration (for-next loop) because the 'all:' target 322 # depends on it. 323 # ----------------------------------------------------------------------------- 255 324 $(BLD_LANGUAGES): .SYMBOLIC 256 325 @SET BLD_LANG=$@ … … 260 329 @%MAKE langsetup 261 330 @%MAKE $(TARGET) 262 # Supress rename message for dev-build 331 # Checking %AB_DEV does not work from target 'dev:' when non-recursively 332 # invoked. Var '%AB_DEV' *is* set correctly but conditional !if's fail on it. 333 # Bug ? 334 # @echo $(%AB_DEV) 335 # Do not rename for dev-build 263 336 !if "$(%AB_DEV)"!="TRUE" 264 @echo Renaming to AIRBT-$@.BIN 337 #~ !ifndef %AB_DEV 338 @echo. 339 @echo ** Renaming Target ** 265 340 $(MV) $(TARGET) AIRBT-$@.BIN 266 # @echo $@>AIRBT-$@.BIN $(%AB_DEV) 267 !endif 268 341 !endif 342 # @echo $(%AB_DEV) 269 343 # @%MAKE clean 270 344 … … 272 346 # 273 347 # Some targets have the .MULTIPLE directive defined. 274 # This is because the iteration "calls" for the creation of other (meta)275 # targets. If .MULTIPLE would not be defined these (meta) targets would not276 # be "built" anymore because theare considered up-to-date.277 # With multiple this assumption is removed and the target is "rebuilt"for348 # This is because the language iteration 'calls' for the creation of 349 # other (meta) targets. If .MULTIPLE were not defined these (meta) targets 350 # would not be 'built' anymore because they are considered up-to-date. 351 # With multiple this assumption is removed and the target is 'rebuilt' for 278 352 # every target that depends on it. 279 # This mostly concerns meta operations like clean etc., 280 # but of course also the main building of the AIRBOOT.BIN module. 281 # 282 283 # 284 # Show the header. 285 # 353 # 354 355 356 # ----------------------------------------------------------------------------- 357 # SHOW THE HEADER FOR THE TARGET BEING BUILT 358 # ----------------------------------------------------------------------------- 286 359 header: .SYMBOLIC .MULTIPLE 287 360 @echo. … … 292 365 293 366 294 # 295 # S how the footer.296 # 367 # ----------------------------------------------------------------------------- 368 # SHOW THE FOOTER 369 # ----------------------------------------------------------------------------- 297 370 footer: .SYMBOLIC 298 371 # $(RM) $(TARGET) … … 301 374 302 375 303 # 376 # ----------------------------------------------------------------------------- 377 # CHECK FOR MAKEFILE CHANGES 378 # ----------------------------------------------------------------------------- 304 379 # Create a backup of the Makefile when it is modified. 305 380 # This also forces a rebuild of all targets. 306 381 # So, when changing i.e. the DEBUG_LEVEL, all targets are rebuilt 307 382 # using the new level. 308 # 383 # ----------------------------------------------------------------------------- 309 384 Makefile.bu: Makefile 310 385 @echo. … … 312 387 @echo. 313 388 @%MAKE clean 314 $(CP) Makefile Makefile.bu389 @$(CP) Makefile Makefile.bu > $(NULDEV) 315 390 316 391 … … 318 393 # DOS WMake has a bug in that it expands $^& and $^. to lowercase, 319 394 # even though the definition is in uppercase. 320 # This gives problems when building in an OS/2 DOS-Box on a network 321 # share where also a Linux build-environment is active. 322 # The Linux build-environment is case sensitive and will not 323 # find the lowercase files. 395 # This gives problems when building in an OS/2 DOS-Box on a (samba) network 396 # share with a case-sensitive file-system where also a Linux build-environment 397 # is active. The Linux build-environment is will not find the lowercase files. 324 398 # For example, a clean from Linux will not work properly in that case. 325 399 # This does not influence building DOS targets on Linux. 400 # It can be circumvented by using a case-insensitive file-system for the 401 # network share, like OS/2 JFS for instance. 402 # Linux can use OS/2 JFS and will recognize it's case insensitivity. 403 # Or you could loop-mount the samba share either with the usual cifs tools 404 # or fuse-smb. 326 405 # 327 406 … … 332 411 # - Very limited memory 333 412 # - JWasmR does not work because of memory limitations 334 # - JWasmD does not work at all413 # - JWasmD needs special OS/2 VDM settings 335 414 # - Batch scripting is very rudimentairy 336 415 # … … 340 419 # on OS/2, Windows or Linux. 341 420 # 342 343 421 344 422 … … 366 444 367 445 368 # 369 # MAIN TARGETS 370 # 371 372 373 ############################################################################### 374 # 16-bits RAW :: Final image that can be executed when activated by the BIOS. 375 ############################################################################### 446 # MAIN TARGETS 447 # _____________________________________________________________________________ 448 449 450 # ----------------------------------------------------------------------------- 451 # FINAL AIRBOOT.BIN IMAGE 452 # ----------------------------------------------------------------------------- 453 # This is the final AiR-BOOT image and has been built for the language 454 # requested. It can be installed on a system using the AiR-BOOT Installer. 455 # Note that this build-rule will be invoked multiple times if more than 456 # one language-build is requested. 457 # Also, the intermediate .COM and final .BIN targets are disassembled back 458 # with NDISASM for cross reference. 459 # ----------------------------------------------------------------------------- 376 460 $(TARGET): .MULTIPLE Makefile.bu $(BASENAME).COM 377 # $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys dos com 461 @echo $^.: [Final 16-bits raw Binary Image] 462 !ifdef __MSDOS__ 463 ..$(DS)TOOLS$(DS)INTERNAL$(DS)FIXCODED.EXE 464 !endif 378 465 !ifdef __OS2__ 379 ..$(DS)TOOLS$(DS)INTERNAL$(DS)FIXCODE.COM 466 ..$(DS)TOOLS$(DS)INTERNAL$(DS)FIXCODE2.EXE 467 !endif 468 !ifdef __NT__ 469 ..$(DS)TOOLS$(DS)INTERNAL$(DS)FIXCODEW.EXE 380 470 !endif 381 471 !ifdef __LINUX__ 382 ..$(DS)TOOLS$(DS)INTERNAL$(DS)FIXCODE 383 !endif 384 # @echo FIXCODE 385 $(CP) $(BASENAME).COM $(TARGET) 472 # ..$(DS)TOOLS$(DS)INTERNAL$(DS)FIXCODE 473 @chmod +x ..$(DS)TOOLS$(DS)INTERNAL$(DS)FIXCODEL.ELF 474 ..$(DS)TOOLS$(DS)INTERNAL$(DS)FIXCODEL.ELF 475 @chmod +x $^. 476 !endif 477 @echo. 478 !ifndef __MSDOS__ 386 479 ndisasm $(BASENAME).COM > $(BASENAME).COM.NDA 387 480 ndisasm $(TARGET) > $(TARGET).NDA 388 # @echo $(%BLD_LANG)>$^. 389 @if exist $^. @echo $^. $(MSG_SUCCESS) - [$(%BLD_LANG) version] 390 # $(RM) $(TARGET) 391 # @echo. 392 393 394 395 ############################################################################### 396 # 16-bits COM :: Intermediate image without embedded MBR-prot. and code count. 397 ############################################################################### 481 !endif 482 @echo. 483 @if exist $^. @echo ** $^. $(MSG_SUCCESS) - [$(%BLD_LANG) version] ** 484 485 486 # ----------------------------------------------------------------------------- 487 # INTERMEDIATE AIR-BOOT.COM IMAGE 488 # ----------------------------------------------------------------------------- 489 # This is an intermediate image without embedded MBR-protection and code count. 490 # It needs to be post-processed with FIXBOOT. 491 # 398 492 # While both DOS COM and RAW linkage generate a flat 16-bits image with 399 493 # fixed-up locations, DOS COM checks that the addressibility of the image does 400 494 # not exceed the upper 64kB limit while RAW just wraps it's fixups. 401 # So we use DOS COM linkage to proteced us from overflows in the BSS segment. 495 # So we use DOS COM linkage to proteced us from overflow incorrect fixups. 496 # ----------------------------------------------------------------------------- 402 497 $(BASENAME).COM: .MULTIPLE $(BASENAME).OBJ 498 @echo $^.: [16-bits non-100h Intermediate Image] 403 499 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys dos com 404 500 # $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. form raw 405 # @if exist $^. @echo $^. $(MSG_SUCCESS) 406 # @echo. 407 408 # 409 # Assembled Object File 410 # 501 502 503 # ----------------------------------------------------------------------------- 504 # INTERMEDIATE AIR-BOOT.OBJ OBJECT MODULE 505 # ----------------------------------------------------------------------------- 506 # This is the result of assembling AIR-BOOT.ASM. 507 # It is assembled back twice with WDIS for cross reference. 508 # - once as an (almost) assemblable source-file 509 # - once as a disassembly with opcodes in it 510 # ----------------------------------------------------------------------------- 411 511 $(BASENAME).OBJ: .MULTIPLE $(BASENAME).ASM 412 # @echo. 413 @echo TARGET: $^. [DOS 16-bits Raw Image] 512 @echo $^.: [16-bits OMF Object File] 414 513 $(ASM) $(ASM_FLAGS) $(BASENAME).ASM 415 @wdis $^. > $^&.WDA 416 417 418 419 # 420 # MAIN ACTIONS 421 # 422 423 424 # 425 # Rebuild all targets. 426 # 514 !ifndef __MSDOS__ 515 @wdis -a -p -fi $^. > $^&.WDA 516 !endif 517 @wdis -fi $^. > $^..WDA 518 519 520 521 # MAIN ACTIONS 522 # _____________________________________________________________________________ 523 524 525 # ----------------------------------------------------------------------------- 526 # DEVELOPER TARGET 527 # ----------------------------------------------------------------------------- 528 # This meta-target builds an AIRBOOT.BIN module using the DEV_BLD_LANG setting. 529 # It does not change the file-name to correspond to the language, 530 # so it can directly be used by the installer. 531 # This is the main target when developing. 532 # ----------------------------------------------------------------------------- 533 dev: .SYMBOLIC 534 @%MAKE rmbin 535 @%MAKE mbrprot 536 SET AB_DEV=TRUE 537 # @%MAKE $(DEV_BLD_LANG) 538 # We need to recurse here because the environment is used to pass AB_DEV and 539 # the testing on it does not seem to work when using @%MAKE syntax. (bug ?) 540 # We also don't want .MULTIPLE which we won't get if we build just one target. 541 @$(MAKE) $(DEV_BLD_LANG) 542 # Display the BLDLEVEL information if we are building on OS/2. 543 !ifdef __OS2__ 544 @echo. 545 @bldlevel $(TARGET) 546 !endif 547 548 # ----------------------------------------------------------------------------- 549 # REBUILD ALL TARGETS 550 # ----------------------------------------------------------------------------- 427 551 rebuild: .SYMBOLIC 428 552 @%MAKE clean 429 553 @%MAKE all 430 554 431 # 432 # Remove all generated files. 433 # 555 556 # ----------------------------------------------------------------------------- 557 # CLEANUP (intermediate files) 558 # ----------------------------------------------------------------------------- 434 559 clean: .SYMBOLIC .MULTIPLE 435 560 # @echo CLEANING UP 436 561 @for %%i in ($(TARGET)) do @if exist %%i $(RM) %%i 437 562 @if exist *.COM $(RM) *.COM 563 @if exist *.COM $(RM) *.EXE 438 564 @if exist *.OBJ $(RM) *.OBJ 439 565 @if exist *.WDA $(RM) *.WDA 566 @if exist *.NDA $(RM) *.NDA 440 567 @if exist *.MAP $(RM) *.MAP 441 568 @if exist *.LST $(RM) *.LST … … 443 570 @if exist *.o $(RM) *.o 444 571 445 # 446 # Remove all residual .BIN files. 447 # 572 573 # ----------------------------------------------------------------------------- 574 # REMOVE ALL RESIDUAL .BIN FILES (old builds) 575 # ----------------------------------------------------------------------------- 448 576 rmbin: .SYMBOLIC 449 577 @if exist *.BIN $(RM) *.BIN 450 578 451 # 452 # This meta-target build a module using the DEV_BLD_LANG setting. 453 # It does not change the file-name so it can directly be used by the 454 # installer. 455 # 456 dev: .SYMBOLIC 457 #eee 458 @%MAKE rmbin 459 @%MAKE mbrprot 460 SET AB_DEV=TRUE 461 # @%MAKE $(DEV_BLD_LANG) 462 # We need to recurse here because the environment is used to pass AB_DEV. 463 # We also don't want .MULTIPLE which we won't get if we build just one target. 464 @$(MAKE) $(DEV_BLD_LANG) 465 579 580 # ----------------------------------------------------------------------------- 581 # DISTRIBUTE TO RELEASE SPACE 582 # ----------------------------------------------------------------------------- 583 # This distributes all .BIN files to BOOTCODE. 584 # Then it installs the English version to RELEASES as AIRBOOT.BIN. 585 # ----------------------------------------------------------------------------- 466 586 dist: .SYMBOLIC 467 $(CP) $(TARGET) ..$(DS)RELEASE$(DS)DOS 468 469 # 470 # Help on using this Makefile. 471 # 587 @if exist *.BIN $(CP) *.BIN ..$(DS)RELEASE$(DS)BOOTCODE 588 @if exist AIRBT-EN.BIN $(CP) AIRBT-EN.BIN ..$(DS)RELEASE$(DS)DOS$(DS)$(TARGET) 589 @if exist AIRBT-EN.BIN $(CP) AIRBT-EN.BIN ..$(DS)RELEASE$(DS)WINNT$(DS)$(TARGET) 590 @if exist AIRBT-EN.BIN $(CP) AIRBT-EN.BIN ..$(DS)RELEASE$(DS)OS2$(DS)$(TARGET) 591 @if exist AIRBT-EN.BIN $(CP) AIRBT-EN.BIN ..$(DS)RELEASE$(DS)LINUX$(DS)$(TARGET) 592 593 594 # ----------------------------------------------------------------------------- 595 # SHOW HELP ON USING THIS MAKEFILE 596 # ----------------------------------------------------------------------------- 472 597 help: .SYMBOLIC 473 598 @echo. … … 484 609 @echo. 485 610 486 # 487 # Show the list of buildable targets. 488 # 611 612 # ----------------------------------------------------------------------------- 613 # SHOW LIST OF BUILDABLE TARGETS 614 # ----------------------------------------------------------------------------- 489 615 show: .SYMBOLIC 490 616 @echo. … … 496 622 @%MAKE show 497 623 498 # 499 # Inform user that a rebuild might help if the build process fails. 500 # 624 625 # ----------------------------------------------------------------------------- 626 # HINT USER WHEN A BUILD FAILS 627 # ----------------------------------------------------------------------------- 501 628 .ERROR 502 629 @echo. 503 630 @echo Oops! 504 631 @echo Some error occured in this build session. 505 @echo If it's a linker problem, it could be 506 @echo the result of out-of-sync object files. 507 @echo Doing a wmake rebuild might solve the problem. 508 @echo Type wmake help for a list of actions. 632 @echo If you see stuff about "positive count" 633 @echo you have a section overlap. 634 @echo Check the z_* values at the end of the list-file 635 @echo and look for a negative gap. 636 @echo Type 'wmake help' in the target dir for a list of actions. 509 637 # @%MAKE help 510 638 @echo. 511 639 512 # 513 # How the hell can we use get more than one command in the for-loop ?? 514 # 640 641 # ----------------------------------------------------------------------------- 642 # How the hell can we use more than one command in the for-loop ?? 643 # ----------------------------------------------------------------------------- 515 644 ttt: .SYMBOLIC 645 # This does not work... 516 646 # @for %%i in ($(BLD_LANGUAGES)) do %%i=X; $%WMAKE; -
trunk/BOOTCODE/REGULAR/AUXIO.ASM
r45 r46 71 71 72 72 73 ; 74 ; Send the Build Information to the COM-port. 75 ; 76 AuxIO_PrintBuildInfo Proc Near Uses ax cx si di 77 ; Print header. 78 mov si, offset build_info 79 call AuxIO_Print 80 81 ; Prepare info in temorary buffer. 82 mov si,offset bld_level_date_start 83 mov cx,offset bld_level_date_end 84 sub cx,si 85 mov di,offset Scratch 86 cld 87 rep movsb 88 89 ; Fill spaces until assembler specification. 90 mov al,' ' 91 mov cx,37 92 rep stosb 93 94 ; Copy assembler specification. 95 IFDEF JWASM 96 mov al,'[' 97 stosb 98 mov si,offset jwasm_txt 99 ENDIF 100 IFDEF TASM 101 mov al,' ' 102 stosb 103 mov al,'[' 104 stosb 105 mov si,offset tasm_txt 106 ENDIF 107 IFDEF WASM 108 mov al,' ' 109 stosb 110 mov al,'[' 111 stosb 112 mov si,offset wasm_txt 113 ENDIF 114 IFDEF MASM 115 mov al,' ' 116 stosb 117 mov al,'[' 118 stosb 119 mov si,offset masm_txt 120 ELSE 121 mov al,' ' 122 stosb 123 mov al,'[' 124 stosb 125 mov si,offset unknown_txt 126 ENDIF 127 AuxIO_PrintBuildInfo_a1: 128 lodsb 129 test al,al 130 jz AuxIO_PrintBuildInfo_e1 131 stosb 132 jmp AuxIO_PrintBuildInfo_a1 133 AuxIO_PrintBuildInfo_e1: 134 mov al,']' 135 stosb 136 137 ; Insert NULL Terminator. 138 xor al,al 139 stosb 140 141 ; Print Info. 142 mov si, offset Scratch 143 call AuxIO_Print 144 call AuxIO_TeletypeNL 145 ret 146 AuxIO_PrintBuildInfo EndP 147 73 148 74 149 ; Print char to com-port (teletype style) -
trunk/BOOTCODE/REGULAR/BOOTMENU.ASM
r45 r46 66 66 67 67 mov dl, 18h 68 cmp CFG_BootMenuActive, 268 cmp byte ptr [CFG_BootMenuActive], 2 69 69 jne BMBM_NoDetailed1 70 70 mov dl, 15h … … 89 89 mov si, offset TXT_TopInfos_Hd 90 90 add cl, 5 91 cmp CFG_BootMenuActive, 291 cmp byte ptr [CFG_BootMenuActive], 2 92 92 jne BMBM_NoDetailed2 93 93 mov si, offset TXT_TopInfos_HdSize … … 121 121 push cx 122 122 add dl, 5 123 cmp CFG_BootMenuActive, 2123 cmp byte ptr [CFG_BootMenuActive], 2 124 124 jne BMBM_NoDetailed3 125 125 add dl, 8 … … 159 159 jb BMBM_3rdTweak 160 160 add cl, 5 161 cmp CFG_BootMenuActive, 2161 cmp byte ptr [CFG_BootMenuActive], 2 162 162 jne BMBM_BootWinTweakLoop 163 163 add cl, 8 … … 446 446 call VideoIO_PrintByteNumber ; so only showing harddrives... 447 447 add dh, 5 448 cmp CFG_BootMenuActive, 2448 cmp byte ptr [CFG_BootMenuActive], 2 449 449 jne BMBPT_NoDetailed 450 450 add dh, 8 … … 548 548 jae BMBCB_NoScrollUp 549 549 BMBCB_ScrollingUp: 550 dec Menu_UpperPart550 dec byte ptr [Menu_UpperPart] ; Adjusted for Wasm 551 551 cmp dh, Menu_UpperPart 552 552 jb BMBCB_ScrollingUp … … 560 560 BMBCB_ScrollingDown: 561 561 inc cl 562 inc Menu_UpperPart562 inc byte ptr [Menu_UpperPart] ; Adjusted for Wasm 563 563 cmp dh, cl 564 564 jae BMBCB_ScrollingDown … … 696 696 ; restlichen Variablen berechnen... 697 697 mov dl, Menu_TotalParts 698 cmp Menu_TotalParts, 14698 cmp byte ptr [Menu_TotalParts], 14 699 699 jbe BMRMV_NotMoreThan14 700 700 mov dl, 14 … … 704 704 ; Now copy the name of the Timed-Booted Partition to TimedBoot-Field 705 705 mov dl, Menu_EntryDefault 706 test CFG_TimedBootLast, 1706 test byte ptr [CFG_TimedBootLast], 1 707 707 jz BMRMV_TimedBootDefault 708 708 mov dl, Menu_EntryLast … … 726 726 ; No Straight View in here...we got filtered view since BootMenu-Startup... 727 727 mov al, CFG_RememberTimed 728 test TimedBootUsed, 1728 test byte ptr [TimedBootUsed], 1 729 729 jnz BMSVAM_TimedBootUsed 730 730 mov al, CFG_RememberBoot … … 762 762 ; Finds out, where to place the bar at first... 763 763 mov dl, Menu_EntryDefault 764 test CFG_RememberBoot, 1764 test byte ptr [CFG_RememberBoot], 1 765 765 jnz BME_RememberMode 766 test CFG_RememberTimed, 1766 test byte ptr [CFG_RememberTimed], 1 767 767 jz BME_ForgetMode 768 768 BME_RememberMode: … … 785 785 ;call VideoIO_DBG_WriteString2 ; Rousseau 786 786 787 test TimedBootEnable, 1787 test byte ptr [TimedBootEnable], 1 788 788 jz BME_NoTimedBoot 789 789 ; ------------------------------------------------ TIMED BOOT … … 805 805 pop ax 806 806 mov dl, Menu_EntryDefault 807 and CFG_TimedBootLast, 1807 and byte ptr [CFG_TimedBootLast], 1 808 808 jz BME_TimedBootDefault 809 809 mov dl, Menu_EntryLast 810 810 BME_TimedBootDefault: 811 811 mov Menu_EntrySelected, dl ; Just boot default partition 812 mov TimedBootUsed, 1 ; set flag...812 mov byte ptr [TimedBootUsed], 1 ; set flag... 813 813 clc ; Boot-Now! 814 814 ret … … 819 819 BME_NoTimedBoot: 820 820 ; ------------------------------------------------ FLOPPY-NAME TIMER 821 test CFG_FloppyBootGetTimer, 1821 test byte ptr [CFG_FloppyBootGetTimer], 1 822 822 jz BME_NoFloppyNameTimer 823 823 ; Wait 2 Seconds everytime … … 847 847 848 848 BME_RefreshFloppyName: 849 test CFG_IncludeFloppy, 1849 test byte ptr [CFG_IncludeFloppy], 1 850 850 jz BME_NoRefreshFloppyName 851 test CFG_FloppyBootGetName, 1851 test byte ptr [CFG_FloppyBootGetName], 1 852 852 jz BME_NoRefreshFloppyName 853 853 call DriveIO_UpdateFloppyName … … 871 871 je BME_KeyESC 872 872 ; Upper Keys do not fall under Timed Boot Key Handling 873 test TimedBootEnable, 1873 test byte ptr [TimedBootEnable], 1 874 874 je BME_NoTimedKeyHandling 875 cmp CFG_TimedKeyHandling, 1875 cmp byte ptr [CFG_TimedKeyHandling], 1 876 876 jb BME_NoTimedKeyHandling ; = 0 877 877 je BME_ResetTimedBoot ; = 1 878 878 mov al, TimedBootEnable ; = 2 879 879 xor al, 1 ; Flip Flop Switch :] 880 mov TimedBootEnable, al880 mov [TimedBootEnable], al 881 881 BME_ResetTimedBoot: 882 882 push dx … … 905 905 BME_KeyEnter: 906 906 mov Menu_EntrySelected, dl 907 mov TimedBootUsed, 0 ; reset flag...907 mov byte ptr [TimedBootUsed], 0 ; reset flag... 908 908 clc ; Boot-Now! 909 909 ret … … 911 911 BME_KeyF10: 912 912 mov al, Keys_Flags_EnterSetup 913 mov SETUP_KeysOnEntry, al ; Simulate user wants to enter setup913 mov byte ptr [SETUP_KeysOnEntry], al ; Simulate user wants to enter setup 914 914 stc ; Go Re-Enter Setup 915 915 ret … … 921 921 922 922 BME_KeyESC: 923 mov al, TimedBootEnable923 mov al, [TimedBootEnable] 924 924 xor al, 1 ; Flip Flop Switch :] 925 mov TimedBootEnable, al925 mov [TimedBootEnable], al 926 926 push dx 927 927 call BOOTMENU_ResetTimedBoot ; Reset Timer … … 932 932 BME_KeyTAB: 933 933 push dx 934 test CFG_CooperBars, 1934 test byte ptr [CFG_CooperBars], 1 935 935 jnz BME_KeyTAB_ShowFX 936 936 mov ax, 0501h ; Go To Page 1 -> BIOS POST crap … … 969 969 add ax, CFG_TimedDelay 970 970 adc dx, 0 971 mov w ptr [TimedTimeOut], ax972 mov w ptr [TimedTimeOut+2], dx971 mov word ptr [TimedTimeOut], ax 972 mov word ptr [TimedTimeOut+2], dx 973 973 ret 974 974 BOOTMENU_ResetTimedBoot EndP -
trunk/BOOTCODE/REGULAR/CONV.ASM
r44 r46 209 209 mov cl,ah ; Get remainder in CL. 210 210 sub cl,dh ; Substract bitfield width to get shift-count. 211 mov ah,0 ; Prepare upper=0 when field snaps no byte bound. 211 mov ah,0 ; Prepare upper=0 when field spans no byte bound. 212 ; Don't change to xor ah,ah or any CY will be lost. 212 213 213 214 ; Jump if the bitfield does not span byte boundaries. … … 219 220 add cl,8 ; Adjust shift-count. 220 221 mov ah,[bx] ; Get byte into AH instead. 221 dec bx ; Prepare pointer to load rest of bitfield. 222 dec bx ; Adjust pointer to load rest of bitfield. 223 222 224 CONV_GetBitfieldValue_nospan: 223 225 mov al,[bx] ; Load (rest of) bitfield into AL. … … 267 269 sub cl,dh ; Substract bitfield width to get shift-count. 268 270 269 ; Restore value .271 ; Restore value to poke. 270 272 pop ax 271 273 … … 282 284 push cx ; Save mask (CH) and shift-count (CL). 283 285 push ax ; Save value to store. 284 mov ah,0; Clear upper byte so we can shift in it.286 xor ah,ah ; Clear upper byte so we can shift in it. 285 287 and al,ch ; Mask value. 286 288 shl ax,cl ; Move the bitfield to the proper location. … … 289 291 mov dl,[bx] ; Get 2nd part of bitfield from array. 290 292 push bx ; We need BX so save it. 291 mov bh,0; Clear upper byte so we can shift in it.293 xor bh,bh ; Clear upper byte so we can shift in it. 292 294 mov bl,ch ; Put mask in BL. 293 295 shl bx,cl ; Shift mask to proper location. … … 304 306 ; Done. 305 307 jmp CONV_SetBitfieldValue_end 306 307 308 308 309 CONV_SetBitfieldValue_nospan: -
trunk/BOOTCODE/REGULAR/DEBUG.ASM
r45 r46 175 175 call AuxIO_Print 176 176 177 ; Build Date 178 mov si, offset BUILD_DATE 179 call AuxIO_Print 177 ; Build Info 178 ;~ mov si, offset BUILD_DATE 179 ;~ call AuxIO_Print 180 call AuxIO_PrintBuildInfo 180 181 181 182 ; Start new line -
trunk/BOOTCODE/REGULAR/DRIVEIO.ASM
r43 r46 311 311 312 312 ;or bx,ax 313 test [ExtendedAbsPosSet],1313 test byte ptr [ExtendedAbsPosSet],1 314 314 jz pri 315 315 … … 561 561 ; Keeps DS:SI for caller, sets carry if valid LVM sector encountered 562 562 DriveIO_LoadLVMSector Proc Near Uses ax bx cx dx 563 test [CFG_IgnoreLVM], 1 ; We are supposed to ignore LVM, so563 test byte ptr [CFG_IgnoreLVM], 1 ; We are supposed to ignore LVM, so 564 564 jnz DIOLLVMS_NoLVMSector ; don't load but declare as bad! 565 565 mov ax, wptr cs:[CurPartition_Location+0] … … 605 605 ; Keeps DS:SI for caller, saves at anytime w/o checks (!) 606 606 DriveIO_SaveLVMSector Proc Near Uses ax bx cx dx 607 test [CFG_IgnoreLVM], 1 ; We are supposed to ignore LVM, so607 test byte ptr [CFG_IgnoreLVM], 1 ; We are supposed to ignore LVM, so 608 608 jnz DIOSLVMS_SevereError ; don't save at anytime (security!) 609 609 mov ax, wptr cs:[CurPartition_Location+0] … … 633 633 ; so users will notice that something is bad with their partition table(s) 634 634 DriveIO_GotLoadError Proc Near 635 test cs:CurIO_Scanning, 1 ; Must be CS:, cause DS!=CS maybe here635 test byte ptr cs:[CurIO_Scanning], 1 ; Must be CS:, cause DS!=CS maybe here 636 636 jnz InScanMode 637 637 jmp MBR_LoadError … … 671 671 jb DIOLS_UseNormal 672 672 673 test cs:[CurIO_UseExtension], 1673 test byte ptr cs:[CurIO_UseExtension], 1 674 674 jz DIOLS_UseNormal 675 675 ; Are we forced do use LBA via Setting? … … 794 794 ; ######################################################################### 795 795 DriveIO_SaveSector Proc Near Uses ax bx cx ds si es di 796 test cs:[CurIO_UseExtension], 1796 test byte ptr cs:[CurIO_UseExtension], 1 797 797 jz DIOSS_UseNormal 798 798 ; Are we forced do use LBA via Setting? 799 test cs:[CFG_ForceLBAUsage], 1799 test byte ptr cs:[CFG_ForceLBAUsage], 1 800 800 jnz DIOSS_UseExtension 801 801 ; Is the drive not a harddrive? … … 1230 1230 pop bx 1231 1231 1232 mov [CurIO_UseExtension],11232 mov byte ptr [CurIO_UseExtension],1 1233 1233 1234 1234 popf -
trunk/BOOTCODE/REGULAR/OTHER.ASM
r43 r46 93 93 rep stosw 94 94 95 mov VideoIO_Segment, VideoIO_Page095 mov word ptr [VideoIO_Segment], VideoIO_Page0 96 96 97 97 ; Don't use blinking attribute … … 106 106 107 107 ; Cursor to upper-left 108 mov TextPosX, 0109 mov TextPosY, 0108 mov byte ptr [TextPosX], 0 109 mov byte ptr [TextPosY], 0 110 110 call VideoIO_CursorSet 111 111 … … 122 122 ;call SOUND_Beep 123 123 124 ; Build Date 125 mov si, offset BUILD_DATE 126 call MBR_TeletypeNL 124 ; Show build info 125 call VideoIO_PrintBuildInfo 127 126 128 127 IFDEF AUX_DEBUG … … 305 304 ; Checks for MBR Virii :) I love that job 306 305 ; ======================================= 307 test CFG_DetectStealth, 1306 test byte ptr [CFG_DetectStealth], 1 308 307 jz PCM_NoStealthDetection 309 308 call VIRUS_CheckForStealth 310 309 PCM_NoStealthDetection: 311 test CFG_DetectVirus, 1310 test byte ptr [CFG_DetectVirus], 1 312 311 jz PCM_NoVirusDetection 313 312 call VIRUS_CheckForVirus … … 318 317 ; Delay for some time and get Strg/Alt State 319 318 ; ============================================ 320 test CFG_CooperBars, 1319 test byte ptr [CFG_CooperBars], 1 321 320 jnz PCM_ShortDelay 322 321 mov al, 27 ; About 1.5 seconds 323 test CFG_FloppyBootGetName, 1322 test byte ptr [CFG_FloppyBootGetName], 1 324 323 jz PCM_LongDelay 325 324 PCM_ShortDelay: … … 345 344 mov ah, 02h 346 345 int 16h 347 mov SETUP_KeysOnEntry, al346 mov [SETUP_KeysOnEntry], al 348 347 349 348 ; Copy device-name to the ContBIOSbootSeq-IPT entry … … 358 357 ; Now get volume label of FloppyDrive, if wanted... 359 358 ; =================================================== 360 test CFG_FloppyBootGetName, 1359 test byte ptr [CFG_FloppyBootGetName], 1 361 360 jz ACM_NoFloppyGetName 362 361 call DriveIO_UpdateFloppyName … … 381 380 and cx, 1 382 381 jz PCCF13E_NotFound 383 mov CurIO_UseExtension, 1382 mov byte ptr [CurIO_UseExtension], 1 384 383 ret 385 384 PRECRAP_CheckFor13extensions EndP … … 406 405 mov cx,5 407 406 408 mov dx, CFG_CheckConfig409 mov CFG_CheckConfig, bx407 mov dx, [CFG_CheckConfig] 408 mov [CFG_CheckConfig], bx 410 409 PCCC_Loop: 411 410 call MBR_GetCheckOfSector … … 495 494 mov bh, 0 496 495 mov ah, 02h 497 mov dh, [TextPosY]498 mov dl, [TextPosX]496 mov dh,byte ptr [TextPosY] 497 mov dl,byte ptr [TextPosX] 499 498 int 10h 500 499 popf -
trunk/BOOTCODE/REGULAR/PARTMAIN.ASM
r45 r46 81 81 cmp dl, 0FEh ; Resume-BIOS? 82 82 ja PFUPN_SpecialSelectionFloppy 83 cmp CFG_ResumeBIOSbootSeq, 083 cmp byte ptr [CFG_ResumeBIOSbootSeq], 0 84 84 je PFUPN_SelectionGone 85 85 jmp PFUPN_Found 86 86 PFUPN_SpecialSelectionFloppy: 87 cmp CFG_IncludeFloppy, 087 cmp byte ptr [CFG_IncludeFloppy], 0 88 88 je PFUPN_SelectionGone 89 89 jmp PFUPN_Found … … 192 192 mov si, offset PartitionTable 193 193 mov bx, offset PartitionPointers 194 test CFG_IncludeFloppy, 1194 test byte ptr [CFG_IncludeFloppy], 1 195 195 jz PCMPP_NoFloppyInclude 196 196 mov ax, offset FloppyIPTentry … … 199 199 PCMPP_NoFloppyInclude: 200 200 201 test CFG_ResumeBIOSbootSeq, 0FFh201 test byte ptr [CFG_ResumeBIOSbootSeq], 0FFh 202 202 jz PCMPP_NoResumeBootSeqInclude 203 203 mov ax, offset BIOScontIPTentry … … 920 920 ; BX:AX -> Absolute End-Position of Partition 921 921 922 test CFG_ForceLBAUsage, 1922 test byte ptr [CFG_ForceLBAUsage], 1 923 923 jnz PSP_ForceI13X 924 924 ; LBA-boundary at 16450560 (FB0400h) (16320x16x63) … … 942 942 ; Insert signature 943 943 xor di, di 944 mov w ptr es:[di+00], '1I'945 mov w ptr es:[di+02], 'X3'944 mov word ptr es:[di+00], '1I' 945 mov word ptr es:[di+02], 'X3' 946 946 947 947 ;mov wptr es:[di], 0 … … 949 949 950 950 ; Insert LBA address. 951 mov ax, wptr[si+LocIPT_AbsoluteBegin+0]952 mov wptres:[di+04], ax953 mov ax, wptr[si+LocIPT_AbsoluteBegin+2]954 mov wptres:[di+06], ax951 mov ax, [si+LocIPT_AbsoluteBegin+0] 952 mov es:[di+04], ax 953 mov ax, [si+LocIPT_AbsoluteBegin+2] 954 mov es:[di+06], ax 955 955 956 956 pop si … … 1030 1030 PSP_NoHideFeature: 1031 1031 ; Check, if we are supposed to ignore LVM altogether... 1032 test [CFG_IgnoreLVM], 11032 test byte ptr [CFG_IgnoreLVM], 1 1033 1033 jnz PSP_NoLVMReassignment 1034 1034 ; --------------------------------------------------------- LVM REASSIGNMENT … … 1056 1056 call MSHACK_ProcessPartTables 1057 1057 1058 test CFG_BootMenuActive, 0FFh1058 test byte ptr [CFG_BootMenuActive], 0FFh 1059 1059 jz PSP_NoMenuNoSound 1060 1060 … … 1065 1065 ; -------------------------------------------------- SPECIAL BOOT PROCESSING 1066 1066 ; Check here, if the Boot shall be done via resume to BIOS... 1067 mov al, b ptr [si+LocIPT_SystemID]1067 mov al, byte ptr [si+LocIPT_SystemID] 1068 1068 cmp al, 0FEh ; Via BIOS ? (aka resume BIOS boot sequence) 1069 1069 je PSP_ResumeBIOSbootSeq … … 1141 1141 is_harddisk: 1142 1142 1143 test CFG_DetectVIBR, 11143 test byte ptr [CFG_DetectVIBR], 1 1144 1144 jz PSP_NoVIBR 1145 1145 test byte ptr [si+LocIPT_Flags], Flags_VIBR_Detection … … 1166 1166 1167 1167 PSP_NoVIBR: 1168 test CFG_ProtectMBR, 11168 test byte ptr [CFG_ProtectMBR], 1 1169 1169 jz PSP_NoMBRprotect 1170 1170 ; -------------------------------------------------- INSTALLS MBR-PROTECTION -
trunk/BOOTCODE/REGULAR/PARTSCAN.ASM
r45 r46 36 36 mov NewPartitions, al 37 37 38 mov CurIO_Scanning, 1 ; Set flag due scanning partitions38 mov byte ptr [CurIO_Scanning], 1 ; Set flag due scanning partitions 39 39 mov dl, 80h ; is first harddisc 40 40 PSSFP_HarddiscLoop: … … 46 46 dec dh 47 47 jnz PSSFP_HarddiscLoop 48 mov CurIO_Scanning, 0 ; Reset flag due scanning complete48 mov byte ptr [CurIO_Scanning], 0 ; Reset flag due scanning complete 49 49 50 50 IFDEF AUX_DEBUG … … 124 124 inc di 125 125 loop PSSFP_AutoDrvLetterLoop 126 mov AutoDrvLetter, 0 ; Disable after processing...126 mov byte ptr [AutoDrvLetter], 0 ; Disable after processing... 127 127 PSSFP_NoAutoDriveLetter: 128 128 ret … … 176 176 add ax, wptr [ExtendedAbsPos+0] ; Adjust... 177 177 adc bx, wptr [ExtendedAbsPos+2] ; (Shit Design!) 178 test [ExtendedAbsPosSet], 1178 test byte ptr [ExtendedAbsPosSet], 1 179 179 jnz PSSPFE_ExtendedMainKnown 180 180 mov wptr [ExtendedAbsPos+0], ax 181 181 mov wptr [ExtendedAbsPos+2], bx 182 mov [ExtendedAbsPosSet], 1182 mov byte ptr [ExtendedAbsPosSet], 1 183 183 PSSPFE_ExtendedMainKnown: 184 184 mov cx, wptr [si+LocBRPT_BeginSector] ; Cylinder/Sector … … 212 212 ; Stop scanning if too many partitions. 213 213 ; 214 cmp word ptr [cs:NewPartitions],LocIPT_MaxPartitions214 cmp word ptr cs:[NewPartitions],LocIPT_MaxPartitions 215 215 jae skip_check 216 216 call PARTSCAN_CheckThisPartition … … 219 219 ; Cannot boot LVM-Data partitions 220 220 pusha 221 mov byte ptr [cs:TooManyPartitions],1221 mov byte ptr cs:[TooManyPartitions],1 222 222 mov cx, 0C04h 223 223 ;~ mov si, offset TXT_ERROR_TooManyPartitions … … 630 630 mov al, PartTypeFlags 631 631 ; May I auto-add partitions ? 632 test CFG_PartitionsDetect, 1632 test byte ptr [CFG_PartitionsDetect], 1 633 633 jz PCCTP_MayNotAddAny ; add, but non-bootable 634 634 test al, FileSysFlags_BootAble ; AH kam von SearchFileSysName … … 710 710 mov ax, dx 711 711 stosw 712 inc NewPartitions; NEW IPT Entry DONE713 714 cmp NewPartitions, LocIPT_MaxPartitions712 inc byte ptr [NewPartitions]; Adjusted for Wasm ; NEW IPT Entry DONE 713 714 cmp byte ptr [NewPartitions], LocIPT_MaxPartitions 715 715 jbe PCCTP_NotTooManyPartitions 716 716 -
trunk/BOOTCODE/REGULAR/PASSWORD.ASM
r40 r46 31 31 PASSWORD_AskSystemPwd Proc Near Uses ax bx si di 32 32 ; Asks System Password, if set... 33 test CFG_PasswordSystem, 133 test byte ptr [CFG_PasswordSystem], 1 34 34 jz PASP_NoPassword 35 35 mov ax, 0ABABh … … 43 43 PASSWORD_AskChangeBootPwd Proc Near Uses ax bx si di 44 44 ; Asks System Password, if set... 45 test CFG_PasswordChangeBoot, 145 test byte ptr [CFG_PasswordChangeBoot], 1 46 46 jz PACBP_NoPassword 47 test TimedBootUsed, 147 test byte ptr [TimedBootUsed], 1 48 48 jnz PACBP_NoPassword 49 49 mov ax, 0ABABh … … 70 70 PASSWORD_AskSpecifiedPassword Proc Near Uses cx dx ds si es di bp 71 71 local AskPasswordMiss:byte, AskPasswordText:word, AskPasswordMagic:word, AskPasswordWhich:word 72 mov AskPasswordMagic, ax73 mov AskPasswordText, si74 mov AskPasswordWhich, di72 mov [AskPasswordMagic], ax 73 mov [AskPasswordText], si 74 mov [AskPasswordWhich], di 75 75 mov ax, cs 76 76 mov ds, ax … … 80 80 mov cx, 8 81 81 rep stosb ; Generates empty password 82 mov AskPasswordMiss, 083 mov ax, AskPasswordWhich82 mov byte ptr [AskPasswordMiss], 0 83 mov ax, [AskPasswordWhich] 84 84 or ax, ax 85 85 jnz PASP_BadBoyRetry ; Only check one … … 106 106 107 107 ; ...and compare it to the specified on-board one 108 mov di, AskPasswordWhich108 mov di, [AskPasswordWhich] 109 109 or di, di 110 110 jnz PASP_OnlyCheckSpecified … … 122 122 123 123 PASP_LetUserGuessPassword: ; ;-))) 124 mov ax, AskPasswordMagic125 mov si, AskPasswordText124 mov ax, [AskPasswordMagic] 125 mov si, [AskPasswordText] 126 126 mov di, offset TempPasswordEntry 127 127 call SETUP_LetEnterPassword 128 inc AskPasswordMiss129 cmp AskPasswordMiss, 10128 inc byte ptr [AskPasswordMiss] 129 cmp byte ptr [AskPasswordMiss], 10 130 130 jae PASP_BadBoyAlert 131 131 jmp PASP_BadBoyRetry -
trunk/BOOTCODE/REGULAR/STD_TEXT.ASM
r45 r46 25 25 26 26 ; If you modify this Copyright and release this under your own name, 27 ; 27 ; I'm going to sue your cheap ass, rape your dog and blow up your house. =) 28 28 29 29 CopyrightVersionLen equ 6 … … 42 42 ;Copyright db ' AiR-BOOT v1.0.8 - (c) 2012 M. Kiewitz <<Release Candidate 1>> (bld: 20120124)', 0 43 43 ;Copyright db ' AiR-BOOT v1.0.8 - (c) 2012 M. Kiewitz <<Release Candidate 2>> (bld: 20120224)', 0 44 Copyright db ' AiR-BOOT v1.0.8 - (c) 2012 M. Kiewitz <<Internal Release 2l>> (bld: 20120224)', 0 44 45 46 ;~ Copyright db ' AiR-BOOT v',BLDLVL_MAJOR_VERSION,'.',BLDLVL_MIDDLE_VERSION,'.',BLDLVL_MINOR_VERSION,' - (c) ',BLDLVL_YEAR,' M. Kiewitz <<Internal Release 2l>> (bld: ',BLDLVL_YEAR,BLDLVL_MONTH,BLDLVL_DAY,')', 0 47 48 ; 49 ; Masm found the above to be too complex, so we broke it up. 50 ; 51 Copyright: 52 db ' AiR-BOOT v' 53 db BLDLVL_MAJOR_VERSION,'.' 54 db BLDLVL_MIDDLE_VERSION,'.' 55 db BLDLVL_MINOR_VERSION,' - (c) ' 56 db BLDLVL_YEAR 57 db ' M. Kiewitz <<Internal Release 2p>> (bld: ' 58 db BLDLVL_YEAR 59 db BLDLVL_MONTH 60 db BLDLVL_DAY,')' 61 db 0 62 63 45 64 ;Copyright db ' AiR-BOOT v1.0.8 - (c) 1998-2012 M. Kiewitz, Dedicated to Gerd Kiewitz', 0 46 65 … … 68 87 db 'Contact via e-mail: ', 0, 'airboot@ecomstation.com', 0 69 88 89 ; Build Information string. 90 build_info db 'Build Date: ',0 91 jwasm_txt db 'JWasm',0 92 masm_txt db 'Masm',0 93 wasm_txt db 'Wasm',0 94 tasm_txt db 'Tasm',0 95 unknown_txt db '????',0 96 70 97 ContinueBIOSbootTable dw offset TXT_SETUP_MAGIC_CDROM 71 98 dw offset TXT_SETUP_MAGIC_Network -
trunk/BOOTCODE/REGULAR/VIDEOIO.ASM
r40 r46 650 650 VideoIO_SyncPos EndP 651 651 652 652 ; 653 ; Put the Build Information at the POST BIOS screen. 654 ; 655 VideoIO_PrintBuildInfo Proc Near Uses ax cx si di 656 ; Print header. 657 mov si, offset build_info 658 call MBR_Teletype 659 660 ; Prepare info in temorary buffer. 661 mov si,offset bld_level_date_start 662 mov cx,offset bld_level_date_end 663 sub cx,si 664 mov di,offset Scratch 665 cld 666 rep movsb 667 668 ; Fill spaces until assembler specification. 669 mov al,' ' 670 mov cx,37 671 rep stosb 672 673 ; Copy assembler specification. 674 IFDEF JWASM 675 mov al,'[' 676 stosb 677 mov si,offset jwasm_txt 678 ELSEIFDEF TASM 679 mov al,' ' 680 stosb 681 mov al,'[' 682 stosb 683 mov si,offset tasm_txt 684 685 ELSEIFDEF WASM 686 mov al,' ' 687 stosb 688 mov al,'[' 689 stosb 690 mov si,offset wasm_txt 691 ELSEIFDEF MASM 692 mov al,' ' 693 stosb 694 mov al,'[' 695 stosb 696 mov si,offset masm_txt 697 ELSE 698 mov al,' ' 699 stosb 700 mov al,'[' 701 stosb 702 mov si,offset unknown_txt 703 ENDIF 704 VideoIO_PrintBuildInfo_a1: 705 lodsb 706 test al,al 707 jz VideoIO_PrintBuildInfo_e1 708 stosb 709 jmp VideoIO_PrintBuildInfo_a1 710 VideoIO_PrintBuildInfo_e1: 711 mov al,']' 712 stosb 713 714 ; Insert NULL Terminator. 715 xor al,al 716 stosb 717 718 ; Print Info. 719 mov si, offset Scratch 720 call MBR_TeletypeNL 721 ret 722 VideoIO_PrintBuildInfo EndP 653 723 654 724 ;VideoIO_DBG_WriteString Proc Near Uses ax bx cx dx si es di -
trunk/BOOTCODE/SETUP/MAIN.ASM
r40 r46 24 24 ENDIF 25 25 26 LocMENU_RoutinePtr equ 027 LocMENU_VariablePtr equ 228 LocMENU_ItemNamePtr equ 429 LocMENU_ItemHelpPtr equ 630 LocMENU_ItemPack equ 8 ; only if VariablePtr>026 ;~ LocMENU_RoutinePtr equ 0 27 ;~ LocMENU_VariablePtr equ 2 28 ;~ LocMENU_ItemNamePtr equ 4 29 ;~ LocMENU_ItemHelpPtr equ 6 30 ;~ LocMENU_ItemPack equ 8 ; only if VariablePtr>0 31 31 32 32 SETUP_UpperFixString db 'SETUP ',0 ; AddOn for "AiR-BOOT SETUP vX.XX" … … 86 86 87 87 88 test CFG_AutoEnterSetup, 188 test byte ptr [CFG_AutoEnterSetup], 1 89 89 jnz SCES_ForceEnter 90 mov al, SETUP_KeysOnEntry90 mov al, [SETUP_KeysOnEntry] 91 91 test al, Keys_Flags_EnterSetup 92 92 IFDEF ReleaseCode … … 100 100 101 101 SETUP_Main Proc Near Uses si es bp 102 mov SETUP_ExitEvent, 0102 mov byte ptr [SETUP_ExitEvent], 0 103 103 xor al, al ; -PARTITION SETUP PreDefines- 104 mov PartSetup_UpperPart, al ; Upper-Partition == 0105 mov PartSetup_ActivePart, al ; Active-Partition == 0104 mov [PartSetup_UpperPart], al ; Upper-Partition == 0 105 mov [PartSetup_ActivePart], al ; Active-Partition == 0 106 106 107 107 ; Setup PartitionPointers-Table...again (needed when re-entering setup) … … 118 118 ; CurMenu: Left Side 0-6, Right Side 8-14 (Bit 3!) 119 119 SETUP_MenuTask Proc Near ; the main-menu routine 120 cmp SETUP_ExitEvent, 1120 cmp byte ptr [SETUP_ExitEvent], 1 121 121 jne SMT_NoImmediateExit 122 122 ret … … 132 132 jne SMT_NotMainMenu 133 133 call FX_EndScreenLeft ; Do FX, if requested... 134 test CFG_PasswordSetup, 1134 test byte ptr [CFG_PasswordSetup], 1 135 135 jz SMT_NotMainMenu 136 136 mov ax, 0ABABh … … 202 202 mov ch, dh 203 203 call SETUP_SwitchToSelectedItem ; Calculates SI for Item-No (CH) 204 mov ax, word ptrds:[si+LocMENU_RoutinePtr]205 mov bx, word ptrds:[si+LocMENU_VariablePtr]204 mov ax, ds:[si+LocMENU_RoutinePtr] 205 mov bx, ds:[si+LocMENU_VariablePtr] 206 206 or bx, bx ; VarPtr ? 207 207 jnz SMT_DoNotExecute … … 210 210 call ax ; Call to CodePtr 211 211 call SETUP_DrawMenuOnScreen ; Redraw after return 212 cmp SETUP_ExitEvent, 1212 cmp byte ptr [SETUP_ExitEvent], 1 213 213 je SMT_ExitEvent 214 214 SMT_DoNotExecute: … … 226 226 mov ch, dh 227 227 call SETUP_SwitchToSelectedItem ; Calculates SI for Item-No (CH) 228 mov ax, word ptrds:[si+LocMENU_RoutinePtr]229 mov bx, word ptrds:[si+LocMENU_VariablePtr]228 mov ax, ds:[si+LocMENU_RoutinePtr] 229 mov bx, ds:[si+LocMENU_VariablePtr] 230 230 or bx, bx ; VarPtr ? =0 No ItemPack 231 231 jnz SMT_DoItemPack … … 272 272 mov ch, dh 273 273 call SETUP_SwitchToSelectedItem ; Calculates SI for Item-No (CH) 274 mov bx, word ptrds:[si+LocMENU_ItemHelpPtr]274 mov bx, ds:[si+LocMENU_ItemHelpPtr] 275 275 or bx, bx ; Help-Ptr available ? 276 276 jz SMT_NoHelpAvailable … … 883 883 mov cx, 0E05h 884 884 call VideoIO_Color 885 mov EnterPwd_Location, 0E26h886 mov EnterPwd_DefinePwd, 1885 mov word ptr [EnterPwd_Location], 0E26h 886 mov word ptr [EnterPwd_DefinePwd], 1 887 887 jmp SLEP_JumpToInputProcess 888 888 … … 927 927 ; DL - location of cursor (first=0) 928 928 SLEP_Loop: 929 mov cx, EnterPwd_Location929 mov cx, [EnterPwd_Location] 930 930 call VideoIO_Locate 931 931 push si … … 990 990 or dl, dl 991 991 jnz SLEP_GotSomePassword 992 cmp EnterPwd_DefinePwd, 1992 cmp word ptr [EnterPwd_DefinePwd], 1 993 993 je SLEP_GotSomePassword 994 994 mov cx, 8 … … 1044 1044 SEMSAES_DoThis: 1045 1045 xor al, al 1046 mov CFG_AutoEnterSetup, al1047 add CFG_LastTimeEditLow, 11048 adc CFG_LastTimeEditHi, 0 ; Update Time-Stamp1046 mov byte ptr [CFG_AutoEnterSetup], al 1047 add word ptr [CFG_LastTimeEditLow], 1 1048 adc word ptr [CFG_LastTimeEditHi], 0 ; Update Time-Stamp 1049 1049 IFDEF ReleaseCode 1050 1050 call DriveIO_SaveConfiguration 1051 1051 ENDIF 1052 mov SETUP_ExitEvent, 1 ; Exit and continue boot process1052 mov byte ptr [SETUP_ExitEvent], 1 ; Exit and continue boot process 1053 1053 SEMSAES_UserAbort: 1054 1054 ret … … 1060 1060 jnz SEMEWS_UserAbort 1061 1061 ; If we were forced to enter Setup, save configuration anyway... 1062 test CFG_AutoEnterSetup, 11062 test byte ptr [CFG_AutoEnterSetup], 1 1063 1063 jz SEMEWS_DoThis 1064 1064 jmp SEMEWS_DoThis ; Cross-Jump to SaveAndExitSetup! … … 1068 1068 call DriveIO_LoadConfiguration ; This is *NOT* IPT nor HideConfig 1069 1069 ENDIF 1070 mov SETUP_ExitEvent, 1 ; Exit and continue boot process1070 mov byte ptr [SETUP_ExitEvent], 1 ; Exit and continue boot process 1071 1071 SEMEWS_UserAbort: 1072 1072 ret … … 1270 1270 SMCP_AlreadyGotSelection: 1271 1271 ; We use BL in here for tracking how many selections left 1272 mov bl, CFG_Partitions1272 mov bl, [CFG_Partitions] 1273 1273 cmp dl, 0FEh 1274 1274 jb SMCP_DoneAdjust 1275 1275 je SMCP_AdjustContinueBIOS 1276 cmp CFG_IncludeFloppy, 01276 cmp byte ptr [CFG_IncludeFloppy], 0 1277 1277 jne SMCP_DoneAdjust 1278 1278 dec dl ; No Floppy? -> Try Resume-BIOS 1279 1279 SMCP_AdjustContinueBIOS: 1280 cmp CFG_ResumeBIOSbootSeq, 01280 cmp byte ptr [CFG_ResumeBIOSbootSeq], 0 1281 1281 jne SMCP_DoneAdjust 1282 1282 xor dl, dl ; No Resume-BIOS? -> Start partition 0 … … 1291 1291 SMCP_Inc_RejectPartition: 1292 1292 inc dl ; Increase Selection No 1293 cmp dl, CFG_Partitions1293 cmp dl, [CFG_Partitions] 1294 1294 jb SMCP_Inc_ModifyDone 1295 1295 cmp dl, 0FFh 1296 1296 je SMCP_Inc_TryFloppy 1297 1297 mov dl, 0FEh ; Try Resume-BIOS 1298 cmp CFG_ResumeBIOSbootSeq, 01298 cmp byte ptr [CFG_ResumeBIOSbootSeq], 0 1299 1299 jne SMCP_Inc_ModifyDone 1300 1300 inc dl ; Try Floppy 1301 1301 SMCP_Inc_TryFloppy: 1302 cmp CFG_IncludeFloppy, 01302 cmp byte ptr [CFG_IncludeFloppy], 0 1303 1303 jne SMCP_Inc_ModifyDone 1304 cmp CFG_Partitions, 01304 cmp byte ptr [CFG_Partitions], 0 1305 1305 je SMCP_NoBootable 1306 1306 inc dl ; Now start at partition 0 again … … 1325 1325 cmp dl, 0FFh 1326 1326 jb SMCP_Dec_TryResumeBIOS 1327 cmp CFG_IncludeFloppy, 01327 cmp byte ptr [CFG_IncludeFloppy], 0 1328 1328 jne SMCP_Dec_ModifyDone 1329 1329 dec dl 1330 1330 SMCP_Dec_TryResumeBIOS: 1331 cmp CFG_ResumeBIOSbootSeq, 01331 cmp byte ptr [CFG_ResumeBIOSbootSeq], 0 1332 1332 jne SMCP_Dec_ModifyDone 1333 1333 SMCP_Dec_TryPartition: 1334 mov dl, CFG_Partitions1334 mov dl, [CFG_Partitions] 1335 1335 or dl, dl 1336 1336 jz SMCP_NoBootable … … 1347 1347 SMCP_GotSelection: 1348 1348 pop bx 1349 mov ds:[bx], dl ; neue Partition setzen1349 mov ds:[bx], dl ; Set new partition 1350 1350 add si, LocIPT_Name ; Location of Name 1351 1351 push cs … … 1564 1564 SETUPMAGIC_ChangeFloppyDisplay Proc Near Uses cx dx si es di 1565 1565 call SETUPMAGIC_EnableDisable ; forward call 1566 cmp CFG_PartDefault, 0FFh ; Default-Selection is us?1566 cmp byte ptr [CFG_PartDefault], 0FFh ; Default-Selection is us? 1567 1567 jne SMCFD_Done 1568 1568 xor ch, ch … … 1590 1590 jnz SMCBBS_Enabled 1591 1591 mov si, offset TXT_SETUP_MAGIC_Disabled 1592 cmp CFG_PartDefault, 0FEh ; Default-Selection is us?1592 cmp byte ptr [CFG_PartDefault], 0FEh ; Default-Selection is us? 1593 1593 jne SMCBBS_CopyThiz 1594 1594 mov CFG_PartDefault, dl ; Reset Default-Selection to 1st part -
trunk/BOOTCODE/SETUP/PART_SET.ASM
r45 r46 602 602 call VideoIO_Locate ; Goes to CX 603 603 604 mov ChangePartNameSave, 0 ; Don't save to BR / LVM Sector604 mov byte ptr [ChangePartNameSave], 0 ; Don't save to BR / LVM Sector 605 605 606 606 ; We compare, if our IPT contains the same partition name as in BR or LVM … … 612 612 mov bh,0 613 613 614 cmp [PartitionVolumeLetters+bx], 0 ; ==0 means not supported by LVM614 cmp byte ptr [PartitionVolumeLetters+bx], 0 ; ==0 means not supported by LVM 615 615 je PSCPN_NotLVMSupported 616 616 … … 618 618 ; Load LVM-Sector here and seek to PartitionName 619 619 ; Set CurPartition_Location information of destination partition 620 mov ax, wptr[si+LocIPT_AbsolutePartTable]621 mov wptr[CurPartition_Location+0], ax622 mov ax, wptr[si+LocIPT_AbsolutePartTable+2]623 mov wptr[CurPartition_Location+2], ax624 mov ah, b ptr [si+LocIPT_LocationPartTable+0]625 mov al, [si+LocIPT_Drive]626 mov wptr[CurPartition_Location+4], ax627 mov ax, wptr[si+LocIPT_LocationPartTable+1]628 mov wptr[CurPartition_Location+6], ax620 mov ax, [si+LocIPT_AbsolutePartTable] 621 mov [CurPartition_Location+0], ax 622 mov ax, [si+LocIPT_AbsolutePartTable+2] 623 mov [CurPartition_Location+2], ax 624 mov ah, byte ptr [si+LocIPT_LocationPartTable+0] 625 mov al, byte ptr [si+LocIPT_Drive] 626 mov [CurPartition_Location+4], ax 627 mov ax, [si+LocIPT_LocationPartTable+1] 628 mov [CurPartition_Location+6], ax 629 629 mov di, si ; Put SI into DI 630 630 call DriveIO_LoadLVMSector 631 631 jnc PSCPN_LVMGotError ; Security again, if problem -> halt 632 632 push dx 633 mov ax, wptr[di+LocIPT_AbsoluteBegin]634 mov dx, wptr[di+LocIPT_AbsoluteBegin+2]633 mov ax, [di+LocIPT_AbsoluteBegin] 634 mov dx, [di+LocIPT_AbsoluteBegin+2] 635 635 call LVM_SearchForPartition 636 636 pop dx … … 657 657 ; Load Boot-Record... 658 658 push dx 659 mov ax, wptr[si+LocIPT_AbsoluteBegin+0]660 mov bx, wptr[si+LocIPT_AbsoluteBegin+2]659 mov ax, [si+LocIPT_AbsoluteBegin+0] 660 mov bx, [si+LocIPT_AbsoluteBegin+2] 661 661 mov cx, [si+LocIPT_LocationBegin+1] 662 662 mov dh, [si+LocIPT_LocationBegin+0] … … 696 696 697 697 ; Do no synchronization initially. 698 mov [SyncLvmLabels],0698 mov byte ptr [SyncLvmLabels],0 699 699 700 700 ; SI = IPT_Enty, DI points to LVM VolumeName. … … 729 729 repe cmpsb ; Compare V and P labels 730 730 jnz LVM_Labels_not_equal 731 mov [SyncLvmLabels],1 ; Same so set flag for later731 mov byte ptr [SyncLvmLabels],1 ; Same so set flag for later 732 732 LVM_Labels_not_equal: 733 733 pop di … … 744 744 jne PSCPN_LetUserEditPartName ; -> No BR/LVM Changing/Saving 745 745 746 mov ChangePartNameSave, 1 ; Remember, so we will save to BR746 mov byte ptr [ChangePartNameSave], 1 ; Remember, so we will save to BR 747 747 748 748 ; SI = IPT_Enty, DI points to LVM PartitionName. … … 754 754 jnc PSCPN_AllDone ; Did user abort ? 755 755 756 test ChangePartNameSave, 1756 test byte ptr [ChangePartNameSave], 1 757 757 jz PSCPN_AllDone ; Actually we just skip BR/LVM-Save 758 758 … … 763 763 mov bh,0 764 764 765 cmp [PartitionVolumeLetters+bx], 0 ; ==0 means not supported by LVM765 cmp byte ptr [PartitionVolumeLetters+bx], 0 ; ==0 means not supported by LVM 766 766 je PSCPN_SaveBootRecord 767 767 … … 814 814 815 815 ; See if LVM-labels need to be synced. 816 test [SyncLvmLabels],1816 test byte ptr [SyncLvmLabels],1 817 817 jz LVM_no_sync_labels 818 818 … … 869 869 ; If Partition Selected Left-Side -> go Right-Sided Window 870 870 ; otherwise Left-Sided. 871 mov PartSetup_ActivePart, dl871 mov [PartSetup_ActivePart], dl 872 872 mov ax, 0102h 873 873 and dl, 1 … … 875 875 mov ax, 002Ah 876 876 PHSM_FirstStep: 877 mov PartSetup_HiddenX, al878 mov PartSetup_HiddenAdd, ah877 mov [PartSetup_HiddenX], al 878 mov [PartSetup_HiddenAdd], ah 879 879 880 880 ; Draw Menu... 881 881 xor dx, dx 882 mov PartSetup_HiddenUpper, dl882 mov [PartSetup_HiddenUpper], dl 883 883 call PARTHIDESETUP_DrawMenuBase 884 884 call PARTHIDESETUP_RefreshPartitions … … 919 919 PHSM_KeyESC: 920 920 ; Collect Hide-Partition-Config and put it into Hide-Table 921 mov dl, PartSetup_ActivePart921 mov dl, [PartSetup_ActivePart] 922 922 923 923 IFDEF AUX_DEBUG … … 977 977 call VideoIO_Color 978 978 mov bh, 05h 979 mov bl, PartSetup_HiddenX979 mov bl, [PartSetup_HiddenX] 980 980 mov dh, 10h 981 981 mov dl, bl 982 982 add dl, 25h 983 add dl, PartSetup_HiddenAdd983 add dl, [PartSetup_HiddenAdd] 984 984 push bx 985 985 call VideoIO_MakeWindow … … 1010 1010 ; --- Make Window-Footer - "State when booting..." at bottom right frame-line 1011 1011 mov dh, 10h 1012 mov dl, PartSetup_HiddenX1012 mov dl, [PartSetup_HiddenX] 1013 1013 add dl, 25h 1014 add dl, PartSetup_HiddenAdd; Location 16, HiddenX->right aligned1014 add dl, [PartSetup_HiddenAdd] ; Location 16, HiddenX->right aligned 1015 1015 mov si, offset TXT_SETUP_HideFeature2 1016 1016 call GetLenOfString ; CX - Length of HideFeature2 1017 1017 sub dl, cl ; Adjust Position 1018 1018 push dx 1019 mov dl, PartSetup_ActivePart1019 mov dl, [PartSetup_ActivePart] 1020 1020 call PART_GetPartitionPointer ; Holt den Pointer der Partition (DL) nach SI 1021 1021 pop dx … … 1080 1080 ; Draw all partitions to Hidden-Setup aka Dynamic Content-Draw 1081 1081 PARTHIDESETUP_RefreshPartitions Proc Near Uses dx 1082 mov dl, PartSetup_HiddenUpper1082 mov dl, [PartSetup_HiddenUpper] 1083 1083 mov dh, 8 1084 1084 PHSRP_Loop: … … 1095 1095 call VideoIO_Color 1096 1096 mov cx, 0603h ; 6, +3 1097 add cl, PartSetup_HiddenX1098 mov dl, PartSetup_HiddenUpper1097 add cl, [PartSetup_HiddenX] 1098 mov dl, [PartSetup_HiddenUpper] 1099 1099 call PARTSETUP_UpperScrollMarker 1100 1100 add cl, 29 1101 add cl, PartSetup_HiddenAdd; 6, +291101 add cl, [PartSetup_HiddenAdd] ; 6, +29 1102 1102 call PARTSETUP_UpperScrollMarker 1103 1103 mov cx, 0F03h ; 15, +3 1104 add cl, PartSetup_HiddenX1104 add cl, [PartSetup_HiddenX] 1105 1105 add dl, 8 ; add 8 -> points to last partition 1106 mov dh, CFG_Partitions; Limit1106 mov dh, [CFG_Partitions] ; Limit 1107 1107 call PARTSETUP_LowerScrollMarker 1108 1108 add cl, 29 1109 add cl, PartSetup_HiddenAdd; 6, +291109 add cl, [PartSetup_HiddenAdd] ; 6, +29 1110 1110 call PARTSETUP_LowerScrollMarker 1111 1111 ret … … 1115 1115 local NoOfPart :byte 1116 1116 mov ch, dl 1117 sub ch, PartSetup_HiddenUpper1117 sub ch, [PartSetup_HiddenUpper] 1118 1118 add ch, 7 1119 1119 mov cl, 2 1120 add cl, PartSetup_HiddenX1120 add cl, [PartSetup_HiddenX] 1121 1121 ; We got location 1122 1122 mov NoOfPart, dl … … 1130 1130 pop cx 1131 1131 1132 cmp dl, CFG_Partitions1132 cmp dl, [CFG_Partitions] 1133 1133 jae PHSDPI_NoData 1134 1134 … … 1222 1222 xor dh, dh 1223 1223 PHSBCB_NoUnderflow: 1224 cmp dh, CFG_Partitions1224 cmp dh, [CFG_Partitions] 1225 1225 jb PHSBCB_NoOverflow 1226 mov dh, CFG_Partitions1226 mov dh, [CFG_Partitions] 1227 1227 dec dh 1228 1228 PHSBCB_NoOverflow: … … 1230 1230 1231 1231 ; Do we need to scroll ? 1232 mov al, PartSetup_HiddenUpper1232 mov al, [PartSetup_HiddenUpper] 1233 1233 cmp dl, al 1234 1234 jb PHSBCB_YesScrolling … … 1238 1238 mov al, dl 1239 1239 sub al, 7 1240 mov PartSetup_HiddenUpper, al1240 mov [PartSetup_HiddenUpper], al 1241 1241 call PARTHIDESETUP_RefreshPartitions 1242 1242 jmp PHSBCB_NoScrolling 1243 1243 PHSBCB_YesScrolling: 1244 1244 mov al, dl 1245 mov PartSetup_HiddenUpper, al1245 mov [PartSetup_HiddenUpper], al 1246 1246 call PARTHIDESETUP_RefreshPartitions 1247 1247 PHSBCB_NoScrolling: … … 1263 1263 mov bh, cl ; Color to BH 1264 1264 ; First calculate location of bar 1265 cmp dl, PartSetup_HiddenUpper1265 cmp dl, [PartSetup_HiddenUpper] 1266 1266 jb PHSRCP_NotInWindowView 1267 1267 mov ch, dl 1268 sub ch, PartSetup_HiddenUpper; CH - Position relative to HiddenUpper1268 sub ch, [PartSetup_HiddenUpper] ; CH - Position relative to HiddenUpper 1269 1269 cmp ch, 8 ; 8 - Maximum Total in Window 1270 1270 jae PHSRCP_NotInWindowView 1271 1271 add ch, 7 1272 1272 mov cl, 26 1273 add cl, PartSetup_HiddenX1274 add cl, PartSetup_HiddenAdd1273 add cl, [PartSetup_HiddenX] 1274 add cl, [PartSetup_HiddenAdd] 1275 1275 1276 1276 mov bl, 10 ; Length of Bar is 10 … … 1315 1315 ; each points to a partition. 1316 1316 ; 3Fh is end-marker / maximum entries = CFG_Partitions 1317 mov cl, CFG_Partitions1317 mov cl, [CFG_Partitions] 1318 1318 mov bx,di ; Pointer to hidden-parts entry for this partition. 1319 1319 mov ch,0 ; Start index in hidden-parts entry for this partition. … … 1374 1374 mov si, offset PartitionTable 1375 1375 xor ch, ch ; Partition index 1376 mov cl, CFG_Partitions; Nr. of partitions in IPT1376 mov cl, [CFG_Partitions] ; Nr. of partitions in IPT 1377 1377 mov ah,0 ; Next hide-index to write. 1378 1378 … … 1523 1523 mov bh,0 1524 1524 1525 mov dl, b ptr [DriveLetters+bx]1525 mov dl, byte ptr [DriveLetters+bx] 1526 1526 1527 1527 push bx … … 1625 1625 call VideoIO_Color 1626 1626 mov bh, 06h 1627 mov bl, PartSetup_HiddenX1627 mov bl, [PartSetup_HiddenX] 1628 1628 mov dh, 0Ah 1629 1629 mov dl, bl … … 1698 1698 push dx 1699 1699 mov cx, 0805h ; Position 8, 5 1700 add cl, PartSetup_HiddenX1700 add cl, [PartSetup_HiddenX] 1701 1701 call VideoIO_Locate 1702 1702 add cl, 6 ; Everything centered (12/2) -
trunk/BOOTCODE/SPECIAL/F00K/BILLSUXX.ASM
r40 r46 34 34 MSHACK_ProcessPartTables Proc Near Uses ax dx di 35 35 ; Check Overall M$-Hack Enable 36 test [CFG_ExtPartitionMShack], 136 test byte ptr [CFG_ExtPartitionMShack], 1 37 37 jz MSHPPT_NoMShack 38 38 -
trunk/BOOTCODE/SPECIAL/FAT16.ASM
r40 r46 125 125 ; ES - Segment, where to read Cluster to 126 126 ; DI - Offset, where to read Cluster to 127 ; Out: DX - Cluster that follows this one, [ES:DI] filled out127 ; Out: DX - Cluster that follows this one, es:[DI] filled out 128 128 ; DI - Offset, adjusted 129 129 ; Destroyed: None -
trunk/BOOTCODE/SPECIAL/FX.ASM
r40 r46 52 52 FX_CalculateTables EndP 53 53 54 ; This routine will dump a color-table to ES: [DI]. Total of 96 bytes.54 ; This routine will dump a color-table to ES:es:[DI]. Total of 96 bytes. 55 55 ; In: AX - Color-Separator (RGB, per value 4 bit) 56 56 ; DI - Pointer to Buffer for Color-Table … … 112 112 ; so the screen will be generated there instead of the current page. 113 113 FX_StartScreen Proc Near 114 test CFG_CooperBars, 1114 test byte ptr [CFG_CooperBars], 1 115 115 jz FXSS_NoFX 116 mov VideoIO_Segment, VideoIO_Page2116 mov word ptr [VideoIO_Segment], VideoIO_Page2 117 117 FXSS_NoFX: 118 118 ret … … 123 123 ; copy the new screen to Page 0 and activate it. 124 124 FX_EndScreenLeft Proc Near 125 test CFG_CooperBars, 1125 test byte ptr [CFG_CooperBars], 1 126 126 jnz FXESL_Go 127 127 ret … … 137 137 mov ax, VideoIO_Page2 138 138 call VideoIO_RestoreFrom 139 mov VideoIO_Segment, VideoIO_Page0139 mov word ptr [VideoIO_Segment], VideoIO_Page0 140 140 call FX_EndScreenInternalCleanUp 141 141 popa … … 144 144 145 145 FX_ScrollScreenLeft Proc Near 146 mov FX_WideScrollerCurPos, 640147 mov FX_WideScrollerDirection, 0148 mov FX_WideScrollerAbsDirection, 0146 mov word ptr [FX_WideScrollerCurPos], 640 147 mov byte ptr [FX_WideScrollerDirection], 0 148 mov byte ptr [FX_WideScrollerAbsDirection], 0 149 149 call FX_EndScreenInternalGo 150 150 ret … … 152 152 153 153 FX_EndScreenRight Proc Near 154 test CFG_CooperBars, 1154 test byte ptr [CFG_CooperBars], 1 155 155 jnz FXESR_Go 156 156 ret … … 166 166 mov ax, VideoIO_Page2 167 167 call VideoIO_RestoreFrom 168 mov VideoIO_Segment, VideoIO_Page0168 mov word ptr [VideoIO_Segment], VideoIO_Page0 169 169 call FX_EndScreenInternalCleanUp 170 170 popa … … 173 173 174 174 FX_ScrollScreenRight Proc Near 175 mov FX_WideScrollerCurPos, 0176 mov FX_WideScrollerDirection, 1177 mov FX_WideScrollerAbsDirection, 1175 mov word ptr [FX_WideScrollerCurPos], 0 176 mov byte ptr [FX_WideScrollerDirection], 1 177 mov byte ptr [FX_WideScrollerAbsDirection], 1 178 178 call FX_EndScreenInternalGo 179 179 ret … … 181 181 182 182 FX_EndScreenInternalGo Proc Near 183 mov FX_WideScrollerSpeed, 1184 mov FX_WideScrollerSpeedState, 1185 mov FX_WideScrollerBounceSpeed, 25183 mov byte ptr [FX_WideScrollerSpeed], 1 184 mov byte ptr [FX_WideScrollerSpeedState], 1 185 mov byte ptr [FX_WideScrollerBounceSpeed], 25 186 186 ; Check, if this is 1st time call... 187 inc FX_UseCount188 cmp FX_UseCount, 1187 inc word ptr [FX_UseCount] 188 cmp word ptr [FX_UseCount], 1 189 189 jne FX_ES_NotFirstTime 190 mov FX_OverallTimer, 220191 mov FX_WideScrollerTimer, 93192 mov FX_CooperBarsTimer, 1190 mov word ptr [FX_OverallTimer], 220 191 mov word ptr [FX_WideScrollerTimer], 93 192 mov word ptr [FX_CooperBarsTimer], 1 193 193 jmp FX_ES_NowGoMagic 194 194 FX_ES_NotFirstTime: 195 mov FX_OverallTimer, 127196 mov FX_WideScrollerTimer, 1197 mov FX_CooperBarsTimer, -1; Disable coopers on further goes195 mov word ptr [FX_OverallTimer], 127 196 mov word ptr [FX_WideScrollerTimer], 1 197 mov word ptr [FX_CooperBarsTimer], -1 ; Disable coopers on further goes 198 198 FX_ES_NowGoMagic: 199 199 call FX_MakeMagicalStuff … … 275 275 jb FX_MCS_VerticalLoop 276 276 277 mov ax, FX_CooperBarsTimer277 mov ax, [FX_CooperBarsTimer] 278 278 dec ax 279 279 jnz FX_MMS_CooperBarsPending … … 282 282 mov ax, 1 283 283 FX_MMS_CooperBarsPending: 284 mov FX_CooperBarsTimer, ax285 286 mov ax, FX_WideScrollerTimer284 mov [FX_CooperBarsTimer], ax 285 286 mov ax, [FX_WideScrollerTimer] 287 287 dec ax 288 288 jnz FX_MMS_WideScrollerPending … … 290 290 mov ax, 1 291 291 FX_MMS_WideScrollerPending: 292 mov FX_WideScrollerTimer, ax293 294 dec FX_OverallTimer292 mov [FX_WideScrollerTimer], ax 293 294 dec word ptr [FX_OverallTimer] 295 295 jnz FX_MMS_RetraceLoop 296 296 ret … … 417 417 418 418 FX_CalculateWideScroller Proc Near 419 mov bx, FX_WideScrollerCurPos419 mov bx, [FX_WideScrollerCurPos] 420 420 ;movzx cx, FX_WideScrollerSpeed 421 mov cl, FX_WideScrollerSpeed421 mov cl, [FX_WideScrollerSpeed] 422 422 mov ch,0 423 423 424 test FX_WideScrollerAbsDirection, 1424 test byte ptr [FX_WideScrollerAbsDirection], 1 425 425 jnz FXCWS_RIGHT 426 426 jmp FXCWS_LEFT … … 428 428 ; ================================================== WideScroll: LEFT CALC 429 429 FXCWS_LEFT: 430 test FX_WideScrollerSpeedState, 1430 test byte ptr [FX_WideScrollerSpeedState], 1 431 431 jz FXCWS_LEFT_Bouncing 432 432 or bx, bx … … 437 437 or cx, cx 438 438 jnz FXCWS_DoSpeedThing 439 mov FX_WideScrollerSpeedState, 1440 mov FX_WideScrollerDirection, 0441 mov dl, FX_WideScrollerBounceSpeed439 mov byte ptr [FX_WideScrollerSpeedState], 1 440 mov byte ptr [FX_WideScrollerDirection], 0 441 mov dl, [FX_WideScrollerBounceSpeed] 442 442 shr dl,1 443 mov FX_WideScrollerBounceSpeed, dl443 mov [FX_WideScrollerBounceSpeed], dl 444 444 jmp FXCWS_DoSpeedThing 445 445 446 446 FXCWS_LEFT_BounceNOW: 447 mov cl, FX_WideScrollerBounceSpeed448 mov FX_WideScrollerSpeedState, 0449 mov FX_WideScrollerDirection, 1447 mov cl, [FX_WideScrollerBounceSpeed] 448 mov byte ptr [FX_WideScrollerSpeedState], 0 449 mov byte ptr [FX_WideScrollerDirection], 1 450 450 jmp FXCWS_DoSpeedThing 451 451 452 452 ; ================================================= WideScroll: RIGHT CALC 453 453 FXCWS_RIGHT: 454 test FX_WideScrollerSpeedState, 1454 test byte ptr [FX_WideScrollerSpeedState], 1 455 455 jz FXCWS_RIGHT_Bouncing 456 456 cmp bx, 640 ; 1280 … … 461 461 or cl, cl 462 462 jnz FXCWS_DoSpeedThing 463 mov FX_WideScrollerSpeedState, 1464 mov FX_WideScrollerDirection, 1465 mov dl, FX_WideScrollerBounceSpeed463 mov byte ptr [FX_WideScrollerSpeedState], 1 464 mov byte ptr [FX_WideScrollerDirection], 1 465 mov dl, [FX_WideScrollerBounceSpeed] 466 466 shr dl, 1 467 mov FX_WideScrollerBounceSpeed, dl467 mov [FX_WideScrollerBounceSpeed], dl 468 468 jmp FXCWS_DoSpeedThing 469 469 470 470 FXCWS_RIGHT_BounceNOW: 471 mov cl, FX_WideScrollerBounceSpeed472 mov FX_WideScrollerSpeedState, 0473 mov FX_WideScrollerDirection, 0471 mov cl, [FX_WideScrollerBounceSpeed] 472 mov byte ptr [FX_WideScrollerSpeedState], 0 473 mov byte ptr [FX_WideScrollerDirection], 0 474 474 jmp FXCWS_DoSpeedThing 475 475 476 476 ; ================================================= WideScroll: SPEED CALC 477 477 FXCWS_DoSpeedThing: 478 test FX_WideScrollerSpeedState, 1478 test byte ptr [FX_WideScrollerSpeedState], 1 479 479 jnz FXCWS_SpeedUp 480 480 FXCWS_SpeedDown: … … 493 493 FXCWS_WideScrollNOW: 494 494 xor ch, ch 495 test FX_WideScrollerDirection, 1495 test byte ptr [FX_WideScrollerDirection], 1 496 496 jnz FXCWS_ScrollRIGHT 497 497 sub bx, cx … … 508 508 mov bx, 640 ; 1280 509 509 FXCWS_NotToBig: 510 mov FX_WideScrollerCurPos, bx511 mov FX_WideScrollerSpeed, cl510 mov [FX_WideScrollerCurPos], bx 511 mov [FX_WideScrollerSpeed], cl 512 512 mov ax, 160 513 513 call FX_SetWideLength -
trunk/BOOTCODE/SPECIAL/LVM.ASM
r40 r46 85 85 LVM_GetSectorCRC EndP 86 86 87 ; Checks DS:[SI], if a valid LVM Signature is found (sets carry in that case)87 ; Checks ds:[SI], if a valid LVM Signature is found (sets carry in that case) 88 88 ; This does not check for valid LVM CRC (which also needs to be done) 89 89 ; In: DS:SI - Sector that needs to get checked... … … 91 91 ; Destroyed: None 92 92 LVM_CheckSectorSignature Proc Near 93 test [CFG_IgnoreLVM], 1 ; We are supposed to ignore LVM, so93 test byte ptr [CFG_IgnoreLVM], 1 ; We are supposed to ignore LVM, so 94 94 jnz LVMCSS_InvalidSignature ; any sector is bad! 95 cmp w ptr [si+LocLVM_SignatureStart], 5202h ; Rousseau: identify LVM sector95 cmp word ptr [si+LocLVM_SignatureStart], 5202h ; Rousseau: identify LVM sector 96 96 jne LVMCSS_InvalidSignature 97 cmp w ptr [si+LocLVM_SignatureStart+2], 'BM'97 cmp word ptr [si+LocLVM_SignatureStart+2], 'BM' 98 98 jne LVMCSS_InvalidSignature 99 cmp w ptr [si+LocLVM_SignatureStart+4], 'MP'99 cmp word ptr [si+LocLVM_SignatureStart+4], 'MP' 100 100 jne LVMCSS_InvalidSignature 101 cmp w ptr [si+LocLVM_SignatureStart+6], 'DF'101 cmp word ptr [si+LocLVM_SignatureStart+6], 'DF' 102 102 jne LVMCSS_InvalidSignature 103 103 stc … … 115 115 LVM_CheckSectorCRC Proc Near Uses ax dx 116 116 call LVM_GetSectorCRC 117 cmp ax, w ptr [si+LocLVM_CRC]117 cmp ax, word ptr [si+LocLVM_CRC] 118 118 jne LVMCSCRC_BadCRC 119 cmp dx, w ptr [si+LocLVM_CRC+2]119 cmp dx, word ptr [si+LocLVM_CRC+2] 120 120 jne LVMCSCRC_BadCRC 121 121 stc … … 133 133 LVM_UpdateSectorCRC Proc Near Uses ax dx 134 134 call LVM_GetSectorCRC 135 mov w ptr [si+LocLVM_CRC], ax136 mov w ptr [si+LocLVM_CRC+2], dx135 mov word ptr [si+LocLVM_CRC], ax 136 mov word ptr [si+LocLVM_CRC+2], dx 137 137 ret 138 138 LVM_UpdateSectorCRC EndP -
trunk/BOOTCODE/SPECIAL/SOUND.ASM
r30 r46 27 27 28 28 SOUND_PreBootMenu Proc Near Uses ax 29 test CFG_MakeSound, 129 test byte ptr [CFG_MakeSound], 1 30 30 jz SOUND_PreBootMenu_SkipSound 31 test StartSoundPlayed, 131 test byte ptr [StartSoundPlayed], 1 32 32 jnz SOUND_PreBootMenu_SkipSound 33 33 mov ax, 1500 … … 39 39 mov ax, 200 40 40 call SOUND_WaitToSilence 41 mov StartSoundPlayed, 141 mov byte ptr [StartSoundPlayed], 1 42 42 SOUND_PreBootMenu_SkipSound: 43 43 ret … … 45 45 46 46 SOUND_ExecuteBoot Proc Near Uses ax 47 test CFG_MakeSound, 147 test byte ptr [CFG_MakeSound], 1 48 48 jz SOUND_ExecuteBoot_SkipSound 49 49 mov ax, 2000 -
trunk/BOOTCODE/_build.cmd
r37 r46 1 @SET ASM=tasm 1 2 @wmake dev -
trunk/BUILD.NFO
r37 r46 1 ====================================================== 1 =============================================================================== 2 2 BUILD.NFO -- Information on building AiR-BOOT v1.0.8 3 ====================================================== 3 =============================================================================== 4 4 5 5 Building AiR-BOOT and the support tools has been completely revamped … … 15 15 also adding extensive cross-platform support. 16 16 17 Several cross-reference files are generated, like object disassemblies 18 and executable header dumps. This aids development in checking for assembler 19 generation and the correctness of that code. 20 17 21 The (DOS-only) FIXCODE.COM program that is used to embed the MBR-protection 18 22 in the AiR-BOOT image has been replaced by platform specific versions. … … 21 25 22 26 The preferred assembler is now JWasm. 23 Note however that JWasm/DOS does not work so this environment will use 24 Tasm/DOS. The DOS build-environment will probably be discontinued in 27 While Tasm4/Masm6 and Wasm are also supported, their use should be of an 28 experimental nature only. Limitations for checking section overlaps 29 and other assembler specific directives inhibit the use of JWasm to 30 it's fullest capability. 31 Since JWasm is open-source and mature, there is no need to support other 32 assemblers in future releases of AiR-BOOT. 33 34 The JWasmD extended DOS version needs DPMI 'enabled' and XMS set to 0 35 to be able to run in an eCS DOS session. 36 The DOS build-environment will probably be discontinued in 25 37 the future due to it's many restrictions. DOS specific targets can 26 38 be built on the other platforms. 27 39 28 40 The Open Watcom tool-chain in combination with JWasm is now the 29 default tool-chain. No syntax or operational compatibility with other 30 assemblers or compilers is attempted. 41 default tool-chain. 31 42 32 43 Building AiR-BOOT v1.0.8 requires the following tools: … … 35 46 - Open Watcom 32-bits C-Compiler v1.9 or higher 36 47 - Open Watcom Linker v1.9 or higher 37 - JWasm Assembler v2.06d 48 - JWasm Assembler v2.06d or higher 38 49 39 50 As a convenience a simple GNUmakefile also exists where a Makefile exists. … … 43 54 Note that only the loader, installer and setaboot targets are built. 44 55 No floppy, cd-rom, etc. images. 56 57 58 Rousseau. -
trunk/INCLUDE/ASM.INC
r45 r46 100 100 ; This macro does a check for this condition and aborts if it exists. 101 101 ; If there is space between the new location and the last emitted code or data 102 ; will be filled.102 ; it will be filled with a filler-value defined in this macro.. 103 103 ; 104 104 ; There are differences between assemblers on when and how labels and values … … 107 107 ; That's why the actual check for overlap is done by db getting a negative 108 108 ; value if an overlap occured. 109 ; So don't change the (after - before) calculations by assigning it to a110 ; variable; thatwill break this macro.109 ; Don't change the (after - before) expression to a pre-calculated label 110 ; because that won't work and will break this macro. 111 111 ; 112 112 ORIGIN MACRO loc … … 119 119 ; Use this value to fill the gap between the new origin and the last 120 120 ; emitted code or data. 121 fillchar = ' X'121 fillchar = '0' 122 122 123 123 ; Mark the location of the last emitted code or data. … … 125 125 126 126 ; JWasm can do db 0 dup (0). 127 ; Using db dup() causes JWasm to recognize the after label so that 128 ; overlap calculations are correct. 127 129 IFDEF JWASM 128 130 db (z_&loc&_2after - z_&loc&_1before) dup(fillchar) 129 131 ENDIF 130 132 131 ; Tasm cannot. 133 ; Tasm cannot do db 0 dup(0), so we exclude that condition. 134 ; Overlap checking could be done differently in Tasm but to keep things 135 ; easy the JWasm method above is used. 132 136 IFDEF TASM 133 137 IF (z_&loc&_2after - z_&loc&_1before) NE 0 134 138 db (z_&loc&_2after - z_&loc&_1before) dup(fillchar) 135 139 ENDIF 140 ENDIF 141 142 ; Masm can also do db 0 dup (0), and it does calculate correctly 143 ; but cannot find the after label. 144 ; Same issue as with JWasm but the db construct does not solve it for masm. 145 ; The label-values show-up to be correct in the listing though. 146 ; Currently overlap-checking is disabled when assembling with Masm ! 147 ; FIXME: Find a solution for Masm. 148 IFDEF MASM 149 ;~ db (z_&loc&_2after - z_&loc&_1before) dup(fillchar) 150 ECHO ** Warning: Overlap Check on: loc not performed ! 151 ENDIF 152 153 ; Wasm can also do db 0 dup (0), but it complains about brackets or so. 154 ; Seems to be some syntax issue. 155 ; It cannot generate a list-file so values cannot be checked. 156 ; It does not even support ECHO so no warning can be given. 157 ; So overlap-checking is disabled when assembling with Wasm ! 158 ; FIXME: Find a solution for Wasm. 159 IFDEF WASM 160 ; NOT EVEN ECHO IS SUPPORTED ! 161 ;~ db (z_&loc&_2after - z_&loc&_1before) dup(fillchar) 136 162 ENDIF 137 163 … … 161 187 162 188 163 sector_size equ 512 164 image_size_60secs equ 7800h 165 image_size_62secs equ 7c00h 189 sector_size equ 512 ; Normal size of a sector. 190 image_size_60secs equ 7800h ; Size of the pre v1.07 image. 191 image_size_62secs equ 7c00h ; Size of the post v1.06 image. 166 192 167 193 ;image_size equ image_size_60secs 168 194 image_size equ image_size_62secs 169 195 170 sector_count equ image_size / sector_size ; Image size in sectors 196 ; Image size in sectors 197 sector_count equ image_size / sector_size 171 198 172 199 IF image_size EQ image_size_60secs 173 partition_count equ 30 ; Maximum number of partitions supported 200 ; Maximum number of partitions supported in pre v1.07. 201 partition_count equ 30 174 202 ELSE 175 partition_count equ 45 ; Maximum number of partitions supported 203 ; Maximum number of partitions supported in post v1.06. 204 partition_count equ 45 176 205 ENDIF -
trunk/INCLUDE/MAKEFILE.MIF
r37 r46 98 98 # 99 99 WARN_DOS_BLD_ENV=Warning: The DOS build-environment has limited functionality ! 100 WARN_OVERLAP_NOT_SUPPORTED=Warning: Overlap Checking not supported for assembler: "$(ASM)" ! 100 101 101 102 # … … 125 126 DS = \ 126 127 PS = ; 128 NULDEV = nul: 127 129 BS = _build.bat 128 130 SHELL = $(DOSSHELL) … … 141 143 DS = \ 142 144 PS = ; 145 NULDEV = nul: 143 146 BS = _build.cmd 144 147 SHELL = $(OS2SHELL) … … 157 160 DS = \ 158 161 PS = ; 162 NULDEV = nul: 159 163 BS = _build.cmd 160 164 SHELL = $(WINSHELL) … … 173 177 DS = / 174 178 PS = : 179 NULDEV = /dev/null 175 180 BS = _build.bash 176 181 SHELL = $(LINSHELL) -
trunk/INCLUDE/MAKEFRWD.MIF
r37 r46 11 11 # and '%:' to forward one or more targets. 12 12 # 13 # Because GNU Make first looks for GNUmakefile, which only includes this14 # forwarder, it will process this file before Makefile.15 # The Make Utility that we forward to will process Makefile.13 # Because GNU Make first looks for 'GNUmakefile', which only includes this 14 # forwarder, it will process this file before 'Makefile'. 15 # The Make Utility that we forward to will process 'Makefile'. 16 16 # 17 17 # Note that GNU Make processes the '%:' target-list sequentially. … … 21 21 # 22 22 # With wmake the targets are all specified in the Makefile so dependencies 23 # are resolved. With make each target is seperately forwarded to wmake,24 # so no dependencies are resolved. This means that a 'make rebuild clean'25 # behaves exactly like that, removing all just built targets,26 # because the 'clean' is performed last.27 # The'wmake rebuild clean' will not run the last 'clean' because 'rebuild'23 # are resolved. With GNU Make, each target is seperately forwarded to Makefile 24 # wmake, so no dependencies are resolved. 25 # This means that a 'make rebuild clean' behaves exactly like that, 26 # removing all just built targets, because the 'clean' is performed last. 27 # A 'wmake rebuild clean' will not run the last 'clean' because 'rebuild' 28 28 # runs it before doing the build, so 'clean' is considered up-to-date. 29 29 # -
trunk/INSTALL/C/.build
r45 r46 1 1 #!/bin/bash 2 2 3 make clean 3 make clean 4 4 make -
trunk/INSTALL/C/.clean
r45 r46 2 2 3 3 make clean 4 make -
trunk/INSTALL/C/INSTALL.C
r36 r46 17 17 // 18 18 19 #if defined(__OS2__) && !defined(OS2) 20 // OS/2 platform 21 #define INCL_NOPMAPI 22 #define INCL_BASE 23 #define INCL_DOS 24 #define INCL_DOSDEVIOCTL 25 #include <os2.h> 26 #include <malloc.h> 27 #include <stdlib.h> // Rousseau: added to use getenv() 28 #define PLATFORM_OS2 29 #elif defined(__NT__) 30 // Win32 platform 31 #include <windows.h> 32 #define PLATFORM_WINNT 33 #else 34 #error Unsupported platform 35 #endif 36 #include <ctype.h> 37 #include <stdio.h> 38 #include <conio.h> 39 #include <string.h> 40 41 42 #define STATUS_NOTINSTALLED 0 // No ID found 43 #define STATUS_CORRUPT 1 // ID found, Checksum failure 44 #define STATUS_INSTALLED 2 // ID found, Checksum valid 45 #define STATUS_INSTALLEDMGU 3 // ID found, Checksum valid, may get updated 46 #define STATUS_IMPOSSIBLE 4 // Unable/Not willing to install 47 48 /* Rousseau: added */ 49 #define GPT 0xEE // GPT Disk, AiR-BOOT will abort 50 #define BYTES_PER_SECTOR 512 // This could be higher in the future 51 #define IMAGE_SIZE_60SECS 30720 // Normal image-size (max. 30 partitions) 52 #define IMAGE_SIZE_62SECS 31744 // Extended image-size (max. 45 partitions) 53 //#define IMAGE_SIZE IMAGE_SIZE_60SECS // Use the normal image 54 #define IMAGE_SIZE IMAGE_SIZE_62SECS // Use the extended image 55 #define SECTOR_COUNT IMAGE_SIZE / BYTES_PER_SECTOR // Size of the image in sectors 56 #define CONFIG_OFFSET 0x6C00 // Byte offset of config-sector 57 #define SECTORS_BEFORE_CONFIG CONFIG_OFFSET / BYTES_PER_SECTOR // Nr of sectors before config-sector 19 20 21 #include "INSTALL.H" 58 22 59 23 … … 62 26 // Variables 63 27 // ============================================================================ 64 CHAR Track0[SECTOR_COUNT * BYTES_PER_SECTOR]; // current track 0 from harddrive 65 CHAR Bootcode[SECTOR_COUNT * BYTES_PER_SECTOR]; // bootcode image from airboot.bin 66 67 UCHAR Bootcode_LanguageID = ' '; 68 USHORT Bootcode_Version = 0; 69 USHORT Bootcode_ConfigVersion = 0; 70 71 UCHAR Status_Code = STATUS_NOTINSTALLED; 72 UCHAR Status_Config = STATUS_NOTINSTALLED; 73 USHORT Installed_CodeVersion = 0; 74 USHORT Installed_ConfigVersion = 0; 75 UCHAR Installed_LanguageID = ' '; 76 77 BOOL Option_ForceCode = FALSE; 78 BOOL Option_ForceConfig = FALSE; 79 BOOL Option_Silent = FALSE; 80 81 BOOL Option_CID = FALSE; // Rousseau: added 82 83 BOOL Install_Code = FALSE; 84 BOOL Install_Config = FALSE; 85 BOOL Install_IsCorrupt = FALSE; 86 87 USHORT StatusCode = 0; 88 PSZ ImpossibleCause = NULL; 28 29 30 31 //CHAR Track0[SECTOR_COUNT * BYTES_PER_SECTOR]; // current track 0 from harddrive 32 //CHAR Bootcode[SECTOR_COUNT * BYTES_PER_SECTOR]; // bootcode image from airboot.bin 33 34 /* 35 // With the addition of the C DOS-version, a static buffer for both 36 // Track0 and Bootcode would overflow the DGROUP segment. 37 // Placing the buffers in another segment would increase the executable 38 // image on disk, so we would like it to be (FAR) BSS data. 39 // 40 // When experimenting with segments and #pragma data_seg(), some 41 // strange behavior was observed. 42 // WCC: 43 // Explicitly naming a segment and class for the static buffers caused 44 // wcc to generate it's default SS: based addressing. 45 // Only the -zu flag corrects this. 46 // WPP: 47 // C++ wpp used correct addressing but the segment class in the #pragma 48 // was not honored and the segment name got mangled. 49 // 50 // In both cases the volatile (transient) data would occupy space in the 51 // disk-image because. 52 // The only way seems to be putting the buffers in a separate segment using 53 // pragma's, using wcc with the -zu flag and use the wlink ORDER directive 54 // to place the FAR BSS data above the stack acompanied by a NOEMIT modifier. 55 // For this all the class names of the previous segments must be included 56 // in the wlink ORDER directive which would make the link phase dependent 57 // on segment names. This solution does not work for wpp because it mangles 58 // the segment name and overrides the custom class name to FAR_DATA. 59 // 60 // So, these buffers are now dynamically allocated. 61 // Currently they are only freed after succesful program termination, 62 // but the RTS should free them in other situations. 63 // This will be corrected later. 64 */ 65 PCHAR Track0 = NULL; // Buffer for Track0 from harddisk. 66 PCHAR Bootcode = NULL; // Buffer for AIRBOOT.BIN image. 67 68 UCHAR Bootcode_LanguageID = ' '; 69 USHORT Bootcode_Version = 0; 70 USHORT Bootcode_ConfigVersion = 0; 71 72 UCHAR Status_Code = STATUS_NOTINSTALLED; 73 UCHAR Status_Config = STATUS_NOTINSTALLED; 74 USHORT Installed_CodeVersion = 0; 75 USHORT Installed_ConfigVersion = 0; 76 UCHAR Installed_LanguageID = ' '; 77 78 BOOL Option_ForceCode = FALSE; 79 BOOL Option_ForceConfig = FALSE; 80 BOOL Option_Silent = FALSE; 81 82 BOOL Option_CID = FALSE; // Rousseau: added 83 84 BOOL Install_Code = FALSE; 85 BOOL Install_Config = FALSE; 86 BOOL Install_IsCorrupt = FALSE; 87 88 USHORT StatusCode = 0; 89 PSZ ImpossibleCause = NULL; 90 91 92 93 94 95 96 // ============================================================================ 97 // Kidnapped bitfield functions needed to access the packed hideparttable 98 // ============================================================================ 99 100 /* 101 // Pragma's could be used to interface with the bitfield functions, but I was 102 // not in the mood to examine how they behave when conditions like calling 103 // convention, memory model, optimization, etc. are changed. Especially 104 // optimization generates very different code depending on the -o flags so 105 // it felt a bit 'fragile' to me to use them without further analysis. 106 // So I opted for the 'easy way' of some small prolog code to pass the 107 // parameters to the correct registers required by the core bitfield functions. 108 */ 109 110 111 //~ #ifdef __386__ 112 //~ #pragma aux __airboot "*___" parm caller [EBX] [EDX] [ECX] [EAX ESI EDI] value [AL]; 113 //~ #else 114 //~ #pragma aux __airboot "*___" parm caller [DI BX] [DX] [CX] [AX SI] value [AL]; 115 //~ #endif 116 //~ #pragma aux (__airboot) get_bitfield; 117 //~ #pragma aux (__airboot) set_bitfield; 118 119 /* Prototypes */ 120 void bf_test(); 121 char get_bitfield(char* buffer, char index, char fieldwidth); 122 char set_bitfield(char* buffer, char index, char fieldwidth, char value); 123 124 //~ #ifdef __386__ 125 //~ #pragma aux get_bitfield parm [EBX] [ECX] [EDX] value [AL]; 126 //~ #pragma aux set_bitfield parm [EBX] [ECX] [EDX] [EAX]; 127 //~ #else 128 //~ #pragma aux get_bitfield value [DL]; 129 //~ #pragma aux set_bitfield parm [BX] [CX] [DX] [AX]; 130 //~ #endif 131 132 133 134 // In 32-bit mode EBX is used and in 16-bit mode BX, so we abstract it's name. 135 // The rest of the bitfield code uses 16-bit registers because I kidnapped 136 // it from AiR-BOOT. 137 #define dataptr16 "BX" 138 #define dataptr32 "EBX" 139 #ifdef __386__ 140 #define dataptr dataptr32 141 #else 142 #define dataptr dataptr16 143 #endif 144 145 146 147 148 /* 149 // ---------------------------------------------------------------------------- 150 // bf_test -- Test function to analyse code generation 151 // ---------------------------------------------------------------------------- 152 */ 153 void bf_test() { 154 char* b1 = Track0; 155 char* b2 = Bootcode; 156 char i1 = 0x11; 157 char i2 = 0x12; 158 char v1 = 0x83; 159 char v2 = 0x84; 160 char rv1 = 0xf8; 161 char rv2 = 0xf9; 162 163 rv1 = get_bitfield(b1, i1, 6); 164 rv2 = set_bitfield(b2, i2, 6, v1+v2); 165 } 166 167 /* 168 // ---------------------------------------------------------------------------- 169 // do_bf_test -- Simple function to test the bitfield functions 170 // ---------------------------------------------------------------------------- 171 */ 172 void do_bf_test() { 173 char buf[512]; 174 int i; 175 176 for (i=0; i<100; i++) { 177 set_bitfield(buf, i, 6, i); 178 } 179 180 set_bitfield(buf, 18, 6, 255); 181 set_bitfield(buf, 21, 6, 255); 182 set_bitfield(buf, 33, 6, 255); 183 set_bitfield(buf, 37, 6, 255); 184 185 186 for (i=0; i<100; i++) { 187 printf("index: %02d, value: %02d\n", i, get_bitfield(buf, i, 6)); 188 } 189 return; 190 } 191 192 193 /* 194 // ---------------------------------------------------------------------------- 195 // get_bitfield -- Get a n-bit wide bitfield at index i from a buffer in memory 196 // ---------------------------------------------------------------------------- 197 // This is code kidnapped from AiR-BOOT and used here to handle the packed 198 // hideparttable. A 'record' in the hideparttable is 34 bytes long and it 199 // can store 45 partition numbers using 6-bits per partition number. 200 // Bitfield widths from 1 to 8 are supported and the maxumum buffersize is 201 // 256 bytes. 202 */ 203 char get_bitfield(char* buffer, char index, char fieldwidth) { 204 // These are used to break-up the far pointer in large-data model 16-bit 205 // code so the buffer can be addressed correctly. 206 // In 32-bit flat mode they will have no effect and in 32-bit large-data 207 // mode (imaginary) they can handle the buffer being in a seperate segment. 208 unsigned dseg = _FP_SEG(buffer); 209 unsigned dptr = _FP_OFF(buffer); 210 211 // Prolog code. 212 // Handle data-segment and parameters. 213 _asm { 214 push ds ; Save DS from caller. 215 push dseg ; Setup DS to 216 pop ds ; address our segment. (When 16-bit large data-model) 217 218 mov dl, index ; Index to bitfield in DL. 219 mov dh, fieldwidth ; Width of bitfield in DH. 220 mov dataptr, dptr ; Pointer in [E]BX. 221 } 222 223 224 // This is practically a verbatim copy of the core routine from CONV.ASM. 225 // Only a slight modification with regard to [E]BX addressing is made 226 // so it can also function in 32-bit mode. 227 _asm { 228 229 ; IN: DL = Index to store bitfield 230 ; DH = Bitfield width (1-8) 231 ; [E]BX = Pointer to bitfield array 232 ; OUT: AL = Value of requested bitfield 233 ; AH = Mask value 234 235 ; Normalize bit-width in DH. 236 dec dh ; Decrement bitfield width to mask invalid values. 237 and dh,07h ; Only 3 bits are significant to determine width. 238 mov cl,dh ; Save for later use to calculate mask. 239 inc dh ; Put back to normalized value. 240 241 ; Calculate corresponding AND-mask in CH. 242 mov ch,2 ; Were going to shift 2... 243 shl ch,cl ; to obtain the mask corresponding... 244 dec ch ; to the bitfield width. 245 246 ; Calculate byte-index. 247 mov al,dl ; Index in AL. 248 inc al ; Increment for calculations. 249 mul dh ; Multiply by bitfield width to get bits. 250 mov cl,8 ; Nr. of bits in a byte. 251 div cl ; Divide to get byte index. 252 253 ; Advance pointer to byte-index. 254 add bl,al ; Advance pointer... 255 adc bh,0 ; to byte index. 256 257 ; We have to 'carry on' to the high word of EBX if in 32-bit mode. 258 #ifdef __386__ 259 pushf ; Save the possible carry from the last addition. 260 ror ebx,16 ; Get high word of EBX in BX. 261 popf ; Restore possible carry. 262 adc bx,0 ; Add it and... 263 rol ebx,16 ; move back to have a valid 32-bit pointer again. 264 #endif 265 266 ; Determine if we need 1 or 2 byte access to extract the bitfield. 267 mov cl,ah ; Get remainder in CL. 268 sub cl,dh ; Substract bitfield width to get shift-count. 269 mov ah,0 ; Prepare upper=0 when field spans no byte bound. 270 ; Don't change to xor ah,ah or any CY will be lost. 271 272 ; Jump if the bitfield does not span byte boundaries. 273 ; (Remainder - bitfield width >= 0) 274 jae CONV_GetBitfieldValue_nospan 275 276 ; Bit-field spans byte boundaries, so adjust shift-count 277 ; and use AH to get first part of bitfield. 278 add cl,8 ; Adjust shift-count. 279 mov ah,[dataptr] ; Get byte into AH instead. 280 dec dataptr ; Adjust pointer to load rest of bitfield. 281 282 CONV_GetBitfieldValue_nospan: 283 mov al,[dataptr] ; Load (rest of) bitfield into AL. 284 shr ax,cl ; Shift bitfield to the right. 285 mov ah,ch ; Get mask in AH. 286 and al,ah ; Mask value. 287 ;ret 288 } 289 290 291 // Epilog code. 292 // Restore caller's DS. 293 _asm { 294 pop ds 295 } 296 297 return; 298 } 299 300 301 /* 302 // ---------------------------------------------------------------------------- 303 // set_bitfield -- Set a n-bit wide bitfield at index i in a buffer in memory 304 // ---------------------------------------------------------------------------- 305 // This is code kidnapped from AiR-BOOT and used here to handle the packed 306 // hideparttable. A 'record' in the hideparttable is 34 bytes long and it 307 // can store 45 partition numbers using 6-bits per partition number. 308 // Bitfield widths from 1 to 8 are supported and the maxumum buffersize is 309 // 256 bytes. 310 */ 311 char set_bitfield(char* buffer, char index, char fieldwidth, char value) { 312 313 // These are used to break-up the far pointer in large-data model 16-bit 314 // code so the buffer can be addressed correctly. 315 // In 32-bit flat mode they will have no effect and in 32-bit large-data 316 // mode (imaginary) they can handle the buffer being in a seperate segment. 317 unsigned dseg = _FP_SEG(buffer); 318 unsigned dptr = _FP_OFF(buffer); 319 320 321 // Prolog code. 322 // Handle data-segment and parameters. 323 _asm { 324 push ds ; Save DS from caller. 325 push dseg ; Setup DS to 326 pop ds ; address our segment. (When 16-bit large data-model) 327 328 mov dl, index ; Index to bitfield in DL. 329 mov dh, fieldwidth ; Width of bitfield in DH. 330 mov dataptr, dptr ; Pointer in [E]BX. 331 mov al, value ; Value we want to poke in AL. 332 } 333 334 335 // This is practically a verbatim copy of the core routine from CONV.ASM. 336 // Only a slight modification with regard to [E]BX addressing is made 337 // so it can also function in 32-bit mode. 338 _asm { 339 340 ; IN: AL = Value to store 341 ; DL = Index to store bitfield 342 ; DH = Bitfield width (1-8) 343 ; [E]BX = Pointer to bitfield array 344 ; OUT: AL = Value of stored bitfield 345 ; AH = Mask value 346 347 ; Push value for later use. 348 push ax 349 350 ; Normalize bit-width in DH. 351 dec dh ; Decrement bitfield width to mask invalid values. 352 and dh,07h ; Only 3 bits are significant to determine width. 353 mov cl,dh ; Save for later use to calculate mask. 354 inc dh ; Put back to normalized value. 355 356 ; Calculate corresponding AND-mask in CH. 357 mov ch,2 ; Were going to shift 2... 358 shl ch,cl ; to obtain the mask corresponding... 359 dec ch ; to the bitfield width. 360 361 ; Calculate byte-index. 362 mov al,dl ; Index in AL. 363 inc al ; Increment for calculations. 364 mul dh ; Multiply by bitfield width to get bits. 365 mov cl,8 ; Nr. of bits in a byte. 366 div cl ; Divide to get byte index. 367 368 ; Advance pointer to byte-index. 369 add bl,al ; Advance pointer... 370 adc bh,0 ; to byte index. 371 372 ; We have to 'carry on' to the high word of EBX if in 32-bit mode. 373 #ifdef __386__ 374 pushf ; Save the possible carry from the last addition. 375 ror ebx,16 ; Get high word of EBX in BX. 376 popf ; Restore possible carry. 377 adc bx,0 ; Add it and... 378 rol ebx,16 ; move back to have a valid 32-bit pointer again. 379 #endif 380 381 ; Determine if we need 1 or 2 byte access to extract the bitfield. 382 mov cl,ah ; Get remainder in CL. 383 sub cl,dh ; Substract bitfield width to get shift-count. 384 385 ; Restore value to poke. 386 pop ax 387 388 389 ; Jump if the bitfield does not span byte boundaries. 390 ; (Remainder - bitfield width >= 0) 391 jae CONV_SetBitfieldValue_nospan 392 393 ; Bit-field spans byte boundaries, so adjust shift-count 394 ; and use 16-bit access. 395 add cl,8 ; Adjust shift-count. 396 397 ; Merge the bitfield to the array. 398 push cx ; Save mask (CH) and shift-count (CL). 399 push ax ; Save value to store. 400 xor ah,ah ; Clear upper byte so we can shift in it. 401 and al,ch ; Mask value. 402 shl ax,cl ; Move the bitfield to the proper location. 403 mov dh,[dataptr] ; Get 1st part of bitfield from array. 404 dec dataptr ; Adjust pointer. 405 mov dl,[dataptr] ; Get 2nd part of bitfield from array. 406 push bx ; We need BX so save it. 407 xor bh,bh ; Clear upper byte so we can shift in it. 408 mov bl,ch ; Put mask in BL. 409 shl bx,cl ; Shift mask to proper location. 410 not bx ; Complement it to mask-out the required bitfield. 411 and dx,bx ; Mask-out the required bitfield. 412 pop bx ; Restore pointer. 413 or ax,dx ; Merge the bitfields. 414 mov [dataptr],al ; Store lower byte. 415 inc dataptr ; Adjust pointer. 416 mov [dataptr],ah ; Store upper byte. 417 pop ax ; Restore value. 418 pop cx ; Restore mask and shift-count. 419 420 ; Done. 421 jmp CONV_SetBitfieldValue_end 422 423 CONV_SetBitfieldValue_nospan: 424 ; Merge the bitfield to the array. 425 push cx ; Save mask (CH) and shift-count (CL). 426 push ax ; Save value to store. 427 and al,ch ; Mask value. 428 shl al,cl ; Move the bitfield to the proper location. 429 mov dl,[dataptr] ; Get byte containing bitfield. 430 shl ch,cl ; Shift mask to proper location. 431 not ch ; Complement it to mask-out the required bitfield. 432 and dl,ch ; Mask-out the required bitfield. 433 or al,dl ; Merge the bitfields. 434 mov [dataptr],al ; Store byte containing bitfield. 435 pop ax ; Restore value. 436 pop cx ; Restore mask and shift-count. 437 438 CONV_SetBitfieldValue_end: 439 mov ah,ch ; Get mask in AH. 440 and al,ah ; Mask value. 441 ;ret 442 } 443 444 // Epilog code. 445 // Restore caller's DS. 446 _asm { 447 pop ds 448 } 449 450 return value; 451 } 452 453 454 455 456 457 458 89 459 90 460 // ============================================================================ 91 461 // Platform-specific helper functions 92 462 // ============================================================================ 93 #ifdef PLATFORM_OS2 94 USHORT CountHarddrives (void) { 95 USHORT NumDrives = 0; 96 97 if (DosPhysicalDisk(INFO_COUNT_PARTITIONABLE_DISKS, &NumDrives, sizeof(NumDrives),NULL, 0) != 0) 98 return 0; 99 return NumDrives; 100 } 101 102 USHORT OS2_GetIOCTLHandle () { 103 USHORT IOCTLHandle = 0; 104 105 if (DosPhysicalDisk(INFO_GETIOCTLHANDLE, &IOCTLHandle, sizeof(IOCTLHandle),"1:" , 3) != 0) 106 return 0; 107 return IOCTLHandle; 108 } 109 110 void OS2_FreeIOCTLHandle (USHORT IOCTLHandle) { 111 DosPhysicalDisk(INFO_FREEIOCTLHANDLE, NULL, 0, &IOCTLHandle, sizeof(IOCTLHandle)); 112 return; 113 } 114 115 // Special feature for OS/2, finds out boot drive letter and sends this 116 // information to AiR-BOOT, so that it's able to set that information 117 // during boot phase. Otherwise the user would have to set this. 118 UCHAR AutoDriveLetter = ' '; 119 ULONG AutoDriveLetterSerial = 0; 120 121 void OS2_GetBootAutoDriveLetter (void) { 122 ULONG BootDrive; 123 struct { 124 ULONG ulVSN; 125 VOLUMELABEL vol; 126 } InfoLevel2; 127 DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &BootDrive, sizeof(BootDrive)); 128 // BootDrive - 1-A:, 2-B:, 3-C: 129 if ((BootDrive>2) & (!DosQueryFSInfo(BootDrive, FSIL_VOLSER, (PVOID)(&InfoLevel2), sizeof(InfoLevel2)))) { 130 AutoDriveLetter = BootDrive+0x7D; 131 AutoDriveLetterSerial = InfoLevel2.ulVSN; 132 if (!Option_CID) { 133 printf("%X\n", InfoLevel2.ulVSN); 134 } 135 } 136 } 137 138 BOOL HarddriveCheckGeometry (void) { 139 USHORT IOCTLHandle; 140 USHORT SectorsPerTrack = 0; 141 DEVICEPARAMETERBLOCK DeviceParmBlock; 142 ULONG ulDataLength; 143 144 IOCTLHandle = OS2_GetIOCTLHandle(); 145 146 if (!DosDevIOCtl(IOCTLHandle, IOCTL_PHYSICALDISK, PDSK_GETPHYSDEVICEPARAMS, NULL, 0, NULL, &DeviceParmBlock, sizeof(DeviceParmBlock), &ulDataLength)) 147 SectorsPerTrack = DeviceParmBlock.cSectorsPerTrack; 148 OS2_FreeIOCTLHandle (IOCTLHandle); 149 //if (SectorsPerTrack > 61) return TRUE; // >60 should also be ok for normal image (60 for image 1 for lvm) 150 if (SectorsPerTrack > SECTOR_COUNT) return TRUE; // Note: This is 1 sector smaller than above !! 151 // OS/2 is only able to support 512-byte/sector media, so we dont need to check this 152 return FALSE; 153 } 154 155 BOOL Track0Load (void) { 156 USHORT IOCTLHandle; 157 ULONG TrackLayoutLen = sizeof(TRACKLAYOUT)+sizeof(ULONG)*(SECTOR_COUNT-1); 158 TRACKLAYOUT *TrackLayoutPtr = malloc(TrackLayoutLen); 159 ULONG cbParms = sizeof(TrackLayoutPtr); 160 ULONG cbData = BYTES_PER_SECTOR; 161 int i; 162 BOOL Success = FALSE; 163 164 IOCTLHandle = OS2_GetIOCTLHandle(); 165 166 TrackLayoutPtr->bCommand = 0x01; 167 TrackLayoutPtr->usHead = 0; 168 TrackLayoutPtr->usCylinder = 0; 169 TrackLayoutPtr->usFirstSector = 0; 170 TrackLayoutPtr->cSectors = SECTOR_COUNT; 171 172 for (i=0; i<SECTOR_COUNT; i++) { 173 TrackLayoutPtr->TrackTable[i].usSectorNumber = i+1; 174 TrackLayoutPtr->TrackTable[i].usSectorSize = BYTES_PER_SECTOR; 175 } 176 177 if (!DosDevIOCtl(IOCTLHandle, IOCTL_PHYSICALDISK, PDSK_READPHYSTRACK, 178 TrackLayoutPtr, cbParms, &cbParms, &Track0, cbData, &cbData)) 179 Success = TRUE; 180 OS2_FreeIOCTLHandle (IOCTLHandle); 181 free (TrackLayoutPtr); 182 return Success; 183 } 184 185 BOOL Track0Write (void) { 186 USHORT IOCTLHandle; 187 ULONG TrackLayoutLen = sizeof(TRACKLAYOUT)+sizeof(ULONG)*(SECTOR_COUNT-1); 188 TRACKLAYOUT *TrackLayoutPtr = malloc(TrackLayoutLen); 189 ULONG cbParms = sizeof(TrackLayoutPtr); 190 ULONG cbData = BYTES_PER_SECTOR; 191 INT i; 192 BOOL Success = FALSE; 193 194 IOCTLHandle = OS2_GetIOCTLHandle(); 195 196 197 TrackLayoutPtr->bCommand = 0x01; 198 TrackLayoutPtr->usHead = 0; 199 TrackLayoutPtr->usCylinder = 0; 200 TrackLayoutPtr->usFirstSector = 0; 201 TrackLayoutPtr->cSectors = SECTOR_COUNT; 202 203 for (i=0; i<SECTOR_COUNT; i++) { 204 TrackLayoutPtr->TrackTable[i].usSectorNumber = i+1; 205 TrackLayoutPtr->TrackTable[i].usSectorSize = BYTES_PER_SECTOR; 206 } 207 208 if (!DosDevIOCtl(IOCTLHandle, IOCTL_PHYSICALDISK, PDSK_WRITEPHYSTRACK, 209 TrackLayoutPtr, cbParms, &cbParms, &Track0, cbData, &cbData)) 210 Success = TRUE; 211 OS2_FreeIOCTLHandle (IOCTLHandle); 212 free (TrackLayoutPtr); 213 return Success; 214 } 215 216 #define CATEGORY_DOSSYS 0xD5 217 #define FUNCTION_REBOOT 0xAB 218 219 void RebootSystem (void) { 220 HFILE DosHandle; 221 ULONG DosOpenAction; 222 223 DosSleep (2000); 224 if (!DosOpen("DOS$", &DosHandle, &DosOpenAction, 0, FILE_NORMAL, FILE_OPEN, OPEN_ACCESS_READWRITE|OPEN_SHARE_DENYNONE, NULL)) { 225 DosDevIOCtl(DosHandle, CATEGORY_DOSSYS, FUNCTION_REBOOT, NULL, 0, NULL, NULL, 0, NULL); 226 DosSleep (60000); 227 } 228 DosClose(DosHandle); 229 } 463 464 465 /* 466 // Helper functions -- DOS implementation. 467 */ 468 #ifdef PLATFORM_DOS 469 USHORT CountHarddrives (void) { 470 USHORT NumDrives = 0; 471 // Implement ! 472 return NumDrives; 473 } 474 475 USHORT OS2_GetIOCTLHandle () { 476 USHORT IOCTLHandle = 0; 477 // Implement ! 478 return IOCTLHandle; 479 } 480 481 void OS2_FreeIOCTLHandle (USHORT IOCTLHandle) { 482 // Implement ! 483 return; 484 } 485 486 487 BOOL HarddriveCheckGeometry (void) { 488 USHORT IOCTLHandle; 489 490 IOCTLHandle = OS2_GetIOCTLHandle(); 491 // Implement ! 492 return FALSE; 493 } 494 495 BOOL Track0Load (void) { 496 USHORT IOCTLHandle; 497 BOOL Success = FALSE; 498 499 IOCTLHandle = OS2_GetIOCTLHandle(); 500 // Implement ! 501 return Success; 502 } 503 504 BOOL Track0Write (void) { 505 USHORT IOCTLHandle; 506 BOOL Success = FALSE; 507 508 IOCTLHandle = OS2_GetIOCTLHandle(); 509 // Implement ! 510 return Success; 511 } 512 513 void RebootSystem (void) { 514 515 // Implement ! 516 } 517 230 518 #endif 231 519 232 #ifdef PLATFORM_WINNT 233 // Checks, if we are under NT 234 BOOL CheckWindowsVersion (void) { 235 OSVERSIONINFO Version; 236 Version.dwOSVersionInfoSize = sizeof(Version); 237 GetVersionEx(&Version); 238 if (Version.dwPlatformId == VER_PLATFORM_WIN32_NT) return TRUE; 239 if (!Option_CID) { 240 printf(" - This installer is for WindowsNT family only.\n"); 241 printf(" Please use DOS installer for Windows9x.\n"); 242 } 243 return FALSE; 244 } 245 246 247 HANDLE WINNT_GetIOCTLHandle (void) { 248 return CreateFile("\\\\.\\physicaldrive0", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0); 249 } 250 251 void WINNT_FreeIOCTLHandle (HANDLE IOCTLHandle) { 252 CloseHandle(IOCTLHandle); 253 } 254 255 USHORT CountHarddrives (void) { 256 return 1; 257 } 258 259 BOOL HarddriveCheckGeometry (void) { 260 HANDLE IOCTLHandle; 261 DISK_GEOMETRY Geometry; 262 USHORT SectorsPerTrack = 0; 263 DWORD Dummy; 264 265 IOCTLHandle = WINNT_GetIOCTLHandle(); 266 if (DeviceIoControl(IOCTLHandle, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &Geometry, sizeof(Geometry), &Dummy, NULL)) 267 SectorsPerTrack = Geometry.SectorsPerTrack; 268 WINNT_FreeIOCTLHandle(IOCTLHandle); 269 //if (SectorsPerTrack > 61) return TRUE; // >60 should also be ok for normal image (60 for image 1 for lvm) 270 if (SectorsPerTrack > SECTOR_COUNT) return TRUE; // Note: This is 1 sector smaller than above !! 271 return FALSE; 272 } 273 274 BOOL Track0Load (void) { 275 HANDLE IOCTLHandle; 276 DWORD BytesRead = 0; 277 BOOL Success = FALSE; 278 279 IOCTLHandle = WINNT_GetIOCTLHandle(); 280 SetFilePointer(IOCTLHandle, 0, 0, FILE_BEGIN); 281 if (ReadFile(IOCTLHandle, &Track0, SECTOR_COUNT * BYTES_PER_SECTOR, &BytesRead, NULL)) 282 Success = TRUE; 283 WINNT_FreeIOCTLHandle(IOCTLHandle); 284 return Success; 285 } 286 287 BOOL Track0Write (void) { 288 HANDLE IOCTLHandle; 289 DWORD BytesWritten = 0; 290 BOOL Success = FALSE; 291 292 IOCTLHandle = WINNT_GetIOCTLHandle(); 293 SetFilePointer(IOCTLHandle, 0, 0, FILE_BEGIN); 294 if (WriteFile(IOCTLHandle, &Track0, SECTOR_COUNT * BYTES_PER_SECTOR, &BytesWritten, NULL)) 295 Success = TRUE; 296 WINNT_FreeIOCTLHandle(IOCTLHandle); 297 return Success; 298 } 299 300 void RebootSystem (void) { 301 HANDLE token; 302 TOKEN_PRIVILEGES tokenpriv; 303 OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &token); 304 LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tokenpriv.Privileges[0].Luid); 305 tokenpriv.PrivilegeCount = 1; 306 tokenpriv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; 307 AdjustTokenPrivileges(token, FALSE, &tokenpriv, 0, NULL, 0); 308 ExitWindowsEx(EWX_REBOOT, 0); 520 521 522 /* 523 // Helper functions -- OS/2 implementation. 524 */ 525 #ifdef PLATFORM_OS2 526 USHORT CountHarddrives (void) { 527 USHORT NumDrives = 0; 528 if (DosPhysicalDisk(INFO_COUNT_PARTITIONABLE_DISKS, &NumDrives, sizeof(NumDrives),NULL, 0) != 0) 529 return 0; 530 return NumDrives; 531 } 532 533 USHORT OS2_GetIOCTLHandle () { 534 USHORT IOCTLHandle = 0; 535 if (DosPhysicalDisk(INFO_GETIOCTLHANDLE, &IOCTLHandle, sizeof(IOCTLHandle),"1:" , 3) != 0) 536 return 0; 537 return IOCTLHandle; 538 } 539 540 void OS2_FreeIOCTLHandle (USHORT IOCTLHandle) { 541 DosPhysicalDisk(INFO_FREEIOCTLHANDLE, NULL, 0, &IOCTLHandle, sizeof(IOCTLHandle)); 542 return; 543 } 544 545 // Special feature for OS/2, finds out boot drive letter and sends this 546 // information to AiR-BOOT, so that it's able to set that information 547 // during boot phase. Otherwise the user would have to set this. 548 UCHAR AutoDriveLetter = ' '; 549 ULONG AutoDriveLetterSerial = 0; 550 551 void OS2_GetBootAutoDriveLetter (void) { 552 ULONG BootDrive; 553 struct { 554 ULONG ulVSN; 555 VOLUMELABEL vol; 556 } InfoLevel2; 557 DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &BootDrive, sizeof(BootDrive)); 558 // BootDrive - 1-A:, 2-B:, 3-C: 559 if ((BootDrive>2) & (!DosQueryFSInfo(BootDrive, FSIL_VOLSER, (PVOID)(&InfoLevel2), sizeof(InfoLevel2)))) { 560 AutoDriveLetter = (UCHAR) BootDrive+0x7D; 561 AutoDriveLetterSerial = InfoLevel2.ulVSN; 562 if (!Option_CID) { 563 printf("%X\n", InfoLevel2.ulVSN); 564 } 565 } 566 } 567 568 BOOL HarddriveCheckGeometry (void) { 569 USHORT IOCTLHandle; 570 USHORT SectorsPerTrack = 0; 571 DEVICEPARAMETERBLOCK DeviceParmBlock; 572 ULONG ulDataLength; 573 574 IOCTLHandle = OS2_GetIOCTLHandle(); 575 576 if (!DosDevIOCtl(IOCTLHandle, IOCTL_PHYSICALDISK, PDSK_GETPHYSDEVICEPARAMS, NULL, 0, NULL, &DeviceParmBlock, sizeof(DeviceParmBlock), &ulDataLength)) 577 SectorsPerTrack = DeviceParmBlock.cSectorsPerTrack; 578 OS2_FreeIOCTLHandle (IOCTLHandle); 579 //if (SectorsPerTrack > 61) return TRUE; // >60 should also be ok for normal image (60 for image 1 for lvm) 580 if (SectorsPerTrack > SECTOR_COUNT) return TRUE; // Note: This is 1 sector smaller than above !! 581 // OS/2 is only able to support 512-byte/sector media, so we dont need to check this 582 return FALSE; 583 } 584 585 BOOL Track0Load (void) { 586 USHORT IOCTLHandle; 587 ULONG TrackLayoutLen = sizeof(TRACKLAYOUT)+sizeof(ULONG)*(SECTOR_COUNT-1); 588 TRACKLAYOUT *TrackLayoutPtr = (TRACKLAYOUT*) malloc(TrackLayoutLen); 589 ULONG cbParms = sizeof(TrackLayoutPtr); 590 ULONG cbData = BYTES_PER_SECTOR; 591 int i; 592 BOOL Success = FALSE; 593 594 IOCTLHandle = OS2_GetIOCTLHandle(); 595 596 TrackLayoutPtr->bCommand = 0x01; 597 TrackLayoutPtr->usHead = 0; 598 TrackLayoutPtr->usCylinder = 0; 599 TrackLayoutPtr->usFirstSector = 0; 600 TrackLayoutPtr->cSectors = SECTOR_COUNT; 601 602 for (i=0; i<SECTOR_COUNT; i++) { 603 TrackLayoutPtr->TrackTable[i].usSectorNumber = i+1; 604 TrackLayoutPtr->TrackTable[i].usSectorSize = BYTES_PER_SECTOR; 605 } 606 607 if (!DosDevIOCtl(IOCTLHandle, IOCTL_PHYSICALDISK, PDSK_READPHYSTRACK, 608 TrackLayoutPtr, cbParms, &cbParms, Track0, cbData, &cbData)) 609 Success = TRUE; 610 611 OS2_FreeIOCTLHandle (IOCTLHandle); 612 free (TrackLayoutPtr); 613 return Success; 614 } 615 616 BOOL Track0Write (void) { 617 USHORT IOCTLHandle; 618 ULONG TrackLayoutLen = sizeof(TRACKLAYOUT)+sizeof(ULONG)*(SECTOR_COUNT-1); 619 TRACKLAYOUT *TrackLayoutPtr = (TRACKLAYOUT*) malloc(TrackLayoutLen); 620 ULONG cbParms = sizeof(TrackLayoutPtr); 621 ULONG cbData = BYTES_PER_SECTOR; 622 INT i; 623 BOOL Success = FALSE; 624 625 IOCTLHandle = OS2_GetIOCTLHandle(); 626 627 628 TrackLayoutPtr->bCommand = 0x01; 629 TrackLayoutPtr->usHead = 0; 630 TrackLayoutPtr->usCylinder = 0; 631 TrackLayoutPtr->usFirstSector = 0; 632 TrackLayoutPtr->cSectors = SECTOR_COUNT; 633 634 for (i=0; i<SECTOR_COUNT; i++) { 635 TrackLayoutPtr->TrackTable[i].usSectorNumber = i+1; 636 TrackLayoutPtr->TrackTable[i].usSectorSize = BYTES_PER_SECTOR; 637 } 638 639 if (!DosDevIOCtl(IOCTLHandle, IOCTL_PHYSICALDISK, PDSK_WRITEPHYSTRACK, 640 TrackLayoutPtr, cbParms, &cbParms, Track0, cbData, &cbData)) 641 Success = TRUE; 642 643 OS2_FreeIOCTLHandle (IOCTLHandle); 644 free (TrackLayoutPtr); 645 return Success; 646 } 647 648 #define CATEGORY_DOSSYS 0xD5 649 #define FUNCTION_REBOOT 0xAB 650 651 void RebootSystem (void) { 652 HFILE DosHandle; 653 ULONG DosOpenAction; 654 655 DosSleep (2000); 656 if (!DosOpen("DOS$", &DosHandle, &DosOpenAction, 0, FILE_NORMAL, FILE_OPEN, OPEN_ACCESS_READWRITE|OPEN_SHARE_DENYNONE, NULL)) { 657 DosDevIOCtl(DosHandle, CATEGORY_DOSSYS, FUNCTION_REBOOT, NULL, 0, NULL, NULL, 0, NULL); 658 DosSleep (60000); 659 } 660 DosClose(DosHandle); 309 661 } 310 662 #endif 311 663 664 665 666 667 /* 668 // Helper functions -- Win32 implementation. 669 */ 670 #ifdef PLATFORM_WINNT 671 // Checks, if we are under NT 672 BOOL CheckWindowsVersion (void) { 673 OSVERSIONINFO Version; 674 Version.dwOSVersionInfoSize = sizeof(Version); 675 GetVersionEx(&Version); 676 if (Version.dwPlatformId == VER_PLATFORM_WIN32_NT) 677 return TRUE; 678 if (!Option_CID) { 679 printf(" - This installer is for WindowsNT family only.\n"); 680 printf(" Please use DOS installer for Windows9x.\n"); 681 } 682 return FALSE; 683 } 684 685 686 HANDLE WINNT_GetIOCTLHandle (void) { 687 return CreateFile("\\\\.\\physicaldrive0", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0); 688 } 689 690 void WINNT_FreeIOCTLHandle (HANDLE IOCTLHandle) { 691 CloseHandle(IOCTLHandle); 692 } 693 694 USHORT CountHarddrives (void) { 695 return 1; 696 } 697 698 BOOL HarddriveCheckGeometry (void) { 699 HANDLE IOCTLHandle; 700 DISK_GEOMETRY Geometry; 701 USHORT SectorsPerTrack = 0; 702 DWORD Dummy; 703 704 IOCTLHandle = WINNT_GetIOCTLHandle(); 705 if (DeviceIoControl(IOCTLHandle, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &Geometry, sizeof(Geometry), &Dummy, NULL)) 706 SectorsPerTrack = (USHORT) Geometry.SectorsPerTrack; 707 WINNT_FreeIOCTLHandle(IOCTLHandle); 708 //if (SectorsPerTrack > 61) return TRUE; // >60 should also be ok for normal image (60 for image 1 for lvm) 709 if (SectorsPerTrack > SECTOR_COUNT) 710 return TRUE; // Note: This is 1 sector smaller than above !! 711 712 return FALSE; 713 } 714 715 BOOL Track0Load (void) { 716 HANDLE IOCTLHandle; 717 DWORD BytesRead = 0; 718 BOOL Success = FALSE; 719 720 IOCTLHandle = WINNT_GetIOCTLHandle(); 721 SetFilePointer(IOCTLHandle, 0, 0, FILE_BEGIN); 722 if (ReadFile(IOCTLHandle, Track0, SECTOR_COUNT * BYTES_PER_SECTOR, &BytesRead, NULL)) 723 Success = TRUE; 724 WINNT_FreeIOCTLHandle(IOCTLHandle); 725 return Success; 726 } 727 728 BOOL Track0Write (void) { 729 HANDLE IOCTLHandle; 730 DWORD BytesWritten = 0; 731 BOOL Success = FALSE; 732 733 IOCTLHandle = WINNT_GetIOCTLHandle(); 734 SetFilePointer(IOCTLHandle, 0, 0, FILE_BEGIN); 735 if (WriteFile(IOCTLHandle, Track0, SECTOR_COUNT * BYTES_PER_SECTOR, &BytesWritten, NULL)) 736 Success = TRUE; 737 WINNT_FreeIOCTLHandle(IOCTLHandle); 738 return Success; 739 } 740 741 void RebootSystem (void) { 742 HANDLE token; 743 TOKEN_PRIVILEGES tokenpriv; 744 OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &token); 745 LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tokenpriv.Privileges[0].Luid); 746 tokenpriv.PrivilegeCount = 1; 747 tokenpriv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; 748 AdjustTokenPrivileges(token, FALSE, &tokenpriv, 0, NULL, 0); 749 ExitWindowsEx(EWX_REBOOT, 0); 750 } 751 #endif 752 753 754 /* 755 // Helper functions -- Linux implementation. 756 */ 757 #ifdef PLATFORM_LINUX 758 USHORT CountHarddrives (void) { 759 USHORT NumDrives = 0; 760 // Implement ! 761 return NumDrives; 762 } 763 764 USHORT OS2_GetIOCTLHandle () { 765 USHORT IOCTLHandle = 0; 766 // Implement ! 767 return IOCTLHandle; 768 } 769 770 void OS2_FreeIOCTLHandle (USHORT IOCTLHandle) { 771 // Implement ! 772 return; 773 } 774 775 776 BOOL HarddriveCheckGeometry (void) { 777 USHORT IOCTLHandle; 778 779 IOCTLHandle = OS2_GetIOCTLHandle(); 780 // Implement ! 781 return FALSE; 782 } 783 784 BOOL Track0Load (void) { 785 USHORT IOCTLHandle; 786 BOOL Success = FALSE; 787 788 IOCTLHandle = OS2_GetIOCTLHandle(); 789 // Implement ! 790 return Success; 791 } 792 793 BOOL Track0Write (void) { 794 USHORT IOCTLHandle; 795 BOOL Success = FALSE; 796 797 IOCTLHandle = OS2_GetIOCTLHandle(); 798 // Implement ! 799 return Success; 800 } 801 802 void RebootSystem (void) { 803 804 // Implement ! 805 } 806 807 #endif 808 809 810 811 812 813 // ============================================================================ 814 // Common Code 815 // ============================================================================ 816 817 312 818 USHORT GetChecksumOfSector (USHORT Checksum, PCHAR SectorPtr) { 313 PUSHORT TempPtr = (PUSHORT)SectorPtr; 314 USHORT i; 315 for (i=0; i<256; i++) { 316 Checksum = *TempPtr ^ 0xBABE ^ Checksum; 317 TempPtr++; 318 } 319 if (Checksum==0) Checksum = 1; 320 return Checksum; 321 } 819 PUSHORT TempPtr = (PUSHORT)SectorPtr; 820 USHORT i; 821 for (i=0; i<256; i++) { 822 Checksum = *TempPtr ^ 0xBABE ^ Checksum; 823 TempPtr++; 824 } 825 if (Checksum==0) 826 Checksum = 1; 827 return Checksum; 828 } 322 829 323 830 // Loads airboot.bin into memory (if possible) and sets some variables 324 831 // also makes sure that airboot.bin has correct length 325 832 BOOL LoadBootcodeFromFile (void) { 326 FILE *FileHandle = NULL; 327 ULONG BootcodeSize = 0; 328 329 FileHandle = fopen("airboot.bin", "rb"); 330 if (!FileHandle) { 331 if (!Option_CID) { 332 printf("airboot.bin not found\n"); 333 } 334 return FALSE; 335 } 336 // Read whole file into memory... 337 fseek (FileHandle, 0, SEEK_END); 338 BootcodeSize = ftell(FileHandle); 339 if (BootcodeSize!=IMAGE_SIZE) { 340 fclose (FileHandle); 341 if (!Option_CID) { 342 printf("Invalid airboot.bin\n"); 343 } 344 return FALSE; 345 } 346 fseek (FileHandle, 0, SEEK_SET); 347 fread (&Bootcode, 1, IMAGE_SIZE, FileHandle); 348 fclose (FileHandle); 349 350 // Read airboot.bin failed 351 352 Bootcode_Version = (Bootcode[13] << 8) | Bootcode[14]; 353 Bootcode_LanguageID = Bootcode[15]; 354 Bootcode_ConfigVersion = (Bootcode[0x6C0D] << 8) | Bootcode[0x6C0E]; 355 return TRUE; 356 } 833 FILE *FileHandle = NULL; 834 ULONG BootcodeSize = 0; 835 836 // Try to open file... 837 FileHandle = fopen(IMAGE_NAME, "rb"); 838 if (!FileHandle) { 839 if (!Option_CID) { 840 printf("%s not found\n", IMAGE_NAME); 841 } 842 return FALSE; 843 } 844 845 // Seek to end of file to determine image size... 846 fseek (FileHandle, 0, SEEK_END); 847 BootcodeSize = ftell(FileHandle); 848 if (BootcodeSize!=IMAGE_SIZE) { 849 fclose (FileHandle); 850 if (!Option_CID) { 851 printf("Invalid %sn\n", IMAGE_NAME); 852 } 853 return FALSE; 854 } 855 856 // Read whole file into memory... 857 fseek (FileHandle, 0, SEEK_SET); 858 fread (Bootcode, 1, IMAGE_SIZE, FileHandle); 859 fclose (FileHandle); 860 861 // Extract language and version info... 862 Bootcode_Version = (Bootcode[13] << 8) | Bootcode[14]; 863 Bootcode_LanguageID = Bootcode[15]; 864 Bootcode_ConfigVersion = (Bootcode[0x6C0D] << 8) | Bootcode[0x6C0E]; 865 return TRUE; 866 } 357 867 358 868 /** … … 362 872 */ 363 873 void Status_CheckCode (void) { 364 USHORT TotalCodeSectorsUsed = 0; 365 USHORT Checksum = 0; 366 PCHAR SectorPtr = NULL; 367 368 if (Status_Code==STATUS_IMPOSSIBLE) return; 369 // EZ-Setup check! 370 Status_Code = STATUS_NOTINSTALLED; 371 if ((Track0[0x1FE]!=0x55) || (Track0[0x1FF]!=0xAA)) return; // No MBR signature found, so not installed 372 if (strncmp(&Track0[2], "AiRBOOT", 7)!=0) return; // No AiR-BOOT signature found, so not installed 373 // MBR and AiR-BOOT signature found... 374 TotalCodeSectorsUsed = Track0[0x10]; // 34h/52 in v1.06 375 SectorPtr = &Track0[1 * BYTES_PER_SECTOR]; // Start at sector 2 376 // Calculate checksum of code-sectors 377 while (TotalCodeSectorsUsed>0) { 378 Checksum = GetChecksumOfSector(Checksum, SectorPtr); 379 SectorPtr += BYTES_PER_SECTOR; 380 TotalCodeSectorsUsed--; 381 } 382 if (Checksum!=*(PUSHORT)&Track0[0x11]) { 383 Status_Code = STATUS_CORRUPT; return; // Bad checksum for code 384 } 385 // Checksum fine... 386 Installed_LanguageID = Track0[0x0F]; 387 Installed_CodeVersion = (Track0[0x0D] << 8) | Track0[0x0E]; 388 if (Installed_CodeVersion<Bootcode_Version) 389 Status_Code = STATUS_INSTALLEDMGU; // Do upgrade 390 else 391 Status_Code = STATUS_INSTALLED; // Same version installed 392 } 874 USHORT TotalCodeSectorsUsed = 0; 875 USHORT Checksum = 0; 876 PCHAR SectorPtr = NULL; 877 878 if (Status_Code==STATUS_IMPOSSIBLE) 879 return; 880 // EZ-Setup check! 881 Status_Code = STATUS_NOTINSTALLED; 882 if ((Track0[0x1FE]!=0x55) || (Track0[0x1FF]!=0xAA)) 883 return; // No MBR signature found, so not installed 884 if (strncmp(&Track0[2], "AiRBOOT", 7)!=0) 885 return; // No AiR-BOOT signature found, so not installed 886 // MBR and AiR-BOOT signature found... 887 TotalCodeSectorsUsed = Track0[0x10]; // 34h/52 in v1.06 888 SectorPtr = &Track0[1 * BYTES_PER_SECTOR]; // Start at sector 2 889 // Calculate checksum of code-sectors 890 while (TotalCodeSectorsUsed>0) { 891 Checksum = GetChecksumOfSector(Checksum, SectorPtr); 892 SectorPtr += BYTES_PER_SECTOR; 893 TotalCodeSectorsUsed--; 894 } 895 if (Checksum!=*(PUSHORT)&Track0[0x11]) { 896 Status_Code = STATUS_CORRUPT; 897 return; // Bad checksum for code 898 } 899 // Checksum fine... 900 Installed_LanguageID = Track0[0x0F]; 901 Installed_CodeVersion = (Track0[0x0D] << 8) | Track0[0x0E]; 902 if (Installed_CodeVersion<Bootcode_Version) 903 Status_Code = STATUS_INSTALLEDMGU; // Do upgrade 904 else 905 Status_Code = STATUS_INSTALLED; // Same version installed 906 907 return; 908 } 393 909 394 910 395 911 void Status_CheckConfig (void) { 396 PCHAR ConfigSectorPtr = &Track0[CONFIG_OFFSET]; // Config sector offset hard-coded ! 397 PCHAR SectorPtr = NULL; 398 USHORT Checksum = 0; 399 USHORT ConfigChecksum = 0; 400 USHORT SectorCount = 0; 401 402 /* 403 // Note that the 'AiRCFG-TABLE' string includes the invisible 0xAD char. 404 */ 405 if (strncmp(ConfigSectorPtr, "AiRCFG-TABLE", 13)==0) { 406 // AiR-BOOT signature found... 407 SectorPtr = &Track0[54 * BYTES_PER_SECTOR]; // Start at sector 55 408 ConfigChecksum = *(PUSHORT)&Track0[54 * BYTES_PER_SECTOR + 20]; 409 // Remove checksum 410 *(PUSHORT)&Track0[54 * BYTES_PER_SECTOR + 20] = 0; // Config sector secnum hard-coded ! 411 412 /* 413 // Rousseau: # Keep compatible with v1.07 CRC # 414 // AB v1.07 had bugs in writing the wrong number of AB config sectors. 415 // This is fixed in v1.0.8 but the CRC has to be calculated the "v1.07 way" 416 // otherwise v1.07 SET(A)BOOT and INSTALL2.EXE will think the AB config 417 // is corrupted. 418 // So the CRC is calculated over 5 sectors instead of 7. 419 */ 420 SectorCount = 5; 421 422 while (SectorCount>0) { 423 Checksum = GetChecksumOfSector(Checksum, SectorPtr); 424 SectorPtr += BYTES_PER_SECTOR; 425 SectorCount--; 426 } 427 // Restore checksum 428 *(PUSHORT)&Track0[54 * BYTES_PER_SECTOR + 20] = ConfigChecksum; // Config sector secnum hard-coded ! 429 if (Checksum!=ConfigChecksum) { 430 Status_Config = STATUS_CORRUPT; return; 912 PCHAR ConfigSectorPtr = &Track0[CONFIG_OFFSET]; // Config sector offset hard-coded ! 913 PCHAR SectorPtr = NULL; 914 USHORT Checksum = 0; 915 USHORT ConfigChecksum = 0; 916 USHORT SectorCount = 0; 917 918 /* 919 // Note that the 'AiRCFG-TABLE' string includes the invisible 0xAD char. 920 */ 921 if (strncmp(ConfigSectorPtr, "AiRCFG-TABLE", 13)==0) { 922 // AiR-BOOT signature found... 923 SectorPtr = &Track0[54 * BYTES_PER_SECTOR]; // Start at sector 55 924 ConfigChecksum = *(PUSHORT)&Track0[54 * BYTES_PER_SECTOR + 20]; 925 // Remove checksum 926 *(PUSHORT)&Track0[54 * BYTES_PER_SECTOR + 20] = 0; // Config sector secnum hard-coded ! 927 928 /* 929 // Rousseau: # Keep compatible with v1.07 CRC # 930 // AB v1.07 had bugs in writing the wrong number of AB config sectors. 931 // This is fixed in v1.0.8 but the CRC has to be calculated the "v1.07 way" 932 // otherwise v1.07 SET(A)BOOT and INSTALL2.EXE will think the AB config 933 // is corrupted. 934 // So the CRC is calculated over 5 sectors instead of 7. 935 */ 936 SectorCount = 5; 937 938 while (SectorCount>0) { 939 Checksum = GetChecksumOfSector(Checksum, SectorPtr); 940 SectorPtr += BYTES_PER_SECTOR; 941 SectorCount--; 942 } 943 // Restore checksum 944 *(PUSHORT)&Track0[54 * BYTES_PER_SECTOR + 20] = ConfigChecksum; // Config sector secnum hard-coded ! 945 if (Checksum!=ConfigChecksum) { 946 Status_Config = STATUS_CORRUPT; 947 return; 948 } 949 // Checksum fine 950 Installed_ConfigVersion = (Track0[54 * BYTES_PER_SECTOR + 0x0D] << 8) | Track0[54 * BYTES_PER_SECTOR + 0x0E]; 951 if (Installed_ConfigVersion>=Bootcode_ConfigVersion) { 952 Status_Config = STATUS_INSTALLED; 953 return; 954 } 955 Status_Config = STATUS_INSTALLEDMGU; 956 // Those upgrades will copy useful configuration data to the image config 957 // If new configuration data was added, those spaces are not overwritten 958 // Sector 60 (MBR-BackUp) *MUST BE* copied, otherwise it would be lost. 959 // Rousseau: Upgrade from v0.27 960 if (Installed_ConfigVersion<=0x27) { 961 // UPGRADE v0.27 and prior versions 962 963 // Sector 55 964 // Changes: Offset 69 length 75 - Linux command line 965 // Offset 144 length 1 - Linux kernel partition 966 // Offset 145 Length 11 - Default kernel name 967 // Offset 156 Length 1 - Kernel name terminator 1 968 // Offset 157 Length 11 - Last kernel name 969 // Offset 168 Length 1 - Kernel name terminator 2 970 // Offset 169 Length 1 - Ext. partition M$-hack enable 971 // -> Total-length 101 972 // Offset 432 Length 34 - New IPT entry (BIOS continued) 973 memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], 69 - 16); // CHECKEN !! 974 memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 466], &Track0[54 * BYTES_PER_SECTOR + 466], 46); // CHECKEN !! 975 // Sector 56-57 no changes 976 memcpy(&Bootcode[55*512], &Track0[55 * BYTES_PER_SECTOR], 1024); 977 // Sector 58-59 978 // Changes: Offset 900 Length 30 - Logical driveletter table 979 memcpy(&Bootcode[57 * BYTES_PER_SECTOR], &Track0[57 * BYTES_PER_SECTOR], 900); // AANPASSEN 900 !! 980 // Sector 60 copy unmodified 981 memcpy(&Bootcode[59 * BYTES_PER_SECTOR], &Track0[59 * BYTES_PER_SECTOR], BYTES_PER_SECTOR); // CHECKEN !! 982 return; 983 } 984 // Rousseau: Upgrade from v0.91 985 if (Installed_ConfigVersion<=0x91) { 986 // UPGRADE v0.91 and prior versions 987 // Sector 55-57 no changes 988 memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], BYTES_PER_SECTOR + 1024 - 16); // CHACKEN !! 989 // Sector 58-59 990 // Changes: Offset 900 Length 30 - Logical driveletter table 991 memcpy(&Bootcode[57 * BYTES_PER_SECTOR], &Track0[57 * BYTES_PER_SECTOR], 900); // AANPASSEN 900 !! 992 // Sector 60/62 copy unmodified 993 memcpy(&Bootcode[59 * BYTES_PER_SECTOR], &Track0[59 * BYTES_PER_SECTOR], BYTES_PER_SECTOR); 994 return; 995 } 996 997 998 /* 999 // HIER AANPASSEN VOOR 1.06 -> 1.07, 1.07/1.0.8-rc1 -> 1.0.8-rc2+ ! 1000 // MBR-ProtImg, DriveLetters, Packed hideparttable 1001 */ 1002 1003 // UPGRADE all later versions 1004 // We don't need to "upgrade" the configuration, we simply copy it over. 1005 // From Sector 55, 6 sectors in total but never header/version 1006 // Rousseau: We copy two more sectors (8 in total) in the extended (45 partition) version. 1007 switch (IMAGE_SIZE) { 1008 case IMAGE_SIZE_60SECS: { 1009 memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], BYTES_PER_SECTOR * 6 - 16); 1010 break; 1011 } 1012 case IMAGE_SIZE_62SECS: { 1013 memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], BYTES_PER_SECTOR * 8 - 16); 1014 break; 1015 } 1016 } 431 1017 return; 432 } 433 // Checksum fine 434 Installed_ConfigVersion = (Track0[54 * BYTES_PER_SECTOR + 0x0D] << 8) | Track0[54 * BYTES_PER_SECTOR + 0x0E]; 435 if (Installed_ConfigVersion>=Bootcode_ConfigVersion) { 436 Status_Config = STATUS_INSTALLED; return; 437 } 438 Status_Config = STATUS_INSTALLEDMGU; 439 // Those upgrades will copy useful configuration data to the image config 440 // If new configuration data was added, those spaces are not overwritten 441 // Sector 60 (MBR-BackUp) *MUST BE* copied, otherwise it would be lost. 442 // Rousseau: Upgrade from v0.27 443 if (Installed_ConfigVersion<=0x27) { 444 // UPGRADE v0.27 and prior versions 445 446 // Sector 55 447 // Changes: Offset 69 length 75 - Linux command line 448 // Offset 144 length 1 - Linux kernel partition 449 // Offset 145 Length 11 - Default kernel name 450 // Offset 156 Length 1 - Kernel name terminator 1 451 // Offset 157 Length 11 - Last kernel name 452 // Offset 168 Length 1 - Kernel name terminator 2 453 // Offset 169 Length 1 - Ext. partition M$-hack enable 454 // -> Total-length 101 455 // Offset 432 Length 34 - New IPT entry (BIOS continued) 456 memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], 69 - 16); // CHECKEN !! 457 memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 466], &Track0[54 * BYTES_PER_SECTOR + 466], 46); // CHECKEN !! 458 // Sector 56-57 no changes 459 memcpy(&Bootcode[55*512], &Track0[55 * BYTES_PER_SECTOR], 1024); 460 // Sector 58-59 461 // Changes: Offset 900 Length 30 - Logical driveletter table 462 memcpy(&Bootcode[57 * BYTES_PER_SECTOR], &Track0[57 * BYTES_PER_SECTOR], 900); // AANPASSEN 900 !! 463 // Sector 60 copy unmodified 464 memcpy(&Bootcode[59 * BYTES_PER_SECTOR], &Track0[59 * BYTES_PER_SECTOR], BYTES_PER_SECTOR); // CHECKEN !! 465 return; 466 } 467 // Rousseau: Upgrade from v0.91 468 if (Installed_ConfigVersion<=0x91) { 469 // UPGRADE v0.91 and prior versions 470 // Sector 55-57 no changes 471 memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], BYTES_PER_SECTOR + 1024 - 16); // CHACKEN !! 472 // Sector 58-59 473 // Changes: Offset 900 Length 30 - Logical driveletter table 474 memcpy(&Bootcode[57 * BYTES_PER_SECTOR], &Track0[57 * BYTES_PER_SECTOR], 900); // AANPASSEN 900 !! 475 // Sector 60 copy unmodified 476 memcpy(&Bootcode[59 * BYTES_PER_SECTOR], &Track0[59 * BYTES_PER_SECTOR], BYTES_PER_SECTOR); 477 return; 478 } 479 // UPGRADE all later versions 480 // We don't need to "upgrade" the configuration, we simply copy it over. 481 // From Sector 55, 6 sectors in total but never header/version 482 // Rousseau: We copy two more sectors (8 in total) in the extended (45 partition) version. 483 switch (IMAGE_SIZE) { 484 case IMAGE_SIZE_60SECS: { 485 memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], BYTES_PER_SECTOR * 6 - 16); 486 break; 487 } 488 case IMAGE_SIZE_62SECS: { 489 memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], BYTES_PER_SECTOR * 8 - 16); 490 break; 491 } 492 } 493 494 return; 495 } 496 // Check for prior v0.26 signature 497 // not supported in C version anymore 498 // Don't have this version here for testing and I can't risk breaking 499 // configuration 500 } 1018 } 1019 // Check for prior v0.26 signature 1020 // not supported in C version anymore 1021 // Don't have this version here for testing and I can't risk breaking 1022 // configuration 1023 return; 1024 } 501 1025 502 1026 // Checks partition table for valid data 503 1027 BOOL Virus_CheckThisMBR (PCHAR MBRptr) { // Rousseau: adjusted this function 504 USHORT PartitionNo; 505 ////ULONG CHSStart, CHSEnd; 506 507 //printf("DEBUG: Virus_CheckThisMBR\n"); 508 509 if (*(PUSHORT)(MBRptr + BYTES_PER_SECTOR - 2)!=0x0AA55) return FALSE; 510 511 //printf("DEBUG: Virus_CheckThisMBR - Checking Partitions\n"); 512 513 MBRptr += 446; 514 for (PartitionNo=0; PartitionNo<4; PartitionNo++) { 515 if (*(MBRptr+4) != 0) { 516 /* 517 // Rousseau 2011-02-04: ## Check for GPT ## 518 */ 519 if (*(MBRptr+4) == GPT) { 520 if (!Option_CID) { 521 printf("ERROR: This drive is partitioned with the modern GPT layout.\n"); 522 printf(" AiR-BOOT is currently unable to handle GPT partitioned drives.\n"); 523 printf(" Installation aborted, no changes made.\n"); 524 } 525 exit(2); 526 } 527 528 /* 529 // Rousseau: 2011-05-05 530 // Last minute change to have AB install a disk with nopartitions 531 // on the bootdisk. 532 // It still checks for GPT but will skip the check below. 533 */ 534 continue; 535 536 //printf("DEBUG: Virus_CheckThisMBR - Partition: %d\n", PartitionNo); 537 // Partition-type defined, analyse partition data 538 ////CHSStart = (*(MBRptr+3) | ((*(MBRptr+2) >> 6) << 8)) << 16; // Cylinder 539 ////CHSStart |= (*(MBRptr+2) & 0x3F) | ((*(MBRptr+1) << 8)); // Sector / Head 540 //printf("DEBUG: Virus_CheckThisMBR - CHSStart: %d\n", CHSStart); // 3F MASK CHECKEN !! 541 542 ////CHSEnd = (*(MBRptr+7) | ((*(MBRptr+6) >> 6) << 8)) << 16; // Cylinder 543 ////CHSEnd |= (*(MBRptr+6) & 0x3F) | ((*(MBRptr+5) << 8)); // Sector / Head 544 //printf("DEBUG: Virus_CheckThisMBR - CHSEnd: %d\n", CHSEnd); 545 546 547 /* 548 // Rousseau 2011-02-03: ## Changed below from < to <= ## 549 // When a partition is above 1024x255x63 (8GiB) the start and end of the partition 550 // in the MBR is the same (1024/255/63) to indicate extended CHS-values. 551 // This made the installer see this as a non-valid entry. 552 // Fixme: This could use some further optimazation like checking if CHS is really 1024/255/63 553 // to exclude truly faulty partition-entries. 554 */ 555 /*if (CHSStart<CHSEnd) {*/ 556 ////if (CHSStart<=CHSEnd) { 557 //// if (*(PULONG)(MBRptr+12)!=0) // Absolute length > 0? 558 //// return TRUE; 559 ////} 560 } 561 // Go to next partition 562 MBRptr += 16; 563 } 564 // No partitions defined/no valid partitions found 565 // Rousseau: Still return TRUE (OK) 566 //return FALSE; 567 return TRUE; 568 } 1028 USHORT PartitionNo; 1029 ////ULONG CHSStart, CHSEnd; 1030 1031 //printf("DEBUG: Virus_CheckThisMBR\n"); 1032 1033 if (*(PUSHORT)(MBRptr + BYTES_PER_SECTOR - 2)!=0x0AA55) 1034 return FALSE; 1035 1036 //printf("DEBUG: Virus_CheckThisMBR - Checking Partitions\n"); 1037 1038 MBRptr += 446; 1039 for (PartitionNo=0; PartitionNo<4; PartitionNo++) { 1040 if (*(MBRptr+4) != 0) { 1041 /* 1042 // Rousseau 2011-02-04: ## Check for GPT ## 1043 */ 1044 if (*(MBRptr+4) == GPT) { 1045 if (!Option_CID) { 1046 printf("ERROR: This drive is partitioned with the modern GPT layout.\n"); 1047 printf(" AiR-BOOT is currently unable to handle GPT partitioned drives.\n"); 1048 printf(" Installation aborted, no changes made.\n"); 1049 } 1050 exit(2); 1051 } 1052 1053 /* 1054 // Rousseau: 2011-05-05 1055 // Last minute change to have AB install on a disk 1056 // with nopartitions on the it. (check !) 1057 // It still checks for GPT but will skip the check below. 1058 */ 1059 continue; 1060 1061 //printf("DEBUG: Virus_CheckThisMBR - Partition: %d\n", PartitionNo); 1062 // Partition-type defined, analyse partition data 1063 ////CHSStart = (*(MBRptr+3) | ((*(MBRptr+2) >> 6) << 8)) << 16; // Cylinder 1064 ////CHSStart |= (*(MBRptr+2) & 0x3F) | ((*(MBRptr+1) << 8)); // Sector / Head 1065 //printf("DEBUG: Virus_CheckThisMBR - CHSStart: %d\n", CHSStart); // 3F MASK CHECKEN !! 1066 1067 ////CHSEnd = (*(MBRptr+7) | ((*(MBRptr+6) >> 6) << 8)) << 16; // Cylinder 1068 ////CHSEnd |= (*(MBRptr+6) & 0x3F) | ((*(MBRptr+5) << 8)); // Sector / Head 1069 //printf("DEBUG: Virus_CheckThisMBR - CHSEnd: %d\n", CHSEnd); 1070 1071 1072 /* 1073 // Rousseau 2011-02-03: ## Changed below from < to <= ## 1074 // When a partition is above 1024x255x63 (8GiB) the start and end of the partition 1075 // in the MBR is the same (1024/255/63) to indicate extended CHS-values. 1076 // This made the installer see this as a non-valid entry. 1077 // Fixme: This could use some further optimazation like checking if CHS is really 1024/255/63 1078 // to exclude truly faulty partition-entries. 1079 // Also depends on conventions: IBM,MS,Partition Magic,... 1080 */ 1081 /*if (CHSStart<CHSEnd) {*/ 1082 ////if (CHSStart<=CHSEnd) { 1083 //// if (*(PULONG)(MBRptr+12)!=0) // Absolute length > 0? 1084 //// return TRUE; 1085 ////} 1086 } 1087 // Go to next partition 1088 MBRptr += 16; 1089 } 1090 // No partitions defined/no valid partitions found 1091 // Rousseau: Still return TRUE (OK) 1092 //return FALSE; 1093 return TRUE; 1094 } 569 1095 570 1096 BOOL Virus_CheckCurrentMBR (void) { 571 return Virus_CheckThisMBR(&Track0);572 1097 return Virus_CheckThisMBR((PCHAR) Track0); 1098 } 573 1099 574 1100 BOOL Virus_CheckForBackUpMBR (void) { 575 return Virus_CheckThisMBR(&Track0[59 * BYTES_PER_SECTOR]); 576 } 1101 BOOL bMbrBackup = FALSE; 1102 1103 // All versions above v1.06 have expanded tables so the MBR-backup 1104 // is located 2 sectors higher in the track0 image. 1105 if (Installed_ConfigVersion<=0x0106) 1106 bMbrBackup = Virus_CheckThisMBR((PCHAR) &Track0[59 * BYTES_PER_SECTOR]); 1107 else 1108 bMbrBackup = Virus_CheckThisMBR((PCHAR) &Track0[61 * BYTES_PER_SECTOR]); 1109 1110 return bMbrBackup; 1111 } 577 1112 578 1113 BOOL Virus_CheckForStealth (void) { 579 PCHAR CurPtr = &Track0;580 USHORT i;581 582 for (i=0; i<511; i++) { // BYTES_PER_SECTOR RELATED ??583 if (*(PUSHORT)CurPtr==0x13CD) return FALSE;584 CurPtr++;585 } 586 // No CD13h found? possible stealth587 return TRUE;588 1114 PCHAR CurPtr = (PCHAR) Track0; 1115 USHORT i; 1116 1117 for (i=0; i<511; i++) { 1118 if (*(PUSHORT)CurPtr==0x13CD) return FALSE; 1119 CurPtr++; 1120 } 1121 // No CD13h found? possible stealth 1122 return TRUE; 1123 } 589 1124 590 1125 // Copies backup MBR into current MBR on current memory copy of track 0 591 1126 // Rousseau: Two sectors higher in the extended version. 592 1127 void Virus_CopyBackUpMBR (void) { 593 switch (IMAGE_SIZE) {594 case IMAGE_SIZE_60SECS: {595 memcpy(&Track0, &Track0[59 * BYTES_PER_SECTOR], BYTES_PER_SECTOR); // sector 60596 break;597 }598 case IMAGE_SIZE_62SECS: {599 memcpy(&Track0, &Track0[61 * BYTES_PER_SECTOR], BYTES_PER_SECTOR); // sector 62600 break;601 }602 }603 1128 switch (IMAGE_SIZE) { 1129 case IMAGE_SIZE_60SECS: { 1130 memcpy(Track0, &Track0[59 * BYTES_PER_SECTOR], BYTES_PER_SECTOR); // sector 60 1131 break; 1132 } 1133 case IMAGE_SIZE_62SECS: { 1134 memcpy(Track0, &Track0[61 * BYTES_PER_SECTOR], BYTES_PER_SECTOR); // sector 62 1135 break; 1136 } 1137 } 1138 } 604 1139 605 1140 void Status_PrintF (ULONG Status, USHORT Version) { 606 switch (Status) { 607 case STATUS_NOTINSTALLED: { 608 if (!Option_CID) { 609 printf("not installed\n"); 610 } 611 break; 612 } 613 case STATUS_CORRUPT: { 614 if (!Option_CID) { 615 printf("not intact\n"); 616 } 617 break; 618 } 619 case STATUS_INSTALLED: 620 case STATUS_INSTALLEDMGU: 621 if (!Option_CID) { 622 printf("intact (v%x.%1d.%1d)", Version>>8, (Version & 0x0F0)>>4, Version & 0x0F); 623 624 } 625 if (Status==STATUS_INSTALLEDMGU) 626 if (!Option_CID) { 627 printf(", but may be updated"); 628 printf("\n"); 629 } 630 break; 631 case STATUS_IMPOSSIBLE: 632 if (!Option_CID) { 633 printf(ImpossibleCause); 634 } 635 break; 636 } 637 } 1141 switch (Status) { 1142 case STATUS_NOTINSTALLED: { 1143 if (!Option_CID) { 1144 printf("not installed\n"); 1145 } 1146 break; 1147 } 1148 case STATUS_CORRUPT: { 1149 if (!Option_CID) { 1150 printf("not intact\n"); 1151 } 1152 break; 1153 } 1154 case STATUS_INSTALLED: 1155 case STATUS_INSTALLEDMGU: 1156 if (!Option_CID) { 1157 printf("intact (v%x.%1d.%1d)", Version>>8, (Version & 0x0F0)>>4, Version & 0x0F); 1158 } 1159 if (Status==STATUS_INSTALLEDMGU) 1160 if (!Option_CID) { 1161 printf(", but may be updated"); 1162 printf("\n"); 1163 } 1164 break; 1165 case STATUS_IMPOSSIBLE: 1166 if (!Option_CID) { 1167 printf(ImpossibleCause); 1168 } 1169 break; 1170 } 1171 } 638 1172 639 1173 void Language_PrintF(UCHAR LanguageID) { 640 if (Option_CID)641 return;642 switch (LanguageID) {643 case 'E': printf("english");break;644 case 'N': printf("dutch"); break;// Changed from 'D' to 'N'645 case 'G': printf("german");break;646 case 'F': printf("french");break;647 case 'I': printf("italian");break;648 case 'R': printf("russian");break;649 case 'S': printf("swedish");break;650 default: printf("unknown");651 } 652 1174 if (Option_CID) 1175 return; 1176 switch (LanguageID) { 1177 case 'E': printf("english"); break; 1178 case 'N': printf("dutch"); break; // Changed from 'D' to 'N' 1179 case 'G': printf("german"); break; 1180 case 'F': printf("french"); break; 1181 case 'I': printf("italian"); break; 1182 case 'R': printf("russian"); break; 1183 case 'S': printf("swedish"); break; 1184 default: printf("unknown"); 1185 } 1186 } 653 1187 654 1188 // Doesn't actually write code/config, but writes it to track0 memory 655 1189 void Install_WriteCode (void) { 656 USHORT TotalCodeSectorsUsed = 0;657 USHORT SectorCount = 0;658 USHORT Checksum = 0;659 PCHAR SectorPtr = NULL;660 661 // Calculate checksum for code...662 TotalCodeSectorsUsed = Bootcode[0x10]; // SECTORS USED CHECKEN !! (34h / 52d in v1.06)663 SectorPtr = &Bootcode[1 * BYTES_PER_SECTOR]; // Start at sector 2664 SectorCount = TotalCodeSectorsUsed;665 while (SectorCount>0) {666 Checksum = GetChecksumOfSector(Checksum, SectorPtr);667 SectorPtr += BYTES_PER_SECTOR;668 SectorCount--;669 } 670 *(PUSHORT)&Bootcode[0x11] = Checksum;671 672 // Copy MBR till offset 0x1B8 (Windows NT hdd signature location)673 memcpy(&Track0, &Bootcode, 0x1B8);674 675 // Copy over code sectors...676 memcpy(&Track0[BYTES_PER_SECTOR], &Bootcode[BYTES_PER_SECTOR], TotalCodeSectorsUsed * BYTES_PER_SECTOR);677 1190 USHORT TotalCodeSectorsUsed = 0; 1191 USHORT SectorCount = 0; 1192 USHORT Checksum = 0; 1193 PCHAR SectorPtr = NULL; 1194 1195 // Calculate checksum for code... 1196 TotalCodeSectorsUsed = Bootcode[0x10]; // SECTORS USED CHECKEN !! (34h / 52d in v1.06) 1197 SectorPtr = &Bootcode[1 * BYTES_PER_SECTOR]; // Start at sector 2 1198 SectorCount = TotalCodeSectorsUsed; 1199 while (SectorCount>0) { 1200 Checksum = GetChecksumOfSector(Checksum, SectorPtr); 1201 SectorPtr += BYTES_PER_SECTOR; 1202 SectorCount--; 1203 } 1204 *(PUSHORT)&Bootcode[0x11] = Checksum; 1205 1206 // Copy MBR till offset 0x1B8 (Windows NT hdd signature location) 1207 memcpy(Track0, Bootcode, 0x1B8); 1208 1209 // Copy over code sectors... 1210 memcpy(&Track0[BYTES_PER_SECTOR], &Bootcode[BYTES_PER_SECTOR], TotalCodeSectorsUsed * BYTES_PER_SECTOR); 1211 } 678 1212 679 1213 void Install_WriteConfig (void) { 680 USHORT SectorCount = 0; 681 USHORT Checksum = 0; 682 PCHAR SectorPtr = NULL; 683 684 #ifdef PLATFORM_OS2 685 if (AutoDriveLetter!=0) { 686 // Add DriveLetter Automatic veriables, if set 687 Bootcode[54 * BYTES_PER_SECTOR + 0x1AB] = AutoDriveLetter; // CHECKEN ! 688 *(PULONG)&Bootcode[54 * BYTES_PER_SECTOR + 0x1AC] = AutoDriveLetterSerial; 689 } 690 #endif 691 692 // Delete current checksum 693 *(PUSHORT)&Bootcode[54 * BYTES_PER_SECTOR + 20] = 0; 694 695 SectorPtr = &Bootcode[54 * BYTES_PER_SECTOR]; // Start at sector 55 696 697 /* 698 // Rousseau: # Keep compatible with v1.07 CRC # 699 // AB v1.07 had bugs in writing the wrong number of AB config sectors. 700 // This is fixed in v1.0.8 but the CRC has to be calculated the "v1.07 way" 701 // otherwise v1.07 SET(A)BOOT and INSTALL2.EXE will think the AB config 702 // is corrupted. 703 // So the CRC is calculated over 5 sectors instead of 7. 704 */ 705 SectorCount = 5; 706 707 while (SectorCount>0) { 708 Checksum = GetChecksumOfSector(Checksum, SectorPtr); 709 SectorPtr += BYTES_PER_SECTOR; 710 SectorCount--; 711 } 712 *(PUSHORT)&Bootcode[54 * BYTES_PER_SECTOR + 20] = Checksum; 713 714 // Copy configuration sectors 715 // Rousseau: Two more sectors for extended version. 716 switch (IMAGE_SIZE) { 717 case IMAGE_SIZE_60SECS: { 718 memcpy(&Track0[54 * BYTES_PER_SECTOR], &Bootcode[54 * BYTES_PER_SECTOR], 6 * BYTES_PER_SECTOR); 719 break; 720 } 721 case IMAGE_SIZE_62SECS: { 722 memcpy(&Track0[54 * BYTES_PER_SECTOR], &Bootcode[54 * BYTES_PER_SECTOR], 8 * BYTES_PER_SECTOR); 723 break; 724 } 725 } 726 } 1214 USHORT SectorCount = 0; 1215 USHORT Checksum = 0; 1216 PCHAR SectorPtr = NULL; 1217 1218 #ifdef PLATFORM_OS2 1219 if (AutoDriveLetter!=0) { 1220 // Add DriveLetter Automatic veriables, if set 1221 Bootcode[54 * BYTES_PER_SECTOR + 0x1AB] = AutoDriveLetter; // CHECKEN ! 1222 *(PULONG)&Bootcode[54 * BYTES_PER_SECTOR + 0x1AC] = AutoDriveLetterSerial; 1223 } 1224 #endif 1225 1226 // Delete current checksum 1227 *(PUSHORT)&Bootcode[54 * BYTES_PER_SECTOR + 20] = 0; 1228 1229 SectorPtr = &Bootcode[54 * BYTES_PER_SECTOR]; // Start at sector 55 1230 1231 /* 1232 // Rousseau: # Keep compatible with v1.07 CRC # 1233 // AB v1.07 had bugs in writing the wrong number of AB config sectors. 1234 // This is fixed in v1.0.8 but the CRC has to be calculated the "v1.07 way" 1235 // otherwise v1.07 SET(A)BOOT and AIRBOOT2.EXE will think the AB config 1236 // is corrupted. 1237 // So the CRC is calculated over 5 sectors instead of 7. 1238 */ 1239 SectorCount = 5; 1240 1241 while (SectorCount>0) { 1242 Checksum = GetChecksumOfSector(Checksum, SectorPtr); 1243 SectorPtr += BYTES_PER_SECTOR; 1244 SectorCount--; 1245 } 1246 *(PUSHORT)&Bootcode[54 * BYTES_PER_SECTOR + 20] = Checksum; 1247 1248 // Copy configuration sectors 1249 // Rousseau: Two more sectors for extended version. 1250 switch (IMAGE_SIZE) { 1251 case IMAGE_SIZE_60SECS: { 1252 memcpy(&Track0[54 * BYTES_PER_SECTOR], &Bootcode[54 * BYTES_PER_SECTOR], 6 * BYTES_PER_SECTOR); 1253 break; 1254 } 1255 case IMAGE_SIZE_62SECS: { 1256 memcpy(&Track0[54 * BYTES_PER_SECTOR], &Bootcode[54 * BYTES_PER_SECTOR], 8 * BYTES_PER_SECTOR); 1257 break; 1258 } 1259 } 1260 1261 return; 1262 } 1263 1264 1265 1266 1267 1268 1269 // ============================================================================ 1270 // Main Entrypoint 1271 // ============================================================================ 1272 1273 727 1274 728 1275 #define MAXCMDPARMLEN 11 729 1276 730 1277 int main (int argc, char **argv) { 731 ULONG CurArgument = 0; 732 ULONG ArgumentLen = 0; 733 PCHAR StartPos = 0; 734 CHAR TempSpace[MAXCMDPARMLEN+1]; 735 UCHAR UserKey = ' '; 736 BOOL ExitOnly = FALSE; 1278 ULONG CurArgument = 0; 1279 size_t ArgumentLen = 0; 1280 PCHAR StartPos = 0; 1281 UCHAR UserKey = ' '; 1282 BOOL ExitOnly = FALSE; 1283 CHAR TempSpace[MAXCMDPARMLEN+1]; 1284 1285 char* p = NULL; 1286 1287 1288 do_bf_test(); 1289 exit(0); 1290 737 1291 738 1292 // printf("AiR-BOOT Installer v1.07\n"); … … 740 1294 // printf("\n-> ...Please wait... <-\n"); 741 1295 742 // Check commandline parameters 743 CurArgument = 1; 744 while (CurArgument<argc) { 745 StartPos = argv[CurArgument]; 746 ArgumentLen = strlen(StartPos); 747 748 if (((*StartPos=='-') || (*StartPos=='/')) && (ArgumentLen>1)) { 749 StartPos++; ArgumentLen--; 750 if (ArgumentLen>MAXCMDPARMLEN) ArgumentLen = MAXCMDPARMLEN; 751 strncpy(&TempSpace, StartPos, ArgumentLen); 752 TempSpace[ArgumentLen] = 0; 753 StartPos = &TempSpace; 754 while (*StartPos!=0) { 755 *StartPos = tolower(*StartPos); StartPos++; 756 } 757 if (strcmp(&TempSpace, "forcecode")==0) Option_ForceCode = TRUE; 758 if (strcmp(&TempSpace, "forceconfig")==0) Option_ForceConfig = TRUE; 759 if (strcmp(&TempSpace, "silent")==0) Option_Silent = TRUE; 760 if (strcmp(&TempSpace, "cid")==0) Option_CID = TRUE; 761 } 762 CurArgument++; 763 } 764 765 if (Option_CID) { 766 Option_Silent = TRUE; 767 } 768 769 #ifdef PLATFORM_WINNT 770 if (CheckWindowsVersion()==FALSE) return 1; 771 #endif 772 773 if (CountHarddrives()==0) { 774 if (!Option_CID) { 775 printf(" - No physical drives found on this system. Install impossible.\n"); 776 } 777 return 3; // Rouseau: changed from 1 to 3 778 } 779 780 if (!Option_CID) { 781 printf(" - Loading bootcode from file..."); 782 } 783 if (LoadBootcodeFromFile()==FALSE) return 1; 784 if (!Option_CID) { 785 printf("ok\n"); 786 } 787 788 if (!Option_CID) { 789 printf(" - Loading MBR from harddisc..."); 790 } 791 if (HarddriveCheckGeometry()) { 792 // No EZ-SETUP check here, because we are under 32-bit OS and this 793 // wouldn't make any sense 794 if (!Track0Load()) { 795 if (!Option_CID) { 796 printf("LOAD ERROR!\n"); 797 } 798 return 1; 799 } 800 } else { 801 StatusCode = STATUS_IMPOSSIBLE; 802 if (!Option_CID) { 803 ImpossibleCause = "unable to install\n Your harddisc does not have at least 63 sectors per track."; 804 } 805 } 806 if (!Option_CID) { 807 printf("ok\n"); 808 } 809 810 811 if (!Option_CID) { 812 printf("\n-> ...Current Status... <-\n"); 813 } 814 Status_CheckCode(); 815 if (!Option_CID) { 816 printf(" - AiR-BOOT is "); 817 } 818 Status_PrintF(Status_Code, Installed_CodeVersion); 819 if (StatusCode==STATUS_IMPOSSIBLE) return 1; 820 Status_CheckConfig(); 821 if (!Option_CID) { 822 printf(" - Configuration is "); 823 } 824 Status_PrintF(Status_Config, Installed_ConfigVersion); 825 // Display language as well, if code installed 826 if ((Status_Code==STATUS_INSTALLED) || (Status_Code==STATUS_INSTALLEDMGU)) { 827 if (!Option_CID) { 828 printf(" - Language is "); 829 } 830 Language_PrintF(Installed_LanguageID); 831 if (!Option_CID) { 832 printf("\n"); 833 } 834 } 835 836 // ============================================================= 837 // PRE-CHECKING, WHAT WE ARE SUPPOSED TO DO... 838 // ============================================================= 839 if ((Option_ForceCode) || (Status_Code!=STATUS_INSTALLED) || (Installed_LanguageID!=Bootcode_LanguageID)) 840 Install_Code = TRUE; // If LanguageID different or not installed 841 if ((Option_ForceConfig) || (Status_Config!=STATUS_INSTALLED)) 842 Install_Config = TRUE; // If not installed 843 844 if ((Status_Code==STATUS_CORRUPT) || (Status_Config==STATUS_CORRUPT)) 845 Install_IsCorrupt = TRUE; // If anything is corrupt 846 847 // ============================================================= 848 // VIRUS 849 // ============================================================= 850 // If-Table 851 // --------- 852 // Code==not installed, Config=not installed -> Check MBR 853 // Code==installed, config==installed -> Check MBR (-> Virus?) 854 // Code==not installed, config==installed -> (-> Virus?) 855 // Code==installed, config==not installed -> Check MBR (-> Virus?) 856 857 //printf("DEBUG: Status_Code: %d, Status_Config: %d\n", Status_Code, Status_Config); // Rousseau: DEBUG 858 859 if ((Status_Code==STATUS_NOTINSTALLED) & (Status_Config==STATUS_NOTINSTALLED)) { 860 // Nothing installed, so check MBR, if squashed... 861 if (!Virus_CheckCurrentMBR()) { 862 if (!Option_CID) { 863 printf("\n\n"); 864 printf("AiR-BOOT detected that the data on your harddisc got damaged.\n"); 865 printf("If you had AiR-BOOT installed before: the corruption killed AiR-BOOT completly!\n"); 866 printf("Installation halted.\n"); 867 } 868 return 255; // Rousseau: changed from 1 to 255 869 } 870 //printf("DEBUG: Installing...\n"); // Rousseau: DEBUG 871 } else { 872 if ((Status_Code==STATUS_NOTINSTALLED) | (!Virus_CheckCurrentMBR())) { 873 // Code not installed, but Config or MBR squashed... 874 // -> Virus proposed, check for backup (if available) 875 if (!Option_CID) { 876 printf("\n\n"); 877 printf("-> ...!ATTENTION!... <-\n"); 878 } 879 if (Virus_CheckForStealth()) 1296 // Allocate buffers for Track0 and AIRBOOT.BIN. 1297 Track0 = malloc(SECTOR_COUNT * BYTES_PER_SECTOR); 1298 Bootcode = malloc(SECTOR_COUNT * BYTES_PER_SECTOR); 1299 1300 // Exit of allocation failed. 1301 if (!(Track0 && Bootcode)) { 1302 if (!Option_CID) { 1303 printf("- Unable to allocate enough memory, operation aborted!\n"); 1304 } 1305 exit(4); 1306 } 1307 1308 1309 p = (PCHAR) &Track0; 1310 p = (PCHAR) Track0; 1311 p[0] = 'A'; 1312 1313 { 1314 int i=0; 1315 for (i=0; i<sizeof(Track0); i++) { 1316 Track0[i]='X'; 1317 } 1318 for (i=0; i<sizeof(Bootcode); i++) { 1319 Bootcode[i]='Y'; 1320 } 1321 //~ for (i=0; i<sizeof(Bootcode2); i++) { 1322 //~ Bootcode2[i]='Z'; 1323 //~ } 1324 } 1325 1326 1327 // Check commandline parameters 1328 CurArgument = 1; 1329 while (CurArgument<argc) { 1330 StartPos = argv[CurArgument]; 1331 ArgumentLen = strlen(StartPos); 1332 1333 if (((*StartPos=='-') || (*StartPos=='/')) && (ArgumentLen>1)) { 1334 StartPos++; ArgumentLen--; 1335 if (ArgumentLen>MAXCMDPARMLEN) 1336 ArgumentLen = MAXCMDPARMLEN; 1337 strncpy((char *) TempSpace, StartPos, ArgumentLen); 1338 TempSpace[ArgumentLen] = 0; 1339 StartPos = (PCHAR) TempSpace; 1340 while (*StartPos!=0) { 1341 *StartPos = tolower(*StartPos); StartPos++; 1342 } 1343 if (strcmp((char *) TempSpace, "forcecode")==0) Option_ForceCode = TRUE; 1344 if (strcmp((char *) TempSpace, "forceconfig")==0) Option_ForceConfig = TRUE; 1345 if (strcmp((char *) TempSpace, "silent")==0) Option_Silent = TRUE; 1346 if (strcmp((char *) TempSpace, "cid")==0) Option_CID = TRUE; 1347 } 1348 CurArgument++; 1349 } 1350 1351 if (Option_CID) { 1352 Option_Silent = TRUE; 1353 } 1354 1355 #ifdef PLATFORM_WINNT 1356 if (CheckWindowsVersion()==FALSE) 1357 return 1; 1358 #endif 1359 1360 if (CountHarddrives()==0) { 1361 if (!Option_CID) { 1362 printf(" - No physical drives found on this system. Install impossible.\n"); 1363 } 1364 return 3; // Rouseau: changed from 1 to 3 1365 } 1366 1367 if (!Option_CID) { 1368 printf(" - Loading bootcode from file..."); 1369 } 1370 1371 if (LoadBootcodeFromFile()==FALSE) 1372 return 1; 1373 1374 if (!Option_CID) { 1375 printf("ok\n"); 1376 } 1377 1378 if (!Option_CID) { 1379 printf(" - Loading MBR from harddisc..."); 1380 } 1381 if (HarddriveCheckGeometry()) { 1382 // No EZ-SETUP check here, because we are under 32-bit OS and this 1383 // wouldn't make any sense 1384 if (!Track0Load()) { 880 1385 if (!Option_CID) { 881 printf("Your system GOT infected by a stealth-virus (or your MBR got trashed).\n"); 882 } 883 else 1386 printf("LOAD ERROR!\n"); 1387 } 1388 return 1; 1389 } 1390 } 1391 else { 1392 StatusCode = STATUS_IMPOSSIBLE; 1393 if (!Option_CID) { 1394 ImpossibleCause = "unable to install\n Your harddisc does not have at least 63 sectors per track."; 1395 } 1396 } 1397 1398 if (!Option_CID) { 1399 printf("ok\n"); 1400 } 1401 1402 1403 if (!Option_CID) { 1404 printf("\n-> ...Current Status... <-\n"); 1405 } 1406 1407 Status_CheckCode(); 1408 if (!Option_CID) { 1409 printf(" - AiR-BOOT is "); 1410 } 1411 Status_PrintF(Status_Code, Installed_CodeVersion); 1412 if (StatusCode==STATUS_IMPOSSIBLE) 1413 return 1; 1414 Status_CheckConfig(); 1415 if (!Option_CID) { 1416 printf(" - Configuration is "); 1417 } 1418 Status_PrintF(Status_Config, Installed_ConfigVersion); 1419 // Display language as well, if code installed 1420 if ((Status_Code==STATUS_INSTALLED) || (Status_Code==STATUS_INSTALLEDMGU)) { 1421 if (!Option_CID) { 1422 printf(" - Language is "); 1423 } 1424 Language_PrintF(Installed_LanguageID); 1425 if (!Option_CID) { 1426 printf("\n"); 1427 } 1428 } 1429 1430 // ============================================================= 1431 // PRE-CHECKING, WHAT WE ARE SUPPOSED TO DO... 1432 // ============================================================= 1433 if ((Option_ForceCode) || (Status_Code!=STATUS_INSTALLED) || (Installed_LanguageID!=Bootcode_LanguageID)) 1434 Install_Code = TRUE; // If LanguageID different or not installed 1435 if ((Option_ForceConfig) || (Status_Config!=STATUS_INSTALLED)) 1436 Install_Config = TRUE; // If not installed 1437 1438 if ((Status_Code==STATUS_CORRUPT) || (Status_Config==STATUS_CORRUPT)) 1439 Install_IsCorrupt = TRUE; // If anything is corrupt 1440 1441 // ============================================================= 1442 // VIRUS 1443 // ============================================================= 1444 // If-Table 1445 // --------- 1446 // Code==not installed, Config=not installed -> Check MBR 1447 // Code==installed, config==installed -> Check MBR (-> Virus?) 1448 // Code==not installed, config==installed -> (-> Virus?) 1449 // Code==installed, config==not installed -> Check MBR (-> Virus?) 1450 1451 //printf("DEBUG: Status_Code: %d, Status_Config: %d\n", Status_Code, Status_Config); // Rousseau: DEBUG 1452 1453 if ((Status_Code==STATUS_NOTINSTALLED) & (Status_Config==STATUS_NOTINSTALLED)) { 1454 // Nothing installed, so check MBR, if squashed... 1455 if (!Virus_CheckCurrentMBR()) { 884 1456 if (!Option_CID) { 885 printf("Probably your system was infected by a virus.\n"); 886 printf("Repairing AiR-BOOT will normally squash the virus.\n"); 887 printf("But to be sure it's gone, you should check your harddisc using a virus-scanner.\n"); 888 } 889 if (!Virus_CheckCurrentMBR()) { 890 // MBR squashed, so check backup and display message 1457 printf("\n\n"); 1458 printf("AiR-BOOT detected that the data on your harddisc got damaged.\n"); 1459 printf("If you had AiR-BOOT installed before: the corruption killed AiR-BOOT completly!\n"); 1460 printf("Installation halted.\n"); 1461 } 1462 return 255; // Rousseau: changed from 1 to 255 1463 } 1464 //printf("DEBUG: Installing...\n"); // Rousseau: DEBUG 1465 } 1466 else { 1467 if ((Status_Code==STATUS_NOTINSTALLED) | (!Virus_CheckCurrentMBR())) { 1468 // Code not installed, but Config or MBR squashed... 1469 // -> Virus proposed, check for backup (if available) 891 1470 if (!Option_CID) { 892 printf("\n"); 893 printf("AiR-BOOT detected that the virus has broken your partition-table.\n"); 894 } 895 if (Virus_CheckForBackUpMBR()) { 896 if (!Option_CID) { 897 printf("Good news: AiR-BOOT has found a (hopefully) functional backup.\n"); 898 printf("Shall I use this backup, instead of the current active one? (Y/N)\n"); 899 } 900 // User selection, Y/N, if he wants to restore MBR 901 // *NOT* CID (silent) able 902 do { 903 UserKey = getch() | 0x20; 904 } while (!((UserKey=='y') | (UserKey=='n'))); 905 if (UserKey=='y') 906 Virus_CopyBackUpMBR(); 907 } else { 1471 printf("\n\n"); 1472 printf("-> ...!ATTENTION!... <-\n"); 1473 } 1474 if (Virus_CheckForStealth()) 908 1475 if (!Option_CID) { 909 printf("Sadly the virus also broke AiR-BOOT's backup. You will have to help yourself.\n"); 910 } 911 } 912 } 913 } 914 } 915 916 // ============================================================= 917 // MAIN-MENU 918 // ============================================================= 919 if (!Option_CID) { 920 printf("\n-> ...Please press... <-\n"); 921 } 922 923 if (!Option_CID) { 924 if (Install_IsCorrupt) printf(" <R> - Repair AiR-BOOT "); 925 else if (Status_Code==STATUS_NOTINSTALLED) printf(" <A> - Add AiR-BOOT "); 926 else printf(" <U> - Update/Change AiR-BOOT to "); 927 printf("'v%x.%1d.%1d/", Bootcode_Version>>8, (Bootcode_Version & 0x0F0)>>4, Bootcode_Version & 0x0F); 928 Language_PrintF(Bootcode_LanguageID); 929 printf("' on current system\n"); 930 931 printf(" <D> - Delete AiR-BOOT from current system\n"); 932 printf(" <Q> - Quit without any change\n"); 933 } 934 935 if (Option_Silent || Option_CID) { 936 // Silent operation? Always add AiR-BOOT then 937 UserKey = 'a'; 938 } else { 939 do { 940 UserKey = getch() | 0x20; 941 } while (!((UserKey=='a') || (UserKey=='r') || (UserKey=='u') || (UserKey=='d') || (UserKey=='q'))); 942 } 943 944 if (!Option_CID) { 945 printf("\n\n\n-------------------------------------------------------------------------------\n"); 946 } 947 switch (UserKey) { 948 case 'a': 949 case 'r': 950 case 'u': { 951 if (Install_Code || Install_Config) { 952 if (!Option_CID) { 953 printf("Add/Repair/Update AiR-BOOT in progress...\n"); 954 } 955 #ifdef PLATFORM_OS2 956 OS2_GetBootAutoDriveLetter(); 957 #endif 958 if (Install_Code) { 1476 printf("Your system GOT infected by a stealth-virus (or your MBR got trashed).\n"); 1477 } 1478 else 1479 if (!Option_CID) { 1480 printf("Probably your system was infected by a virus.\n"); 1481 printf("Repairing AiR-BOOT will normally squash the virus.\n"); 1482 printf("But to be sure it's gone, you should check your harddisc using a virus-scanner.\n"); 1483 } 1484 1485 if (!Virus_CheckCurrentMBR()) { 1486 // MBR squashed, so check backup and display message 1487 if (!Option_CID) { 1488 printf("\n"); 1489 printf("AiR-BOOT detected that the virus has broken your partition-table.\n"); 1490 } 1491 if (Virus_CheckForBackUpMBR()) { 1492 if (!Option_CID) { 1493 printf("Good news: AiR-BOOT has found a (hopefully) functional backup.\n"); 1494 printf("Shall I use this backup, instead of the current active one? (Y/N)\n"); 1495 } 1496 // User selection, Y/N, if he wants to restore MBR 1497 // *NOT* CID (silent) able 1498 do { 1499 UserKey = getch() | 0x20; 1500 } while (!((UserKey=='y') | (UserKey=='n'))); 1501 if (UserKey=='y') 1502 Virus_CopyBackUpMBR(); 1503 } 1504 else { 1505 if (!Option_CID) { 1506 printf("Sadly the virus also broke AiR-BOOT's backup. You will have to help yourself.\n"); 1507 } 1508 } 1509 } 1510 } 1511 } 1512 1513 1514 1515 // ============================================================= 1516 // MAIN-MENU 1517 // ============================================================= 1518 if (!Option_CID) { 1519 printf("\n-> ...Please press... <-\n"); 1520 } 1521 1522 if (!Option_CID) { 1523 if (Install_IsCorrupt) 1524 printf(" <R> - Repair AiR-BOOT "); 1525 else 1526 if (Status_Code==STATUS_NOTINSTALLED) 1527 printf(" <A> - Add AiR-BOOT "); 1528 else 1529 printf(" <U> - Update/Change AiR-BOOT to "); 1530 1531 printf("'v%x.%1d.%1d/", Bootcode_Version>>8, (Bootcode_Version & 0x0F0)>>4, Bootcode_Version & 0x0F); 1532 Language_PrintF(Bootcode_LanguageID); 1533 printf("' on current system\n"); 1534 1535 printf(" <D> - Delete AiR-BOOT from current system\n"); 1536 printf(" <Q> - Quit without any change\n"); 1537 } 1538 1539 if (Option_Silent || Option_CID) { 1540 // Silent operation? Always add AiR-BOOT then 1541 UserKey = 'a'; 1542 } 1543 else { 1544 do { 1545 UserKey = getch() | 0x20; 1546 } while (!((UserKey=='a') || (UserKey=='r') || (UserKey=='u') || (UserKey=='d') || (UserKey=='q'))); 1547 } 1548 1549 if (!Option_CID) { 1550 printf("\n\n\n-------------------------------------------------------------------------------\n"); 1551 } 1552 1553 switch (UserKey) { 1554 case 'a': 1555 case 'r': 1556 case 'u': { 1557 if (Install_Code || Install_Config) { 1558 if (!Option_CID) { 1559 printf("Add/Repair/Update AiR-BOOT in progress...\n"); 1560 } 1561 #ifdef PLATFORM_OS2 1562 OS2_GetBootAutoDriveLetter(); 1563 #endif 1564 if (Install_Code) { 1565 if (!Option_CID) { 1566 printf(" þ Writing AiR-BOOT code..."); 1567 } 1568 Install_WriteCode(); 1569 if (!Option_CID) { 1570 printf("ok\n"); 1571 } 1572 } 1573 if (Install_Config) { 1574 if (!Option_CID) { 1575 printf(" þ Writing AiR-BOOT configuration..."); 1576 } 1577 Install_WriteConfig(); 1578 if (!Option_CID) { 1579 printf("ok\n"); 1580 } 1581 } 1582 1583 if (!Track0Write()) { 1584 if (!Option_CID) { 1585 printf("SAVE ERROR!\n"); 1586 } 1587 return 1; 1588 } 1589 if (!Option_CID) { 1590 printf("\n"); 1591 printf("Your copy of AiR-BOOT is now fully functional.\n"); 1592 if (!Option_Silent) { 1593 printf("Please hit ESC to exit AiR-BOOT installer or ENTER to reboot your system...\n"); 1594 } 1595 } 1596 if (Option_Silent || Option_CID) { 1597 // Silent operation? Always reboot system (shall we do this really?) 1598 // No, otherwise installing from MiniLVM will reboot the system 1599 // which is not what the user would expect. 1600 //UserKey = 0x0D; 1601 UserKey = 0x1B; 1602 } 1603 else { 1604 do { 1605 UserKey = getch(); // React on ENTER or ESC 1606 } while (!((UserKey==0x0D) || (UserKey==0x1B))); 1607 } 1608 if (UserKey==0x0D) { // ENTER reboots system... (if not in eCS install mode) 1609 1610 /* 1611 // Rousseau: ## Disable Reboot when installing eComStation ## 1612 // In the install-environment, the MEMDRIVE env-var is defined. 1613 // So, only reboot if this env-var is not defined. 1614 */ 1615 if (!getenv("MEMDRIVE")) { 1616 if (!Option_CID) { 1617 printf("Now rebooting system...\n"); 1618 } 1619 RebootSystem(); 1620 } 1621 ExitOnly = TRUE; 1622 } 1623 } 1624 else { 1625 if (!Option_CID) { 1626 printf(" þ All components of AiR-BOOT are intact and up-to-date. Nothing to do.\n"); 1627 } 1628 ExitOnly = TRUE; 1629 } 1630 break; 1631 } 1632 case 'd': { 959 1633 if (!Option_CID) { 960 printf(" þ Writing AiR-BOOT code...");961 } 962 Install_WriteCode(); 1634 printf(" þ Removing AiR-BOOT automatically is not possible at this time.\n"); 1635 } 1636 #ifdef PLATFORM_OS2 963 1637 if (!Option_CID) { 964 printf("ok\n"); 965 } 966 } 967 if (Install_Config) { 1638 printf(" You may remove AiR-BOOT manually by entering \"FDISK /MBR\" or \"LVM /NEWMBR:1\"\n"); 1639 printf(" in commandline.\n"); 1640 } 1641 #endif 1642 #ifdef PLATFORM_WINNT 968 1643 if (!Option_CID) { 969 printf(" þ Writing AiR-BOOT configuration..."); 970 } 971 Install_WriteConfig(); 972 if (!Option_CID) { 973 printf("ok\n"); 974 } 975 } 976 977 if (!Track0Write()) { 978 if (!Option_CID) { 979 printf("SAVE ERROR!\n"); 980 } 981 return 1; 982 } 983 if (!Option_CID) { 984 printf("\n"); 985 printf("Your copy of AiR-BOOT is now fully functional.\n"); 986 if (!Option_Silent) { 987 printf("Please hit ESC to exit AiR-BOOT installer or ENTER to reboot your system...\n"); 988 } 989 } 990 if (Option_Silent || Option_CID) { 991 // Silent operation? Always reboot system (shall we do this really?) 992 // No, otherwise installing from MiniLVM will reboot the system 993 // which is not what the user would expect. 994 //UserKey = 0x0D; 995 UserKey = 0x1B; 996 } else { 997 do { 998 UserKey = getch(); // React on ENTER or ESC 999 } while (!((UserKey==0x0D) || (UserKey==0x1B))); 1000 } 1001 if (UserKey==0x0D) { // ENTER reboots system... (if not in eCS install mode) 1002 1003 /* 1004 // Rousseau: ## Disable Reboot when installing eComStation ## 1005 // In the install-environment, the MEMDRIVE env-var is defined. 1006 // So, only reboot if this env-var is not defined. 1007 */ 1008 if (!getenv("MEMDRIVE")) { 1009 if (!Option_CID) { 1010 printf("Now rebooting system...\n"); 1011 } 1012 RebootSystem(); 1013 } 1644 printf(" You may remove AiR-BOOT manually by entering \"FDISK /MBR\" in commandline.\n"); 1645 } 1646 #endif 1014 1647 ExitOnly = TRUE; 1015 } 1016 } else { 1017 if (!Option_CID) { 1018 printf(" þ All components of AiR-BOOT are intact and up-to-date. Nothing to do.\n"); 1019 } 1020 ExitOnly = TRUE; 1021 } 1022 break; 1023 } 1024 case 'd': { 1025 if (!Option_CID) { 1026 printf(" þ Removing AiR-BOOT automatically is not possible at this time.\n"); 1027 } 1028 #ifdef PLATFORM_OS2 1029 if (!Option_CID) { 1030 printf(" You may remove AiR-BOOT manually by entering \"FDISK /MBR\" or \"LVM /NEWMBR:1\"\n"); 1031 printf(" in commandline.\n"); 1032 } 1033 #endif 1034 #ifdef PLATFORM_WINNT 1035 if (!Option_CID) { 1036 printf(" You may remove AiR-BOOT manually by entering \"FDISK /MBR\" in commandline.\n"); 1037 } 1038 #endif 1039 ExitOnly = TRUE; 1040 break; 1041 } 1042 default: 1043 break; 1648 break; 1649 } 1650 default: 1651 break; 1044 1652 } 1045 1653 … … 1051 1659 } 1052 1660 } 1661 1662 // Free the buffer memory. 1663 if (Track0) free(Track0); 1664 if (Bootcode) free(Bootcode); 1665 1053 1666 return 0; 1054 1667 } -
trunk/INSTALL/C/Makefile
r45 r46 1 1 ############################################################################### 2 # Makefile :: Builds FIXCODE program for several platforms. [wmake] # 3 ############################################################################### 4 5 # 6 # This Makefile builds the FIXCODE program for DOS, Windows, OS/2 and Linux. 7 # FIXCODE is used to embed the anti-virus code into the AiR-BOOT image. 8 # This anti-virus code protects the MBR and is installed as a TSR by the 9 # loader. That's why it cannot be included at the source level. 2 # Makefile :: Builds the Installer for several platforms. [wmake] # 3 ############################################################################### 4 # rousseau@ecomstation.com 5 # 6 # Derived from the FIXCODE Makefile. 7 # 8 9 # 10 # This Makefile builds the Installer for DOS, Windows, OS/2 and Linux. 11 # Like FIXCODE, each platform version has a letter appended it: 12 # 'D' for DOS, 'W' for Windows, '2' for OS/2 and 'L' for Linux. 10 13 # 11 14 … … 24 27 # to influence source assembly / compilation. 25 28 # 26 DEBUG_LEVEL=029 RELEASE_CODE=0 27 30 MAX_DEBUG_LEVEL=2 31 #DEBUG_LEVEL=1 32 #DEBUG_LEVEL=$(MAX_DEBUG_LEVEL) 33 DEBUG_LEVEL=$(RELEASE_CODE) 28 34 29 35 # … … 41 47 42 48 # 43 # Base Name of Program to build. 49 # Base Name of Source Program to compile. 50 # 51 BASENAME=INSTALL 52 53 # 54 # Base Name of Executable Module to build. 44 55 # A letter is appended for each platform version: 45 56 # D=DOS, W=Windows, 2=OS2, L=Linux. 46 # The DOS COM-version has no suffix. 47 # 48 BASENAME=FIXCODE 57 # 58 MODULE=AIRBOOT 49 59 50 60 # 51 61 # This is a list of the Targets to be built. 52 62 # 53 TARGETS=$(BASENAME).COM $(BASENAME)D.EXE $(BASENAME)W.EXE $(BASENAME)2.EXE $(BASENAME)L.ELF 54 #TARGETS=$(BASENAME)D.EXE 55 #TARGETS=$(BASENAME).COM 63 TARGETS=$(MODULE)D.EXE $(MODULE)W.EXE $(MODULE)2.EXE $(MODULE)L.ELF 64 56 65 57 66 # … … 92 101 ASM_FLAGS_D0=-D:DEBUG_LEVEL=$(DEBUG_LEVEL) -D:ASSEMBLER=ALP -Mb +Feo:OBJ +Fl +Fel:LST +Fm +Fem:ERR 93 102 ASM_FLAGS_D1=-D:DEBUG_LEVEL=$(DEBUG_LEVEL) -D:ASSEMBLER=ALP -Mb +Od:MS16 +Feo:OBJ +Fl +Fel:LST +Fm +Fem:ERR 94 ASM_FLAGS_D2=-D:DEBUG_LEVEL=$(DEBUG_LEVEL) -D:ASSEMBLER=ALP 103 ASM_FLAGS_D2=-D:DEBUG_LEVEL=$(DEBUG_LEVEL) -D:ASSEMBLER=ALP -Mb +Od:MS16 +Feo:OBJ +Fl +Fel:LST +Fm +Fem:ERR 95 104 !else 96 105 !error Unknown Assembler specified ! … … 101 110 # 16-bits C Compiler 102 111 # 112 MM16=-mc 113 CPU=-2 103 114 CC16=wcc 104 CC16_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -w4 -e25 -zq -od -fo=$^.105 CC16_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -fo=$^.106 CC16_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -fo=$^.115 CC16_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(CPU) $(MM16) -w4 -e25 -zq -osexan -fo=$^. -fr=$^&.ERR 116 CC16_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(CPU) $(MM16) -d2 -w4 -e25 -zq -on -fo=$^. -fr=$^&.ERR 117 CC16_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(CPU) $(MM16) -d3 -w4 -e25 -zq -od -fo=$^. -fr=$^&.ERR 107 118 CC16_FLAGS=$(CC16_FLAGS_D$(DEBUG_LEVEL)) 108 119 … … 110 121 # 32-bits C Compiler 111 122 # 123 MM32=-mf 112 124 CC32=wcc386 113 CC32_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -w4 -e25 -zq -od -6r -mf -fo=$^. 114 CC32_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -6r -mf -fo=$^. 115 CC32_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -6r -mf -fo=$^. 116 CC32_FLAGS_R=-w4 -e25 -zq -od -6r -mf -fo=$^. 125 CC32_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM32) -w4 -e25 -zq -osexan -6r -fo=$^. -fr=$^&.ERR 126 CC32_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM32) -d2 -w4 -e25 -zq -on -6r -fo=$^. -fr=$^&.ERR 127 CC32_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM32) -d3 -w4 -e25 -zq -od -6r -fo=$^. -fr=$^&.ERR 117 128 CC32_FLAGS=$(CC32_FLAGS_D$(DEBUG_LEVEL)) 118 129 … … 121 132 # 122 133 LNK=wlink 134 # 135 # DESCRIPTION does not work under WLink/Linux 136 # @ Cannot be escaped like with \x40 and it is still processed in quotes. 137 # WLink/2 can use the '\x40' variant. 138 # 139 #~ LNK_FLAGS_D0=op q op v op map=$^&.MAP op de '\x40\x23KIEWITZ:1.18\x23\x40\x41iR-BOOT Installer by Kiewitz' 123 140 LNK_FLAGS_D0=op q op v op map=$^&.MAP 141 #~ LNK_FLAGS_D1=op q op v d all & 142 #~ order clname CODE clname FAR_CONST clname FAR_DATA clnam BEGDATA clname DATA clname BSS clname STACK clname BLAP NOE & 143 #~ op map=$^&.MAP 124 144 LNK_FLAGS_D1=op q op v d all op map=$^&.MAP 125 145 LNK_FLAGS_D2=op q op v d all op map=$^&.MAP … … 172 192 @echo. 173 193 @echo ===================================================================== 174 @echo = PROGRAM: FIXCODEMulti Platform [DOS, Win32, OS/2 and Linux] =194 @echo = PROGRAM: INSTALL Multi Platform [DOS, Win32, OS/2 and Linux] = 175 195 @echo ===================================================================== 176 196 # @echo. … … 233 253 234 254 ############################################################################### 235 # DOS 16-bits (COM) 236 ############################################################################### 237 $(BASENAME).COM: $(BASENAME).OBJ 238 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys dos com 255 # DOS 16-bits (MZ) 256 ############################################################################### 257 $(MODULE)D.EXE: $(MODULE)D.OBJ 258 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys dos 259 @wdump $^. > $^&.WDU 239 260 @if exist $^. @echo $^. $(MSG_SUCCESS) 240 261 @echo. 241 242 $(BASENAME).OBJ: $(BASENAME).ASM 243 # @echo. 244 @echo TARGET: $^&.COM [DOS 16-bits COM-file] 245 $(ASM) $(ASM_FLAGS) $(BASENAME).ASM 246 @wdis $^. > $^&.WDA 247 248 249 ############################################################################### 250 # DOS 16-bits (MZ) 251 ############################################################################### 252 $(BASENAME)D.EXE: $(BASENAME)D.OBJ 253 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys dos 262 #~ wstrip $^. 263 264 $(MODULE)D.OBJ: $(BASENAME).C $(BASENAME).H 265 # @echo. 266 @echo TARGET: $^&.EXE [DOS 16-bits Executable] 267 $(CC16) $(CC16_FLAGS) -I$(%WATCOM)$(DS)h$(DS)os2 -bt=dos $(BASENAME).C 268 @wdis -fi $^. > $^&.WDA 269 270 271 ############################################################################### 272 # NT 32-bits (PE) 273 ############################################################################### 274 $(MODULE)W.EXE: $(MODULE)W.OBJ 275 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys nt 276 @wdump $^. > $^&.WDU 254 277 @if exist $^. @echo $^. $(MSG_SUCCESS) 255 278 @echo. 256 279 257 $(BASENAME)D.OBJ: $(BASENAME).C $(BASENAME).H 258 # @echo. 259 @echo TARGET: $^&.EXE [DOS 16-bits Executable] 260 $(CC16) $(CC16_FLAGS) -bt=dos $(BASENAME).C 261 @wdis $^. > $^&.WDA 262 263 264 ############################################################################### 265 # NT 32-bits (PE) 266 ############################################################################### 267 $(BASENAME)W.EXE: $(BASENAME)W.OBJ 268 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys nt 269 @if exist $^. @echo $^. $(MSG_SUCCESS) 270 @echo. 271 272 $(BASENAME)W.OBJ: $(BASENAME).C $(BASENAME).H 280 $(MODULE)W.OBJ: $(BASENAME).C $(BASENAME).H 273 281 # @echo. 274 282 @echo TARGET: $^&.EXE [NT 32-bits Executable] 275 283 $(CC32) $(CC32_FLAGS) -I$(%WATCOM)$(DS)h$(DS)nt -bt=nt $(BASENAME).C 276 @wdis $^. > $^&.WDA284 @wdis -fi $^. > $^&.WDA 277 285 278 286 … … 280 288 # OS/2 32-bits (LX) 281 289 ############################################################################### 282 $( BASENAME)2.EXE: $(BASENAME)2.OBJ290 $(MODULE)2.EXE: $(MODULE)2.OBJ 283 291 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys os2v2 292 @wdump $^. > $^&.WDU 284 293 @if exist $^. @echo $^. $(MSG_SUCCESS) 285 294 @echo. 286 287 $(BASENAME)2.OBJ: $(BASENAME).C $(BASENAME).H 295 #~ wstrip $^. 296 297 $(MODULE)2.OBJ: $(BASENAME).C $(BASENAME).H 288 298 # @echo. 289 299 @echo TARGET: $^&.EXE [OS/2 32-bits Executable] 290 300 $(CC32) $(CC32_FLAGS) -I$(%WATCOM)$(DS)h$(DS)os2 -bt=os2 $(BASENAME).C 291 @wdis $^. > $^&.WDA301 @wdis -fi $^. > $^&.WDA 292 302 293 303 … … 295 305 # Linux 32-bits (ELF) 296 306 ############################################################################### 297 $( BASENAME)L.ELF: $(BASENAME)L.OBJ307 $(MODULE)L.ELF: $(MODULE)L.OBJ 298 308 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^&.ELF sys linux 309 @wdump $^. > $^&.WDU 299 310 # $(MV) $^&.ELF $^. 300 311 @if exist $^. @echo $^. $(MSG_SUCCESS) 301 312 @echo. 302 313 303 $( BASENAME)L.OBJ: $(BASENAME).C $(BASENAME).H314 $(MODULE)L.OBJ: $(BASENAME).C $(BASENAME).H 304 315 # @echo. 305 316 @echo TARGET: $^&.ELF [Linux 32-bits Executable] 306 $(CC32) $(CC32_FLAGS) - bt=linux $(BASENAME).C307 @wdis $^. > $^&.WDA317 $(CC32) $(CC32_FLAGS) -I$(%WATCOM)$(DS)h$(DS)os2 -bt=linux $(BASENAME).C 318 @wdis -fi $^. > $^&.WDA 308 319 309 320 … … 330 341 @if exist *.OBJ $(RM) *.OBJ 331 342 @if exist *.WDA $(RM) *.WDA 343 @if exist *.WDU $(RM) *.WDU 344 @if exist *.NDA $(RM) *.NDA 332 345 @if exist *.MAP $(RM) *.MAP 333 346 @if exist *.LST $(RM) *.LST -
trunk/INSTALL/C/_build.cmd
r32 r46 1 /* REXX */ 2 3 /* -r use release flags, -d use debug flags */ 4 debug='-r'; 5 6 /* OS2 version */ 7 'ide2make '||debug||' -p OS2.WPJ'; 8 'wmake -h -f OS2.MK'; 9 10 /* WIN32 version */ 11 'ide2make '||debug||' -p WIN32.WPJ'; 12 'wmake -h -f WIN32.MK'; 13 1 wmake clean 2 wmake -
trunk/INSTALL/C/_clean.cmd
r30 r46 1 /* REXX */ 2 3 /* Cleanup OS2 files */ 4 '@if exist OS2.MK del OS2.MK'; 5 '@if exist INST-OS2.EXE del INST-OS2.EXE'; 6 '@if exist INST-OS2.OBJ del INST-OS2.OBJ'; 7 '@if exist INST-OS2.MK1 del INST-OS2.MK1'; 8 '@if exist INST-OS2.LK1 del INST-OS2.LK1'; 9 '@if exist INST-OS2.MAP del INST-OS2.MAP'; 10 '@if exist *.err del *.err'; 11 '@if exist ..\..\RELEASE\OS2\AIRBOOT2.EXE del ..\..\RELEASE\OS2\AIRBOOT2.EXE'; 12 13 /* Cleanup WIN32 files */ 14 '@if exist WIN32.MK del WIN32.MK'; 15 '@if exist INST-WIN.EXE del INST-WIN.EXE'; 16 '@if exist INST-WIN.OBJ del INST-WIN.OBJ'; 17 '@if exist INST-WIN.MK1 del INST-WIN.MK1'; 18 '@if exist INST-WIN.LK1 del INST-WIN.LK1'; 19 '@if exist INST-WIN.MAP del INST-WIN.MAP'; 20 '@if exist *.err del *.err'; 21 '@if exist ..\..\RELEASE\WINNT\AIRBOOTW.EXE del ..\..\RELEASE\WINNT\AIRBOOTW.EXE'; 1 @wmake clean -
trunk/INSTALL/DOS/Makefile
r45 r46 1 ############################################################### 2 # Makefile :: Builds the MBR Protection Image.#3 ############################################################### 1 ############################################################################### 2 # Makefile :: Builds the MBR_PROT.BIN 16-bits RAW Protection Image. # 3 ############################################################################### 4 4 # rousseau@ecomstation.com 5 5 # … … 45 45 # Source Level base-name of Target to build. 46 46 # 47 BASENAME= MBR_PROT47 BASENAME=AIRBOOT 48 48 49 49 # … … 56 56 # For MBR_PROT there is only one real target: MBR_PROT.BIN. 57 57 # 58 TARGET=$(MODULE). BIN58 TARGET=$(MODULE).COM 59 59 60 60 # … … 81 81 # -Cp = case sensitive symbols 82 82 # -zcw = no _ prefix on symbols (C model) 83 ASM_FLAGS_D0=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q - zcw -nt='CODE_SEG' -nd='DATA_SEG' -Fo$^.-Fw$^&.ERR84 ASM_FLAGS_D1=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q - zcw -Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR85 ASM_FLAGS_D2=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q - zcw -Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR83 ASM_FLAGS_D0=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -Cp -zcw -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR 84 ASM_FLAGS_D1=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -Cp -zcw -Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR 85 ASM_FLAGS_D2=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -Cp -zcw -Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR 86 86 !elseif "$(ASM)"=="masm" 87 87 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dMASM -zq -fo=$^. -fr=$^&.ERR … … 94 94 !elseif "$(ASM)"=="tasm" 95 95 # -ml = case sensitive symbols 96 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -m 9 -l97 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -m 9 -z -zi -c -la98 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -m 9 -z -zi -c -la96 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -ml -m9 -l 97 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -ml -m9 -z -zi -c -la 98 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -ml -m9 -z -zi -c -la 99 99 !elseif "$(ASM)"=="alp" 100 100 ASM_FLAGS_D0=-D:DEBUG_LEVEL=$(DEBUG_LEVEL) -D:ALP -Mb +Feo:OBJ +Fl +Fel:LST +Fm +Fem:ERR … … 133 133 134 134 # 135 # This builds all the languagesusing normal dependency rules.135 # This builds the target using normal dependency rules. 136 136 # If this Makefile was modified, all targets are forcefully rebuilt. 137 # At the end all intermediate files are deleted. 138 # Use wmake dev to to development; this generated one image and leaves 139 # the intermediate files intact. 140 # 141 all: .SYMBOLIC Makefile.bu $(TARGET) footer 142 # @echo ALL !! 143 # @#MAKE $(BLD_LANGUAGES) 144 # @for %%i in ($(BLD_LANGUAGES)) do @%MAKE AB-%%i 145 # @echo $< 146 # @%MAKE clean 147 148 149 # 150 # Some targets have the .MULTIPLE directive defined. 151 # This is because the iteration "calls" for the creation of other (meta) 152 # targets. If .MULTIPLE would not be defined these (meta) targets would not 153 # be "built" anymore because the are considered up-to-date. 154 # With multiple this assumption is removed and the target is "rebuilt" for 155 # every target that depends on it. 156 # This mostly concerns meta operations like clean etc., 157 # but of course also the main building of the AIRBOOT.BIN module. 158 # 137 # 138 all: .SYMBOLIC Makefile.bu header $(TARGET) footer 139 159 140 160 141 # 161 142 # Show the header. 162 143 # 163 header: .SYMBOLIC .MULTIPLE144 header: .SYMBOLIC 164 145 @echo. 165 146 @echo ===================================================================== 166 @echo = MODULE: $(TARGET) [$(%BLD_LANG)] [16-bits Raw Binary Loader] =147 @echo = MODULE: $(TARGET) [16-bits Raw Protection Image] = 167 148 @echo ===================================================================== 168 149 # @echo. … … 197 178 # 198 179 199 ###############################################################################200 # 16-bits RAW :: MBR virus protection to be embedded in the AIRBOOT.BIN image.201 ###############################################################################202 $(TARGET): .MULTIPLE $(BASENAME).COM203 # $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys dos com204 $(CP) $(BASENAME).COM $(TARGET)205 # @echo $(%BLD_LANG)>$^.206 @if exist $^. @echo $^. $(MSG_SUCCESS) - [$(%BLD_LANG) version]207 # $(RM) $(TARGET)208 # @echo.209 210 211 180 212 181 ############################################################################### 213 182 # 16-bits COM :: Intermediate image without embedded MBR-prot. and code count. 214 183 ############################################################################### 215 $(BASENAME).COM: .MULTIPLE$(BASENAME).OBJ184 $(BASENAME).COM: $(BASENAME).OBJ 216 185 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys dos com 217 186 # $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. form raw … … 219 188 # @echo. 220 189 221 $(BASENAME).OBJ: .MULTIPLE$(BASENAME).ASM190 $(BASENAME).OBJ: $(BASENAME).ASM 222 191 # @echo. 223 192 @echo TARGET: $^. [DOS 16-bits Raw Image] 224 193 $(ASM) $(ASM_FLAGS) $(BASENAME).ASM 225 @wdis $^. > $^&.WDA194 @wdis -fi $^. > $^&.WDA 226 195 227 196 … … 242 211 # Remove all generated files. 243 212 # 244 clean: .SYMBOLIC .MULTIPLE213 clean: .SYMBOLIC 245 214 # @echo CLEANING UP 246 215 # @for %%i in ($(TARGET)) do @if exist %%i $(RM) %%i 247 216 @if exist *.COM $(RM) *.COM 217 @if exist *.BIN $(RM) *.BIN 248 218 @if exist *.OBJ $(RM) *.OBJ 249 219 @if exist *.WDA $(RM) *.WDA 220 @if exist *.NDA $(RM) *.NDA 250 221 @if exist *.MAP $(RM) *.MAP 251 222 @if exist *.LST $(RM) *.LST -
trunk/INSTALL/INST_X86/INSTALL.INC
r38 r46 146 146 call APIShowMessage 147 147 call Init_CheckBackupMBR 148 jc VirusNoBack Up148 jc VirusNoBackup 149 149 mov si, offset TXT_MBRfail_Strike 150 150 call APIShowMessage … … 220 220 mov si, offset TXT_AfterAdd 221 221 call APIShowMessage 222 call MenuWaitForE NTER222 call MenuWaitForEnter 223 223 call APIAfterAdd 224 224 … … 230 230 mov si, offset TXT_AfterDelete 231 231 call APIShowMessage 232 call MenuWaitForE NTER232 call MenuWaitForEnter 233 233 call APIAfterDelete 234 234 235 235 MenuProcessQUIT:mov si, offset TXT_AfterQuit 236 236 call APIShowMessage 237 call MenuWaitForE NTER237 call MenuWaitForEnter 238 238 call APIAfterQuit 239 239 -
trunk/Makefile
r37 r46 1 1 ############################################################################### 2 # Makefile :: Builds AiR-BOOT for all supported Languages.#2 # Makefile :: Builds complete AiR-BOOT; all supported Languages and Platforms # 3 3 ############################################################################### 4 4 # rousseau@ecomstation.com 5 5 # 6 # The default language for the loader code is EN. 7 # Supported languages are: EN,DE,FR,SW,IT,NL,RU. 8 # The 1.06 version used 'DT' for the Dutch language, 9 # this has been changed to 'NL'. 10 # To build all languages, set the LANGUAGE macro below to ALL. 6 7 # This is the Master Makefile and it builds the whole AiR-BOOT she-bang: 8 # - The AiR-BOOT Loader Code for all supported languages. 9 # - The MBR Protection Image that get's embedded in the loader. 10 # - The FIXCODE program that embeds the MBR Protection Image. 11 # - The Installers for all supported platforms. 12 # - The SET(A)BOOT program for all supported platforms. (currently only OS/2) 13 14 15 # Note: 16 # AiR-BOOT and it's helpers are relatively small to build. 17 # So, although Makefiles are being used to build the lot, there is no explicit 18 # separation between assembling/compiling from source or just only linking. 19 # In fact, because of multiple languages for the Loader and cross-platform 20 # support for the Helpers, any target will almost always be built from source 21 # everytime. 22 23 # Also: 24 # While WMake does it's job, running it on Linux requires a bit of extra effort 25 # with regard to case sensitivity, directory separators, escape characters 26 # and other platform differences. 27 # This is handled in MAKEFILE.MIF. 28 29 30 31 # DEFINITIONS AND STUFF 32 # _____________________________________________________________________________ 33 34 # This one is defined in the Environment so that all 'called' WMake invocations 35 # can adjust their behavior when they are invoked from this Master. 36 # When invoked from this Master, it is assumed the user/developer 37 # 'just-wants-to-have-all-the-stuff-built', so some messages are suppressed and 38 # some stuff is overridden. 39 # Building from this Master is how AiR-BOOT is built when released. 40 # It will force JWasm as the assembler and force DEBUG_LEVEL to 0. 41 # Also, targets are distributed to the RELEASE directory. 42 # Usage of lower level Makefiles directly is considered 'development'. 43 %MASTER=TRUE 44 45 # Include a Master Makefile with several cross-platform definitions and macros. 46 # This is used to compensate for the differences between the target platforms. 47 !include INCLUDE/MAKEFILE.MIF 48 49 50 # These are the Build Directories (Components) that produce 51 # one or more targets. WMake is invoked from this Master Makefile in each of 52 # this directories to produce the corresponding component. 53 # Note that the %MASTER Environment variable above is passed 54 # to influence build behavior of the individual Makefiles. 55 # The order of these Build Directories matters ! 11 56 # 12 LANGUAGE=EN 13 57 # - MBR-PROT ; MBR Protection Image later to be embedded. 58 # - INTERNAL ; FIXBOOT program to embed the Protection Image. 59 # - BOOTCODE ; AiR-BOOT Boot Manager itself. 60 # - INSTALL/C ; Installer for multiple platforms. 61 # - INSTALL/DOS ; Old DOS installer -- will be removed when converted to C. 62 # - SETABOOT ; SETABOOT Manager for OS/2 -- other platforms not yet. 14 63 # 15 # Used tools: 16 # Open Watcom v1.9 17 # Tasm v4.1 DOS (136018 bytes) 18 # Tlink v4.0 DOS (72585 bytes) 19 # Caldera EXE2BIN.EXE R1.01 (9845 bytes) 20 # 21 22 23 # 24 # Build the loader code, the installers and SETABOOT. 25 # 26 all: .SYMBOLIC 27 # AiR-BOOT loader code 28 cd BOOTCODE 29 call _clean.cmd 30 call _build.cmd $(LANGUAGE) 31 @cd .. 32 33 # OS2 and WIN32 installer 34 cd INSTALL\C 35 call _clean.cmd 36 call _build.cmd 37 cd ..\.. 38 39 # OS2 SETABOOT 40 cd TOOLS\OS2\SETABOOT 41 call _clean.cmd 42 call _build.cmd 43 cd ..\..\.. 44 45 # 46 # Cleanup. 47 # 48 clean: .SYMBOLIC 49 cd BOOTCODE 50 call _clean.cmd 51 cd MBR-PROT 52 call _clean.cmd 53 cd .. 54 cd .. 55 56 cd INSTALL\C 57 call _clean.cmd 58 cd ..\.. 59 60 cd TOOLS\OS2\SETABOOT 61 call _clean.cmd 62 cd ..\..\.. 63 64 cd TOOLS\INTERNAL 65 call _clean.cmd 66 cd ..\.. 64 COMPONENTS=& 65 BOOTCODE$(DS)MBR-PROT& 66 TOOLS$(DS)INTERNAL& 67 BOOTCODE& 68 INSTALL$(DS)C& 69 INSTALL$(DS)DOS& 70 TOOLS$(DS)OS2$(DS)SETABOOT& 71 72 73 74 75 # MAIN ACTIONS 76 # _____________________________________________________________________________ 77 78 79 # ----------------------------------------------------------------------------- 80 # MAIN :-) 81 # ----------------------------------------------------------------------------- 82 # Unless another target is specified, a 'build' is the default action. 83 # Using wmake build would be equivalent. 84 # ----------------------------------------------------------------------------- 85 all: .SYMBOLIC Makefile.bu 86 @%MAKE build 87 88 89 90 # ----------------------------------------------------------------------------- 91 # BUILD EVERYTHING 92 # ----------------------------------------------------------------------------- 93 # Here we iterate over all AiR-BOOT components that have a Makefile. 94 # To be able to influence the 'action' we pass that using the Environment. 95 # In this case we are 'building'. 96 # Note that we don't use %ACTION=, because that would be evaluated by WMake 97 # when parsing the Makefile. It needs to be a command related to the target. 98 # ----------------------------------------------------------------------------- 99 build: .SYMBOLIC 100 @SET ACTION=BUILD 101 @for %%i in ($(COMPONENTS)) do @$(MAKE) -h %%i 102 @echo. 103 @echo ** Success !! ** 104 @echo All AiR-BOOT stuff has been built. 105 @echo Look in the RELEASE directory for the distribution files 106 @echo for each platform. 107 @echo The PACKAGES directory contains packages for each supported 108 @echo platform. 109 @echo. 110 111 112 # ----------------------------------------------------------------------------- 113 # CLEANUP EVERYTHING 114 # ----------------------------------------------------------------------------- 115 # Here we iterate over all AiR-BOOT components that have a Makefile. 116 # To be able to influence the 'action' we pass that using the Environment. 117 # In this case we are 'cleaning'. 118 # Note that we don't use %ACTION=, because that would be evaluated by WMake 119 # when parsing the Makefile. It needs to be a command related to the target. 120 # ----------------------------------------------------------------------------- 121 clean: .SYMBOLIC 122 @SET ACTION=CLEAN 123 @for %%i in ($(COMPONENTS)) do @$(MAKE) -h %%i 124 @echo. 125 @echo Done. 126 @echo. 127 128 129 # ----------------------------------------------------------------------------- 130 # SHOW HELP ON USING THIS MAKEFILE 131 # ----------------------------------------------------------------------------- 132 help: .SYMBOLIC 133 @echo. 134 @echo The following actions are available: 135 @echo wmake to build all targets and all languages 136 @echo wmake dev to build a develoopment target 137 @echo wmake [LANG] to build EN,DE,NL,FR,IT or RU versions 138 @echo wmake list to show the list of buildable targets 139 @echo wmake clean to remove almost all generated files 140 @echo wmake rmbin to remove all residual BIN files 141 @echo wmake rebuild to rebuild all targets 142 @echo wmake dist to populate the dist directories 143 @echo wmake help for this information 144 @echo. 145 146 147 148 149 150 151 152 # ----------------------------------------------------------------------------- 153 # CHECK FOR MAKEFILE CHANGES 154 # ----------------------------------------------------------------------------- 155 # Create a backup of the Makefile when it is modified. 156 # This also forces a rebuild of all targets. 157 # ----------------------------------------------------------------------------- 158 Makefile.bu: Makefile 159 @echo. 160 @echo Makefile modified, forcing rebuild of all targets ! 161 @echo. 162 @%MAKE clean 163 @$(CP) Makefile Makefile.bu > $(NULDEV) 164 165 166 167 # GENERIC HANDLERS 168 # _____________________________________________________________________________ 169 170 171 # ----------------------------------------------------------------------------- 172 # ACTION HANDLER FOR BUILD DIRECTORIES 173 # ----------------------------------------------------------------------------- 174 # This is the generic handler. 175 # The action to undertake is set in the Environment. 176 # It functions like a "switch". 177 # ----------------------------------------------------------------------------- 178 $(COMPONENTS): .SYMBOLIC 179 @echo. 180 @echo. 181 @echo. 182 !if "$(%ACTION)"=="BUILD" 183 @echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 184 @echo @@ BUILDING $@ 185 @echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 186 @echo. 187 @cd $@ 188 @$(MAKE) -h 189 !elseif "$(%ACTION)"=="CLEAN" 190 @echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 191 @echo @@ CLEANING $@ 192 @echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 193 @echo. 194 @cd $@ 195 @$(MAKE) -h clean 196 !else 197 @echo. 198 @echo !! Undefined Action !! 199 @echo. 200 !endif 201 202 -
trunk/TOOLS/DOS/SETABOOT/SETABOOT.ASM
r37 r46 20 20 21 21 Include ../../../INCLUDE/ASM.INC 22 include ../../../INCLUDE/DOS/AIRBOOT.INC22 ;include ../../../INCLUDE/DOS/AIRBOOT.INC 23 23 24 24 .386p … … 60 60 db ' detected.', 13, 10, 0 61 61 62 Include ../../../INCLUDE/DOS/CONST.ASM62 ; Include ../../../INCLUDE/DOS/CONST.ASM 63 63 64 64 AiRBOOTdetected db 0 -
trunk/TOOLS/INTERNAL/FIXCODE
r43 r46 4 4 # $airboot@ecomstation.com$ 5 5 # 6 # This is a hack until the Linux version of FIXCODE.C is finished.6 # This is a quick-hack until the Linux version of FIXCODE.C is finished. 7 7 # Note that it does not search for the AiR-BOOT Protection Signature, 8 8 # but embeds it at the 'well known' location. 9 # I t the protection image is moved, this script will corrupt AIR-BOOT.COM10 # of which the final AIRBOOT.BIN is derived.9 # If the protection image is moved, this script will produce a corrupted 10 # AIRBOOT.BIN. 11 11 # Also, a code-size of 35h (max size) is always inserted. 12 # Furthermore, it does no sanity checks whatsoever.12 # Furthermore, it does not do any sanity checks whatsoever. 13 13 # 14 14 15 PROT_IMG="MBR-PROT/MBR_PROT.COM" 15 # 16 # This script is now obsolete. 17 # 18 exit 1; 19 20 21 PROT_IMG="MBR-PROT/MBR-PROT.BIN" 16 22 AB_INTERIM_IMG="AIR-BOOT.COM" 23 AB_IMG="AIRBOOT.BIN" 17 24 CODE_SIZE_OFFSET=16 18 25 PROT_IMG_OFFSET=26624 19 26 20 27 28 function echox() { 29 echo -e $@; 30 } 31 32 21 33 function Header() { 22 echo "Header";34 echox "\t## FIXCODE script for Linux ##"; 23 35 } 24 36 25 37 function CheckIfFileExists() { 26 echo "CheckIfFileExists";38 echox "\tCheckIfFileExists"; 27 39 if [ ! -f "${1}" ]; then 28 echo "ERROR: File ${1} could not be found !";29 echo "Aborting...";40 echox "\tERROR: File ${1} could not be found !"; 41 echox "\t Aborting..."; 30 42 exit 1; 31 43 else 32 echo "File ${1} found, OK.";44 echox "\tFile ${1} found, OK."; 33 45 fi; 34 46 } 35 47 48 function CreateImage() { 49 echox "\tCreateImage"; 50 cp -a "${1}" "${2}"; 51 } 52 36 53 function EmbedCodeSize() { 37 echo "EmbedCodeSize"; 38 echo -n "5" | dd of="${1}" bs=1 seek=${CODE_SIZE_OFFSET} conv=notrunc; 54 echox "\tEmbedCodeSize"; 55 echo "${1}" 56 echo -n "5" | dd of="${1}" bs=1 seek=${CODE_SIZE_OFFSET} conv=notrunc 2> /dev/null; 39 57 } 40 58 41 59 function EmbedProtectionImage() { 42 echo "EmbedProtectionImage";43 dd if="${1}" of="${2}" bs=1 seek=${PROT_IMG_OFFSET} conv=notrunc ;60 echox "\tEmbedProtectionImage"; 61 dd if="${1}" of="${2}" bs=1 seek=${PROT_IMG_OFFSET} conv=notrunc 2> /dev/null; 44 62 } 45 63 46 64 function VerifyImage() { 47 echo "VerfyImage";65 echox "\tVerfyImage"; 48 66 } 49 67 50 68 function Footer() { 51 echo "Footer"; 69 echox "\t## AiR-BOOT code fixed ##"; 70 echo ""; 52 71 } 53 72 … … 58 77 # 59 78 function Main() { 60 echo "## Main ##";79 echo ""; 61 80 Header; 62 CheckIfFileExists "${PROT_IMG}" 63 CheckIfFileExists "${AB_INTERIM_IMG}" 64 EmbedCodeSize "${AB_INTERIM_IMG}"; 65 EmbedProtectionImage "${PROT_IMG}" "${AB_INTERIM_IMG}"; 81 CheckIfFileExists "${PROT_IMG}"; 82 CheckIfFileExists "${AB_INTERIM_IMG}"; 83 CreateImage "${AB_INTERIM_IMG}" "${AB_IMG}"; 84 EmbedProtectionImage "${PROT_IMG}" "${AB_IMG}"; 85 EmbedCodeSize "${AB_IMG}"; 66 86 Footer; 67 87 } -
trunk/TOOLS/INTERNAL/FIXCODE.ASM
r43 r46 41 41 COM_CodeName db 'AIR-BOOT.COM', 0 42 42 COM_LoadMBR db ' - Loading MBR-protection from file...$' 43 COM_MBRName db 'MBR-PROT\MBR _PROT.COM', 043 COM_MBRName db 'MBR-PROT\MBR-PROT.BIN', 0 44 44 COM_MergeMBR db ' - Merging MBR-protection into bootcode...$' 45 45 COM_CountCode db ' - Count code in bootcode-image...$' … … 51 51 COM_FailedReadCode db 'Read air-boot.com failed', 13, 10, '$' 52 52 COM_FailedInvalidCode db 'Invalid air-boot.com', 13, 10, '$' 53 COM_FailedOpenMBR db 'mbr-prot\mbr _prot.comnot found', 13, 10, '$'54 COM_FailedReadMBR db 'Read mbr-prot\mbr _prot.comfailed', 13, 10, '$'55 COM_FailedInvalidMBR db 'Invalid mbr-prot\mbr _prot.com', 13, 10, '$'53 COM_FailedOpenMBR db 'mbr-prot\mbr-prot.bin not found', 13, 10, '$' 54 COM_FailedReadMBR db 'Read mbr-prot\mbr-prot.bin failed', 13, 10, '$' 55 COM_FailedInvalidMBR db 'Invalid mbr-prot\mbr-prot.bin', 13, 10, '$' 56 56 COM_FailedWriteCode db 'Write air-boot.com failed', 13, 10, '$' 57 57 … … 65 65 ShowMessage EndP 66 66 67 ShowError Proc Near 68 mov ah, 09h 69 int 21h ; DOS: WRITE STRING DS:DX TO CONSOLE 70 jmp EndProgram 71 ret 72 ShowError EndP 67 ShowError Proc Near 68 mov ah, 09h 69 int 21h ; DOS: WRITE STRING DS:DX TO CONSOLE 70 mov al,1 ; Error code 71 jmp EndProgram 72 ret 73 ShowError EndP 73 74 74 75 COM_Init: … … 128 129 call ShowMessage 129 130 130 ; Open MBR_PROT. COM131 ; Open MBR_PROT.BIN 131 132 mov dx, offset COM_LoadMBR 132 133 call ShowMessage … … 141 142 DoneOpenMBR: mov bx, ax ; BX = Filehandle 142 143 143 ; Load MBR _PROT.COM144 ; Load MBR-PROT.BIN 144 145 mov ah, 3Fh 145 146 mov cx, 1024 ; Image size … … 204 205 mov dx, offset COM_Failed 205 206 call ShowMessage 207 mov al,2 ; Error code 206 208 jmp EndProgram 207 209 … … 220 222 221 223 mov si, offset BootCode 222 add si, 512*53 223 mov cx, 256 224 mov dx, 53 224 add si, 512*53 ; 6A00 225 mov cx, 256 ; 512 bytes 226 mov dx, 53 ; initial count 225 227 COM_CodeEndLoop:push cx 226 228 push si … … 277 279 mov dx, offset COM_Okay 278 280 call ShowMessage 281 xor al,al ; No Error 279 282 jmp EndProgram 280 283 … … 282 285 EndProgram: 283 286 ; DOS: TERMINATE PROGRAM 284 mov a x, 4C00h287 mov ah, 04Ch 285 288 int 21h 286 289 -
trunk/TOOLS/INTERNAL/FIXCODE.C
r37 r46 1 // AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz 2 // 3 // This file is part of AiR-BOOT 4 // 5 // AiR-BOOT is free software: you can redistribute it and/or modify it under 6 // the terms of the GNU General Public License as published by the Free 7 // Software Foundation, either version 3 of the License, or (at your option) 8 // any later version. 9 // 10 // AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY 11 // WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS 12 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 13 // details. 14 // 15 // You should have received a copy of the GNU General Public License along with 16 // AiR-BOOT. If not, see <http://www.gnu.org/licenses/>. 17 // 18 19 /* 20 // FIXCODE.C -- Fix the AiR-BOOT image; include the code-size and MBR prot-img. 21 // This reads AIR-BOOT.COM, merges MBR-PROT.BIN and writes AIRBOOT.BIN. 22 // It is a quick-and-dirty translation of the original DOS-only ASM file. 23 // Of course it's not as small but it's much easier to maintain across 24 // multiple platforms. 25 */ 26 27 1 28 #include "FIXCODE.H" 2 29 … … 19 46 20 47 21 #define IN_FILE "AIR-BOOT.COM" // Target from assembly. 22 #define MERGE_FILE "MBR_PROT.BIN" // MBR protection TSR. 23 #define OUT_FILE "AIRBOOT.BIN" // Generated loader image. 24 25 26 48 /* File names */ 49 #define IN_FILE "AIR-BOOT.COM" // Target from assembly. 50 #ifdef PLATFORM_LINUX 51 #define MERGE_FILE "MBR-PROT/MBR-PROT.BIN" // MBR protection TSR. 52 #else 53 #define MERGE_FILE "MBR-PROT\\MBR-PROT.BIN" // MBR protection TSR. 54 #endif 55 #define OUT_FILE "AIRBOOT.BIN" // Generated loader image. 56 57 58 /* Copyright message */ 59 char Copyright[] = "AiR-BOOT Bootcode Image Fix\n" 60 " - (c) Copyright 2009-2012 by M. Kiewitz\n"; 61 /* Progress messages */ 62 char LoadCode[] = " - Loading bootcode from file..."; 63 char LoadMBR[] = " - Loading MBR-protection from file..."; 64 char MergeMBR[] = " - Merging MBR-protection into bootcode..."; 65 char CountCode[] = " - Count code in bootcode-image..."; 66 char WriteCode[] = " - Saving bootcode to file..."; 67 char Okay[] = "ok\n"; 68 char Failed[] = "failed\n"; 69 70 /* Error messages */ 71 char FailedOpenCode[] = IN_FILE" not found\n"; 72 char FailedReadCode[] = "Read "IN_FILE" failed\n"; 73 char FailedInvalidCode[] = "Invalid "IN_FILE"\n"; 74 char FailedOpenMBR[] = MERGE_FILE" not found\n"; 75 char FailedReadMBR[] = "Read "MERGE_FILE" failed\n"; 76 char FailedInvalidMBR[] = "Invalid "MERGE_FILE"\n"; 77 char FailedWriteCode[] = "Write "OUT_FILE" failed\n"; 78 79 /* The signature we search for in the AIR-BOOT.COM image */ 80 char MBRProtectionSignature[] = "AiR-BOOT MBR-Protection Image"; 81 82 /* File buffers */ 83 char BootCode[IMAGE_SIZE]; // Buffer for boot-image 84 char MBRProtection[1024]; // Buffer for protection-image 85 86 87 88 89 /* 90 // Main Entrypoint. 91 */ 27 92 int main(int argc, char* argv[]) { 28 FILE* ifile = NULL; 29 FILE* mfile = NULL; 30 FILE* ofile = NULL; 31 93 FILE* ifile = NULL; 94 FILE* mfile = NULL; 95 FILE* ofile = NULL; 96 size_t ibytes = 0; 97 size_t mbytes = 0; 98 size_t obytes = 0; 99 unsigned i = 0; 100 unsigned found = 0; 101 102 103 #if DEBUG_LEVEL > 0 104 printf("\n%s\n", welcome); 105 printf("Debug level is: %d\n\n", DEBUG_LEVEL); 106 #endif 107 108 /* 109 // Show copyright message. 110 */ 111 printf("%s",Copyright); 112 113 /* 114 // Load AIR-BOOT.COM 115 */ 116 printf("%s",LoadCode); 32 117 ifile = fopen(IN_FILE, "rb"); 118 if (!ifile) { 119 printf("%s",FailedOpenCode); 120 exit(1); 121 } 122 ibytes = fread(BootCode, 1, IMAGE_SIZE, ifile); 123 if (ferror(ifile)) { 124 printf("%s",FailedReadCode); 125 exit(1); 126 } 127 //printf("ibytes: %d\n", ibytes); 128 fread(BootCode, 1, 1, ifile); 129 if (ibytes != IMAGE_SIZE || !feof(ifile)) { 130 printf("%s", FailedInvalidCode); 131 exit(1); 132 } 133 printf("%s", Okay); 134 135 136 /* 137 // Load MBR-PROT.BIN 138 */ 139 printf("%s",LoadMBR); 33 140 mfile = fopen(MERGE_FILE, "rb"); 141 if (!mfile) { 142 printf("%s",FailedOpenMBR); 143 exit(1); 144 } 145 mbytes = fread(MBRProtection, 1, MBRPROT_SIZE, mfile); 146 if (ferror(mfile)) { 147 printf("%s",FailedReadMBR); 148 exit(1); 149 } 150 fread(MBRProtection, 1, 1, mfile); 151 if (mbytes != MBRPROT_SIZE || !feof(mfile)) { 152 printf("%s", FailedInvalidMBR); 153 exit(1); 154 } 155 printf("%s", Okay); 156 157 158 /* 159 // Find Protection Image Signature. 160 // Note that this signature must reside on a sector boundary. 161 */ 162 for (i=0; i<55; i++) { 163 if (!memcmp(MBRProtectionSignature, &BootCode[i*SECSIZE], strlen(MBRProtectionSignature))) { 164 found = 1; 165 break; 166 } 167 } 168 169 /* 170 // Merge Protection Image. 171 */ 172 printf("%s",MergeMBR); 173 if (!found) { 174 printf("%s",Failed); 175 exit(2); 176 } 177 memcpy(&BootCode[i*SECSIZE], MBRProtection, MBRPROT_SIZE); 178 printf("%s", Okay); 179 180 181 /* 182 // Count Code Sectors. 183 // Obsolete now since the Protection Image has moved just below the 184 // Configuration and the code is always max. size. 185 // Overlap checking is done while assembling AIR-BOOT.ASM. 186 */ 187 printf("%s", CountCode); 188 BootCode[16] = 53; 189 printf("%s", Okay); 190 191 /* 192 // Write AIRBOOT.BIN 193 */ 194 printf("%s", WriteCode); 34 195 ofile = fopen(OUT_FILE, "wb"); 35 36 37 printf("\n%s\n", welcome); 38 39 #if DEBUG_LEVEL > 0 40 printf("Debug level is: %d", DEBUG_LEVEL); 41 #endif 42 43 196 if (!ofile) { 197 printf("%s", FailedWriteCode); 198 exit(3); 199 } 200 obytes = fwrite(BootCode, 1, IMAGE_SIZE, ofile); 201 if (obytes != IMAGE_SIZE || ferror(ofile)) { 202 printf("%s", FailedWriteCode); 203 exit(3); 204 } 205 printf("%s", Okay); 206 207 208 /* 209 // Close files. 210 */ 211 if (ifile) 212 fclose(ifile); 213 if (mfile) 214 fclose(mfile); 215 if (ofile) 216 fclose(ofile); 44 217 45 218 -
trunk/TOOLS/INTERNAL/FIXCODE.H
r37 r46 6 6 #define PLATFORM_DOS 7 7 #elif defined(__OS2__) && !defined(OS2) 8 #define INCL_NOPMAPI9 #define INCL_BASE10 #define INCL_DOS11 #define INCL_DOSDEVIOCTL12 #include <os2.h>13 8 #define PLATFORM_OS2 14 9 #elif defined(__NT__) 15 #include <windows.h>16 10 #define PLATFORM_WINNT 17 11 #elif defined(__LINUX__) … … 21 15 #endif 22 16 17 23 18 #include <stdlib.h> 24 19 #include <stdio.h> … … 26 21 27 22 28 29 30 31 32 33 34 35 23 #define IMAGE_SIZE 31744 24 #define MBRPROT_SIZE 1024 25 #define SECSIZE 512 36 26 37 27 #endif 38 39 40 41 42 43 -
trunk/TOOLS/INTERNAL/Makefile
r37 r46 102 102 # 103 103 CC16=wcc 104 CC16_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -w4 -e25 -zq -od -fo=$^. 105 CC16_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -fo=$^. 106 CC16_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -fo=$^. 104 MM16=-ml 105 CC16_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM16) -w4 -e25 -zq -otexan -fo=$^. -fr=$^&.ERR 106 CC16_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM16) -d2 -w4 -e25 -zq -od -fo=$^. -fr=$^&.ERR 107 CC16_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM16) -d2 -w4 -e25 -zq -od -fo=$^. -fr=$^&.ERR 107 108 CC16_FLAGS=$(CC16_FLAGS_D$(DEBUG_LEVEL)) 108 109 … … 110 111 # 32-bits C Compiler 111 112 # 113 MM32=-mf 112 114 CC32=wcc386 113 CC32_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -w4 -e25 -zq -od -6r -mf -fo=$^.114 CC32_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -6r -mf -fo=$^.115 CC32_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -6r -mf -fo=$^.115 CC32_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM32) -w4 -e25 -zq -otexan -6r -fo=$^. -fr=$^&.ERR 116 CC32_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM32) -d2 -w4 -e25 -zq -od -6r -fo=$^. -fr=$^&.ERR 117 CC32_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM32) -d2 -w4 -e25 -zq -od -6r -fo=$^. -fr=$^&.ERR 116 118 CC32_FLAGS_R=-w4 -e25 -zq -od -6r -mf -fo=$^. 117 119 CC32_FLAGS=$(CC32_FLAGS_D$(DEBUG_LEVEL)) … … 210 212 # 211 213 212 #213 # While the DOS build-environment has been kept alive in this version,214 # it has several drawbacks:215 # - No support for long filenames216 # - Very limited memory217 # - JWasmR does not work because of memory limitations218 # - JWasmD does not work at all219 # - Batch scripting is very rudimentairy220 #221 # Therefore, the DOS build-environment will most probably disappear222 # in future versions.223 # This does not influence the building of DOS targets, which can be done224 # on OS/2, Windows or Linux.225 #226 227 228 214 229 215 … … 244 230 @echo TARGET: $^&.COM [DOS 16-bits COM-file] 245 231 $(ASM) $(ASM_FLAGS) $(BASENAME).ASM 246 @wdis $^. > $^&.WDA232 @wdis -fi $^. > $^&.WDA 247 233 248 234 … … 259 245 @echo TARGET: $^&.EXE [DOS 16-bits Executable] 260 246 $(CC16) $(CC16_FLAGS) -bt=dos $(BASENAME).C 261 @wdis $^. > $^&.WDA247 @wdis -fi $^. > $^&.WDA 262 248 263 249 … … 274 260 @echo TARGET: $^&.EXE [NT 32-bits Executable] 275 261 $(CC32) $(CC32_FLAGS) -I$(%WATCOM)$(DS)h$(DS)nt -bt=nt $(BASENAME).C 276 @wdis $^. > $^&.WDA262 @wdis -fi $^. > $^&.WDA 277 263 278 264 … … 289 275 @echo TARGET: $^&.EXE [OS/2 32-bits Executable] 290 276 $(CC32) $(CC32_FLAGS) -I$(%WATCOM)$(DS)h$(DS)os2 -bt=os2 $(BASENAME).C 291 @wdis $^. > $^&.WDA277 @wdis -fi $^. > $^&.WDA 292 278 293 279 … … 305 291 @echo TARGET: $^&.ELF [Linux 32-bits Executable] 306 292 $(CC32) $(CC32_FLAGS) -bt=linux $(BASENAME).C 307 @wdis $^. > $^&.WDA293 @wdis -fi $^. > $^&.WDA 308 294 309 295 … … 330 316 @if exist *.OBJ $(RM) *.OBJ 331 317 @if exist *.WDA $(RM) *.WDA 318 @if exist *.NDA $(RM) *.NDA 332 319 @if exist *.MAP $(RM) *.MAP 333 320 @if exist *.LST $(RM) *.LST -
trunk/TOOLS/OS2/SETABOOT/.build
r45 r46 1 1 #!/bin/bash 2 2 3 make clean4 3 make -
trunk/TOOLS/OS2/SETABOOT/.clean
r45 r46 2 2 3 3 make clean 4 make -
trunk/TOOLS/OS2/SETABOOT/Makefile
r45 r46 1 1 ############################################################################### 2 # Makefile :: Builds FIXCODE program for several platforms.[wmake] #2 # Makefile :: Builds the SET(A)BOOT Helper for several platforms. [wmake] # 3 3 ############################################################################### 4 5 # 6 # This Makefile builds the FIXCODE program for DOS, Windows, OS/2 and Linux. 7 # FIXCODE is used to embed the anti-virus code into the AiR-BOOT image. 8 # This anti-virus code protects the MBR and is installed as a TSR by the 9 # loader. That's why it cannot be included at the source level. 4 # rousseau@ecomstation.com 5 # 6 # Derived from the INSTALL Makefile. 7 # 8 9 # 10 # This Makefile builds the SET(A)BOOT Helper for DOS, Windows, OS/2 and Linux. 11 # Like FIXCODE, each platform version has a letter appended it: 12 # 'D' for DOS, 'W' for Windows, '2' for OS/2 and 'L' for Linux. 10 13 # 11 14 … … 14 17 # This is used to compensate for the differences between the target platforms. 15 18 # 16 !include ../../ INCLUDE/MAKEFILE.MIF19 !include ../../../INCLUDE/MAKEFILE.MIF 17 20 18 21 … … 41 44 42 45 # 43 # Base Name of Program to build. 46 # Base Name of Source Program to compile. 47 # 48 BASENAME=SETABOOT 49 50 # 51 # Base Name of Executable Module to build. 44 52 # A letter is appended for each platform version: 45 53 # D=DOS, W=Windows, 2=OS2, L=Linux. 46 # The DOS COM-version has no suffix. 47 # 48 BASENAME=FIXCODE 54 # 55 MODULE=$(BASENAME) 49 56 50 57 # 51 58 # This is a list of the Targets to be built. 52 59 # 53 TARGETS=$(BASENAME).COM $(BASENAME)D.EXE $(BASENAME)W.EXE $(BASENAME)2.EXE $(BASENAME)L.ELF 54 #TARGETS=$(BASENAME)D.EXE 55 #TARGETS=$(BASENAME).COM 60 #TARGETS=$(MODULE)D.EXE $(MODULE)W.EXE $(MODULE)2.EXE $(MODULE)L.ELF 61 TARGETS=$(MODULE).EXE 56 62 57 63 # … … 78 84 # -zcw = no _ prefix on symbols (C model) 79 85 ASM_FLAGS_D0=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DASSEMBLER=JWASM -q -Cp -Fo$^. -Fl=$^&.LST -Fw$^&.ERR 80 ASM_FLAGS_D1=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DASSEMBLER=JWASM -q - Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR81 ASM_FLAGS_D2=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DASSEMBLER=JWASM -q - Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR86 ASM_FLAGS_D1=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DASSEMBLER=JWASM -q -Cp -Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR 87 ASM_FLAGS_D2=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DASSEMBLER=JWASM -q -Cp -Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR 82 88 !elseif "$(ASM)"=="wasm" 83 89 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dASSEMBLER=TASM -zq -fo=$^. -fr=$^&.ERR … … 86 92 !elseif "$(ASM)"=="tasm" 87 93 # -ml = case sensitive symbols 88 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dASSEMBLER=TASM -t - l89 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dASSEMBLER=TASM -t - z -zi -c -la90 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dASSEMBLER=TASM -t - z -zi -c -la94 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dASSEMBLER=TASM -t -ml -l 95 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dASSEMBLER=TASM -t -ml -z -zi -c -la 96 ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dASSEMBLER=TASM -t -ml -z -zi -c -la 91 97 !elseif "$(ASM)"=="alp" 92 98 ASM_FLAGS_D0=-D:DEBUG_LEVEL=$(DEBUG_LEVEL) -D:ASSEMBLER=ALP -Mb +Feo:OBJ +Fl +Fel:LST +Fm +Fem:ERR … … 101 107 # 16-bits C Compiler 102 108 # 109 MM16=-ml 103 110 CC16=wcc 104 CC16_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -w4 -e25 -zq -od -fo=$^.105 CC16_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -fo=$^.106 CC16_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -fo=$^.111 CC16_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM16) -w4 -e25 -zq -otexan -fo=$^. -fr=$^&.ERR 112 CC16_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM16) -d2 -w4 -e25 -zq -od -fo=$^. -fr=$^&.ERR 113 CC16_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM16) -d3 -w4 -e25 -zq -od -fo=$^. -fr=$^&.ERR 107 114 CC16_FLAGS=$(CC16_FLAGS_D$(DEBUG_LEVEL)) 108 115 … … 110 117 # 32-bits C Compiler 111 118 # 119 MM32=-mf 112 120 CC32=wcc386 113 CC32_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -w4 -e25 -zq -od -6r -mf -fo=$^. 114 CC32_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -6r -mf -fo=$^. 115 CC32_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -d2 -w4 -e25 -zq -od -6r -mf -fo=$^. 116 CC32_FLAGS_R=-w4 -e25 -zq -od -6r -mf -fo=$^. 121 CC32_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM32) -w4 -e25 -zq -otexan -6r -fo=$^. -fr=$^&.ERR 122 CC32_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM32) -d2 -w4 -e25 -zq -od -6r -fo=$^. -fr=$^&.ERR 123 CC32_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM32) -d3 -w4 -e25 -zq -od -6r -fo=$^. -fr=$^&.ERR 117 124 CC32_FLAGS=$(CC32_FLAGS_D$(DEBUG_LEVEL)) 118 125 … … 121 128 # 122 129 LNK=wlink 130 # 131 # DESCRIPTION does not work under WLink/Linux 132 # @ Cannot be escaped like with \x40 and it is still processed in quotes. 133 # WLink/2 can use the '\x40' variant. 134 # 135 #~ LNK_FLAGS_D0=op q op v op map=$^&.MAP op de '\x40\x23KIEWITZ:1.18\x23\x40\x41iR-BOOT Installer by Kiewitz' 123 136 LNK_FLAGS_D0=op q op v op map=$^&.MAP 137 #~ LNK_FLAGS_D1=op q op v d all & 138 #~ order clname CODE clname FAR_CONST clname FAR_DATA clnam BEGDATA clname DATA clname BSS clname STACK clname BLAP NOE & 139 #~ op map=$^&.MAP 124 140 LNK_FLAGS_D1=op q op v d all op map=$^&.MAP 125 141 LNK_FLAGS_D2=op q op v d all op map=$^&.MAP … … 172 188 @echo. 173 189 @echo ===================================================================== 174 @echo = PROGRAM: FIXCODE Multi Platform[DOS, Win32, OS/2 and Linux] =190 @echo = PROGRAM: SETABOOT Multi Platform [DOS, Win32, OS/2 and Linux] = 175 191 @echo ===================================================================== 176 192 # @echo. … … 229 245 230 246 # 231 # MAIN TARGETS 232 # 233 234 ############################################################################### 235 # DOS 16-bits (COM) 236 ############################################################################### 237 $(BASENAME).COM: $(BASENAME).OBJ 238 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys dos com 239 @if exist $^. @echo $^. $(MSG_SUCCESS) 240 @echo. 241 242 $(BASENAME).OBJ: $(BASENAME).ASM 243 # @echo. 244 @echo TARGET: $^&.COM [DOS 16-bits COM-file] 245 $(ASM) $(ASM_FLAGS) $(BASENAME).ASM 246 @wdis $^. > $^&.WDA 247 248 249 ############################################################################### 250 # DOS 16-bits (MZ) 251 ############################################################################### 252 $(BASENAME)D.EXE: $(BASENAME)D.OBJ 253 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys dos 254 @if exist $^. @echo $^. $(MSG_SUCCESS) 255 @echo. 256 257 $(BASENAME)D.OBJ: $(BASENAME).C $(BASENAME).H 258 # @echo. 259 @echo TARGET: $^&.EXE [DOS 16-bits Executable] 260 $(CC16) $(CC16_FLAGS) -bt=dos $(BASENAME).C 261 @wdis $^. > $^&.WDA 262 263 264 ############################################################################### 265 # NT 32-bits (PE) 266 ############################################################################### 267 $(BASENAME)W.EXE: $(BASENAME)W.OBJ 268 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys nt 269 @if exist $^. @echo $^. $(MSG_SUCCESS) 270 @echo. 271 272 $(BASENAME)W.OBJ: $(BASENAME).C $(BASENAME).H 273 # @echo. 274 @echo TARGET: $^&.EXE [NT 32-bits Executable] 275 $(CC32) $(CC32_FLAGS) -I$(%WATCOM)$(DS)h$(DS)nt -bt=nt $(BASENAME).C 276 @wdis $^. > $^&.WDA 277 247 # MAIN TARGET 248 # 278 249 279 250 ############################################################################### 280 251 # OS/2 32-bits (LX) 281 252 ############################################################################### 282 $( BASENAME)2.EXE: $(BASENAME)2.OBJ253 $(MODULE).EXE: $(MODULE).OBJ 283 254 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys os2v2 284 255 @if exist $^. @echo $^. $(MSG_SUCCESS) 285 256 @echo. 286 287 $(BASENAME)2.OBJ: $(BASENAME).C $(BASENAME).H 257 #~ wstrip $^. 258 259 $(MODULE).OBJ: $(BASENAME).C $(BASENAME).H 288 260 # @echo. 289 261 @echo TARGET: $^&.EXE [OS/2 32-bits Executable] 290 262 $(CC32) $(CC32_FLAGS) -I$(%WATCOM)$(DS)h$(DS)os2 -bt=os2 $(BASENAME).C 291 @wdis $^. > $^&.WDA 292 293 294 ############################################################################### 295 # Linux 32-bits (ELF) 296 ############################################################################### 297 $(BASENAME)L.ELF: $(BASENAME)L.OBJ 298 $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^&.ELF sys linux 299 # $(MV) $^&.ELF $^. 300 @if exist $^. @echo $^. $(MSG_SUCCESS) 301 @echo. 302 303 $(BASENAME)L.OBJ: $(BASENAME).C $(BASENAME).H 304 # @echo. 305 @echo TARGET: $^&.ELF [Linux 32-bits Executable] 306 $(CC32) $(CC32_FLAGS) -bt=linux $(BASENAME).C 307 @wdis $^. > $^&.WDA 308 309 310 263 @wdis -fi $^. > $^&.WDA 311 264 312 265 … … 330 283 @if exist *.OBJ $(RM) *.OBJ 331 284 @if exist *.WDA $(RM) *.WDA 285 @if exist *.NDA $(RM) *.NDA 332 286 @if exist *.MAP $(RM) *.MAP 333 287 @if exist *.LST $(RM) *.LST -
trunk/TOOLS/OS2/SETABOOT/SETABOOT.C
r35 r46 24 24 25 25 26 #include "SETABOOT.H" 27 28 26 29 #define INCL_BASE 27 30 #define INCL_WINSHELLDATA … … 37 40 #include <string.h> 38 41 39 #include " msghelp.c"42 #include "MSGHELP.C" 40 43 41 44 // Msg-IDs from OSO001.msg -
trunk/TOOLS/OS2/SETABOOT/_build.cmd
r32 r46 1 /* REXX */ 2 3 /* -r use release flags, -d use debug flags */ 4 debug='-d'; 5 6 'ide2make '||debug||' -p SETABOOT.WPJ'; 7 'wmake -h -f SETABOOT.MK'; 1 @wmake -
trunk/TOOLS/OS2/SETABOOT/_clean.cmd
r30 r46 1 /* REXX */ 2 3 '@if exist SETABOOT.MK del SETABOOT.MK'; 4 '@if exist SETABOOT.EXE del SETABOOT.EXE'; 5 '@if exist SETABOOT.OBJ del SETABOOT.OBJ'; 6 '@if exist SETABOOT.MK1 del SETABOOT.MK1'; 7 '@if exist SETABOOT.LK1 del SETABOOT.LK1'; 8 '@if exist SETABOOT.MAP del SETABOOT.MAP'; 9 '@if exist *.err del *.err'; 10 '@if exist ..\..\..\RELEASE\OS2\SETABOOT.EXE del ..\..\..\RELEASE\OS2\SETABOOT.EXE'; 1 @wmake clean
Note:
See TracChangeset
for help on using the changeset viewer.