Changeset 30


Ignore:
Timestamp:
May 6, 2011, 4:25:19 AM (14 years ago)
Author:
Ben Rietbroek
Message:

AiR-BOOT v1.07 -- As released with eCS v2.1. [2011-05-06]
Signature-date: 2006-03-13. (incorrect)
Trunk contains buildable v1.07 version as distributed with eCS v2.1.
Directory 'tags' contains v1.06 & v1.07 reference versions
built for all languages. Note that language ID for 'Dutch' changed
from 'DT' to 'NL' in v1.07 and that the v1.06 reference version also
uses 'NL' for 'Dutch'.
Also note that helper programs like the installer and setaboot are
are only modified for the OS/2 versions in v1.07.
The signature-date for v1.07 incorrectly states the same
date as for v1.06. The signature-version is correct.
Removed other binaries. (cd-rom images, old releases, etc.)
The tags serve as reference versions:

  • v1.06: rebuilt from source. (tags/v1.06r)
  • v1.07: built as released with eCS v2.1. (tags/v1.07r)
Files:
71 added
164 deleted
96 edited
1 copied

Legend:

Unmodified
Added
Removed
  • tags/v1.07r/BOOTCODE/AIR-BOOT.ASM

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

    r29 r30  
    33if "%1"=="EN"  goto Valid
    44if "%1"=="DE"  goto Valid
    5 if "%1"=="DT"  goto Valid
     5if "%1"=="NL"  goto Valid
    66if "%1"=="FR"  goto Valid
    77if "%1"=="IT"  goto Valid
     
    1313
    1414:BuildAll
    15 call make.bat EN
    1615call make.bat DE
    17 call make.bat DT
     16call make.bat NL
    1817call make.bat FR
    1918call make.bat IT
    2019call make.bat RU
    2120call make.bat SW
     21call make.bat EN
    2222goto ExitMe
    2323
    2424:Valid
     25echo.
     26echo.
    2527echo Making %1 language version of AiR-BOOT bootcode...
    2628echo Include TEXT\%1\MBR.asm >TEXT\TXTMBR.asm
     
    3739if errorlevel 1 goto Failed
    3840..\tools\internal\fixcode.com
    39 copy AIR-BOOT.com ..\RELEASE\BOOTCODE\%1.bin
     41copy AIR-BOOT.com ..\RELEASE\BOOTCODE\AIRBT-%1.bin
     42
     43copy AIR-BOOT.COM AIRBOOT.BIN
    4044
    4145rem Cleanup
    42 rem del AiR-BOOT.com
     46del AiR-BOOT.com
    4347del AiR-BOOT.exe
    4448del AiR-BOOT.obj
     
    4852echo Errorlevel not 0, make failed
    4953:ExitMe
     54rem @pause
  • tags/v1.07r/BOOTCODE/MBR-PROT/MAKE.BAT

    r29 r30  
    66%linker% mbr_prot.obj >nul
    77if errorlevel 1 goto Failed
    8 %exe2bin% mbr_prot.exe fixcode.com >nul
     8%exe2bin% mbr_prot.exe mbr_prot.com
     9if errorlevel 1 goto Failed
     10copy mbr_prot.com fixcode.com
    911if errorlevel 1 goto Failed
    1012
    1113rem Cleanup
    12 del mbr_prot.exe
    13 del mbr_prot.obj
     14::del mbr_prot.exe
     15::del mbr_prot.obj
    1416goto ExitMe
    1517
     
    1719echo Errorlevel not 0, make failed
    1820:ExitMe
    19 pause
     21rem pause
  • tags/v1.07r/BOOTCODE/MBR-PROT/MBR_PROT.ASM

    r29 r30  
    2727                org 0000h
    2828
    29 OldInterrupt10  dd      'kcuf'              ; we are nice aren't we ;-)
    30 OldInterrupt13  dd      'kcuf'
     29; Yes you are :-)
     30;OldInterrupt10  dd      'kcuf'              ; we are nice aren't we ;-)
     31;OldInterrupt13  dd      'kcuf'
     32
     33OldInterrupt10  dd      0
     34OldInterrupt13  dd      0
     35
    3136MBR_IgnoreWrite db      0
    3237
     
    143148MBRProt_WriteBorderLine        EndP
    144149
    145 MBRP_Line1:     db      'ÕÍÍŽ!ATTENTION! -> A VIRUS WAS FOUND <- !ATTENTION!ÃÍÍž'
     150MBRP_Line1:     db      'ÕÍÍŽ!ATTENTION! -> A V1RU5 WAS FOUND <- !ATTENTION!ÃÍÍž'
    146151MBRP_EmptyLine: db      '³                                                     ³'
    147152                db      '³ A program tried to write to your Master Boot Record ³'
     
    151156                db      '³  you have to deactivate MBR PROTECTION in AiR-BOOT  ³'
    152157                db      '³             or contact your supervisor.             ³'
    153 MBRP_Line3:     db      'ÔÍÍÍŽAiR-BOOT (c) Copyright by M. Kiewitz 1999-2009ÃÍÍŸ'
     158;MBRP_Line3:     db      'ÔÍÍÍŽAiR-BOOT (c) Copyright by M. Kiewitz 1999-2009ÃÍÍŸ'
     159MBRP_Line3:     db      'ÔÍÍÍŽAiR-BOOT (c) Copyright by M. Kiewitz 1999-2011ÃÍÍŸ'
    154160
    155161org             1023
  • tags/v1.07r/BOOTCODE/REGULAR/BOOTMENU.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'BOOTMENU',0
     24ENDIF
     25
    2226BOOTMENU_BuildBackground        Proc Near   Uses es di
    2327   call    VideoIO_CursorOff
     
    3236BOOTMENU_BuildBackground        EndP
    3337
     38CLR_COPYRIGHT_CLASSIC   = 0f00h
     39CLR_COPYRIGHT_BM  = 0700h
     40
    3441BOOTMENU_BuildMain              Proc Near   Uses es di
    3542   ; 1st line with Copyright information...
    3643   mov     cx, 0101h
    3744   call    VideoIO_Locate
    38    mov     cx, 0F00h
     45   mov     cx, CLR_COPYRIGHT_BM
    3946   call    VideoIO_Color
    4047   mov     si, offset Copyright
     
    4249
    4350   ; Boot-Window...
    44    mov     cx, 0901h
     51CLR_BOOT_WINDOW_CLASSIC    = 0901h
     52CLR_BOOT_WINDOW_BM         = 0701h
     53
     54   mov     cx, CLR_BOOT_WINDOW_BM
    4555   call    VideoIO_Color
    4656   mov     bx, 0201h
     
    5363   mov     al, TextChar_WinLineRight
    5464   mov     cl, 78
    55    call    VideoIO_Internal_MakeWinRight 
     65   call    VideoIO_Internal_MakeWinRight
    5666
    5767   mov     dl, 18h
     
    6373
    6474   ; Display Top-Infos in Boot-Window
    65    mov     cx, 0B01h
     75
     76CLR_TOP_INFOS_CLASSIC    = 0b01h
     77CLR_TOP_INFOS_BM  = 0301h
     78
     79   mov     cx, CLR_TOP_INFOS_BM
    6680   call    VideoIO_Color
    6781   mov     ch, 03h
     
    91105
    92106   ; Now make the separating vertical lines...
    93    mov     cx, 0901h
     107CLR_SEP_VERT_LINES_CLASSIC    = 0901h
     108CLR_SEP_VERT_LINES_BM   = 0701h
     109
     110   mov     cx, CLR_SEP_VERT_LINES_BM
    94111   call    VideoIO_Color
    95112   mov     ch, 03h
     
    157174   ; Boot-Window is DONE
    158175
    159    mov     cx, 0C04h
    160    call    VideoIO_Color
     176; Rousseau: = Colors =
     177; FG
     178; BG
     179; 7 = grey
     180; 6 = brown
     181; 5 = magenta
     182; 4 = red
     183; 3 = cyan
     184; 2 = green
     185; 1 = blue
     186
     187CLR_INFO_WINDOW_CLASSIC    = 0c04h
     188CLR_INFO_WINDOW_BM   = 0701h
     189
     190   mov     cx, CLR_INFO_WINDOW_BM
     191   ;mov     cx, 0C06h ; brown, main background
     192   call    VideoIO_Color                                                         ; Rousseau: color info window
     193
    161194   mov     bx, 1401h
    162195   mov     dx, 1950h
     
    173206   mov     cx, 1703h
    174207   call    VideoIO_Locate
    175    mov     cx, 0F04h
    176    call    VideoIO_Color
     208
     209CLR_INFO_TEXT_CLASSIC   = 0f04h
     210CLR_INFO_TEXT_BM   = 0701h
     211
     212   mov     cx, CLR_INFO_TEXT_BM                   ; Info text
     213   call    VideoIO_Color                                                         ; Rousseau: color info text
     214
    177215   mov     si, offset TXT_BootMenuHelpText1
    178216   call    VideoIO_Print
     
    182220   call    VideoIO_Print
    183221
    184    mov     cx, 0C04h
     222
     223CLR_F10_SETUP_CLASSIC   = 0c04h
     224CLR_F10_SETUP_BM        = 0901h
     225
     226   mov     cx, CLR_F10_SETUP_BM                            ; background F10 enter Setup
    185227   call    VideoIO_Color
    186228
     
    198240   call    VideoIO_PrintSingleChar
    199241   ; HelpWindow done...
     242
     243
     244   ; Rousseau: Debug Stuff, put here after building Main Menu
     245   ;call    VideoIO_DBG_WriteString
     246   ;call    VideoIO_DBG_WriteString2
     247
    200248   ret
    201249BOOTMENU_BuildMain              EndP
     250
     251
    202252
    203253BOOTMENU_BuildGoodBye           Proc Near   Uses es di
     
    209259   rep     stosw
    210260   ; -------------------------------------------
    211    mov     cx, 0D05h
     261
     262CLR_GOODBYE_WINDOW_CLASSIC = 0d05h
     263CLR_GOODBYE_WINDOW_BM   = 0f01h
     264
     265   mov     cx, CLR_GOODBYE_WINDOW_BM
    212266   call    VideoIO_Color
    213267   mov     bx, 0101h
     
    221275   mov     cx, 9
    222276   mov     al, WinCharRight
    223    mov     ah, 05Dh
     277
     278   ; Little part before version in goodbye-window
     279   ; Does not use color-function
     280   ;mov     ah, 05Dh
     281   mov     ah, 01fh
    224282   rep     stosw
     283
    225284   mov     cx, 010Bh
    226285   call    VideoIO_Locate
     
    240299   mov     al, TextChar_WinRep4
    241300   call    VideoIO_PrintSingleChar
    242    mov     cx, 0E01h
     301
     302CLR_GOODBYE_AB_VERSION_CLASSIC   = 0e01h
     303CLR_GOODBYE_AB_VERSION_BM  = 0e03h
     304
     305   mov     cx, CLR_GOODBYE_AB_VERSION_BM
    243306   call    VideoIO_Color
    244307   mov     si, offset Copyright
    245308   mov     cl, 11+CopyrightVersionLen
    246309   call    VideoIO_FixedPrint
    247    mov     cx, 0D05h
     310
     311   mov     cx, CLR_GOODBYE_WINDOW_BM
     312
    248313   call    VideoIO_Color
    249314   mov     al, TextChar_WinRep5
     
    251316   mov     cx, 020Dh
    252317   call    VideoIO_Locate
    253    mov     cx, 0F05h
     318
     319   CLR_GOODBYE_WINDOW_CLASSIC_2    = 0f05h
     320   CLR_GOODBYE_WINDOW_BM_2   = 0701h
     321
     322   mov     cx,  CLR_GOODBYE_WINDOW_BM_2
    254323   call    VideoIO_Color
    255324   inc     si
     
    272341BOOTMENU_BuildGoodBye           EndP
    273342
     343
     344
    274345; Must preserve AX!
    275346BOOTMENU_BuildTimedBootText     Proc Near   Uses ax cx si es di
    276    mov     cx, 1503h
    277    call    VideoIO_Locate
    278    mov     cx, 0E04h
     347   mov     cx, 1503h ;
     348   call    VideoIO_Locate
     349
     350CLR_NON_TIMED_BAR_CLASSIC  = 0e04h
     351CLR_NON_TIMED_BAR_BM = 0701h
     352
     353   mov     cx, CLR_NON_TIMED_BAR_BM                      ; non-timed time bar
    279354   call    VideoIO_Color
    280355   call    VideoIO_Internal_SetRegs
     
    294369   mov     cx, 1503h
    295370   call    VideoIO_Locate
    296    mov     cx, 0E04h
     371
     372CLR_TIMED_BAR_CLASSIC   = 0e04h
     373CLR_TIMED_BAR_BM  = 0e04h
     374
     375   mov     cx, CLR_TIMED_BAR_BM ; timed time bar, yellow on red
    297376   call    VideoIO_Color
    298377   mov     si, offset TXT_TimedBootLine  ; will print TimedBootEntryName too
     
    325404BOOTMENU_RefreshPartitionText   EndP
    326405
     406
     407CLR_VOLUME_INDEX_CLASSIC   = 0f01h
     408CLR_VOLUME_INDEX_BM  = 0f01h
     409
    327410; Writes Partition-Information to Screen (Boot-Menu)
    328411;        In: CH - Line to print info
     
    339422   mov     dh, cl
    340423   call    VideoIO_Locate
    341    mov     cx, 0F01h                     ; Bwhite, blue
     424   mov     cx, CLR_VOLUME_INDEX_BM                     ; Bwhite, blue
    342425   call    VideoIO_Color
    343426   mov     al, dl
     
    347430   ; === Display Drive-Number and Size (Size only in detailed view) ===
    348431   add     dh, 5
    349    movzx   cx, dh
    350    call    VideoIO_Locate
    351    mov     cx, 0D01h
     432   ;movzx   cx, dh
     433   mov   cl,dh
     434   mov   ch,0
     435
     436   call    VideoIO_Locate
     437
     438CLR_HD_INDEX_CLASSIC    = 0d01h
     439CLR_HD_INDEX_BM   = 0701h
     440
     441   mov     cx, CLR_HD_INDEX_BM
    352442   call    VideoIO_Color                 ; Violet, blue
    353443   mov     si, PartPointer
     
    367457     BMBPT_IsHarddrive:
    368458      ; Now display Size-Element...
    369       mov     cx, 0501h
     459
     460CLR_HD_SIZE_CLASSIC  = 0501h
     461CLR_HD_SIZE_BM = 0701h
     462
     463      mov     cx, CLR_HD_SIZE_BM
    370464      call    VideoIO_Color              ; Dark-Violet, Blue
    371465      mov     al, '/'
    372466      call    VideoIO_PrintSingleChar
    373       mov     cx, 0D01h
     467      mov     cx, CLR_HD_SIZE_BM
    374468      call    VideoIO_Color              ; Violet, Blue
    375469      mov     ax, PartPointer            ; Get Size-Element from PartPtr (AX)
     
    383477
    384478   ; === Display Label ===
    385    movzx   cx, dh
    386    call    VideoIO_Locate
    387    mov     cx, 0E01h
     479   ;movzx   cx, dh
     480   mov   cl,dh
     481   mov   ch,0
     482
     483   call    VideoIO_Locate
     484
     485CLR_LABEL_CLASSIC    = 0e01h
     486CLR_LABEL_BM   = 0f01h
     487
     488   mov     cx, CLR_LABEL_BM
    388489   call    VideoIO_Color                 ; Yellow, blue
    389490   mov     si, PartPointer
     
    394495   ; === Display Type ===
    395496   add     dh, 14
    396    movzx   cx, dh
     497   ;movzx   cx, dh
     498   mov   cl,dh
     499   mov   ch,0
     500
    397501   call    VideoIO_Locate
    398502   mov     si, PartPointer
    399503   mov     al, [si+LocIPT_SystemID]
    400504   call    PART_SearchFileSysName
    401    mov     cx, 0C01h
     505
     506CLR_FS_NAME_CLASSIC  =  0c01h
     507CLR_FS_NAME_BM =  0701h
     508
     509   mov     cx, CLR_FS_NAME_BM
    402510   call    VideoIO_Color                 ; Hrot, Blau
    403511   mov     cl, 8
     
    410518;       Out: DX - will get returned (fixed, if needed)
    411519BOOTMENU_BuildChoiceBar         Proc near   Uses ax es di
     520
     521   ;call  SOUND_Beep
     522
    412523   call    VideoIO_WaitRetrace
     524
     525
     526   ;call  SOUND_Beep
     527
    413528   mov     cl, 10h    ; Color BLUE, Partition DL
    414529   call    BOOTMENU_ReColorPart
     530
     531   ;call  SOUND_Beep
    415532
    416533   ; Check, if clipping needed...
     
    448565   call    BOOTMENU_RefreshPartitionText
    449566
     567
     568; Keuze bar
     569; 00h black
     570; 10h blue
     571; 20h green (also nice)
     572; 30h cyan (also nice)
     573; 40h red
     574; 50h magenta
     575; 60h brown (nice)
     576; 70h white
     577; 80h grey
     578; 90h light blue (nice)
     579; 0a0h bright green
     580; 0b0h bright cyan
     581; 0c0h bright red
     582; 0d0h bright magenta
     583; 0e0h bright yellow
     584; 0f0h bright white
     585
     586
     587CLR_SELECTION_BAR_CLASSIC  = 50h
     588CLR_SELECTION_BAR_BM = 090h
     589
     590
     591
    450592  BMBCB_AfterScrolling:
    451    mov     cl, 50h    ; Color PINK, Partition DL
     593   mov     cl, CLR_SELECTION_BAR_BM    ; Color PINK, Partition DL
    452594   call    BOOTMENU_ReColorPart
    453595   ret
     
    457599; Destroyed: None, but Locate-Pointer gets set
    458600BOOTMENU_ReColorPart            Proc Near   Uses bx cx es di
     601
     602  ; call  SOUND_Beep
     603
    459604   mov     bh, cl     ; Color to BH
    460605   ; First calculate location of bar
     
    475620      and     al, 0Fh
    476621      or      al, bh                     ; Adds background color (from BH)
     622
     623      ;mov      al,97h
     624
    477625      mov     es:[di], al
    478626      add     di, 2
     
    615763   ; Got it, so display bar...
    616764   mov     dh, dl
     765
     766   ;call  SOUND_Beep
     767
    617768   call    BOOTMENU_BuildChoiceBar       ; DH - Active, DL - Last Active
     769
     770   ;call  SOUND_Beep
     771
    618772   call    SOUND_PreBootMenu
    619773
     774
    620775  BME_MainLoop:
     776
     777     ;call    VideoIO_DBG_WriteString2    ; Rousseau
     778
    621779   test    TimedBootEnable, 1
    622780   jz      BME_NoTimedBoot
  • tags/v1.07r/BOOTCODE/REGULAR/DRIVEIO.ASM

    r29 r30  
    1919;                                                      AiR-BOOT / DRIVE I/O
    2020;---------------------------------------------------------------------------
     21
     22
     23
     24IFDEF ModuleNames
     25DB 'DRIVEIO',0
     26ENDIF
    2127
    2228; Note: Some routines set DS/ES to CS or even address via CS, even if its not
     
    141147;  This is calculated by Sector*Heads. Comparing will get done with Bit 25-10
    142148;  on LBA sectors, so we actually divide sector number by 1024.
    143 DriveIO_InitLBASwitchTable      Proc Near   Uses es di
     149DriveIO_InitLBASwitchTable      Proc Near   Uses es di                           ; Rousseau: LBA !
    144150   mov     di, offset LBASwitchTable
    145151   mov     dh, TotalHarddiscs
     
    152158         jc      DIOILUT_Error
    153159         and     cl, 111111b    ; Isolate lower 6 bits of CL -> sector count
    154          movzx   ax, cl
    155          mov     bl, dh         ; DH -> head count
     160
     161         ; huge disk 127 sec/track on <1TB using DANI
     162;         mov     cl, 07Fh
     163
     164         ;movzx   ax, cl
     165         mov   al,cl
     166         mov   ah,0
     167
     168         mov     bl, dh         ; DH -> head count                               ; Rousseau: nope, it's max head number !
    156169         mul     bl             ; AX = Sectors*Heads
    157170         shl     ah, 1
     
    168181DriveIO_InitLBASwitchTable      EndP
    169182
     183
     184
     185
    170186; Adjusts BX:AX / CX:DX to meet LVM sector location
    171187;  Destroys SI
    172 DriveIO_LVMAdjustToInfoSector   Proc Near   Uses
    173    push    cx
    174       xor     ch, ch
    175       and     cl, 63                     ; Isolate lower bits, because upper
    176       mov     si, 63                     ;  ones may be used for cylinder
    177       sub     si, cx
    178    pop     cx
    179    add     ax, si
    180    adc     bx, 0                         ; Adjust LBA Sector (BX:AX)
    181    or      cl, 63                        ; Set Sector to 63
    182    ret
     188; Rousseau: Enhanced to handle sector-numbers 127 and 255 besides 63 for LVM-info sectors.
     189;           Ugly, need to cleanup.
     190DriveIO_LVMAdjustToInfoSector   Proc Near   Uses                                 ; Rousseau: LVM stuff !
     191
     192
     193
     194;      pusha
     195;      call     AuxIO_TeletypeNL
     196
     197      ; LBA
     198;      xchg     dx,bx
     199;      call     AuxIO_TeletypeHexDWord
     200;      call     AuxIO_TeletypeNL
     201;      xchg     bx,dx
     202
     203      ; CYL
     204;      mov      al,ch
     205;      call     AuxIO_TeletypeHexByte
     206;      call     AuxIO_TeletypeNL
     207
     208      ; HEAD
     209;      mov      al,dh
     210;      call     AuxIO_TeletypeHexByte
     211;      call     AuxIO_TeletypeNL
     212
     213      ; SEC
     214;      mov      al,cl
     215;      call     AuxIO_TeletypeHexByte
     216;      call     AuxIO_TeletypeNL
     217
     218      ; DRIVE
     219;      mov      al,dl
     220;      call     AuxIO_TeletypeHexByte
     221;      call     AuxIO_TeletypeNL
     222
     223;      popa
     224
     225
     226      ;local ts:word
     227      ;local ts2:word
     228
     229      pusha
     230
     231         ; Dump drive
     232         mov      si,offset drive
     233         call     AuxIO_Print
     234         xchg     al,dl
     235         call     AuxIO_TeletypeHexByte
     236         call     AuxIO_TeletypeNL
     237         xchg     dl,al
     238
     239         ; Dump SPT
     240         mov      si,offset spt_used
     241         call     AuxIO_Print
     242         push     dx
     243         push     bx
     244            xor      dh,dh
     245            and      dl,01111111b
     246            shl      dx,1
     247            shl      dx,1
     248            mov      bx, offset TrueSecs
     249            add      bx,dx
     250            mov      ax,word ptr [bx]
     251
     252            ;mov      [ts],ax
     253
     254            call     AuxIO_TeletypeHexWord
     255            call     AuxIO_TeletypeNL
     256         pop      bx
     257         pop      dx
     258
     259         pusha
     260            push     dx
     261               ; Location of extended position
     262               mov      dx,word ptr [ExtendedAbsPos+02]
     263               mov      ax,word ptr [ExtendedAbsPos+00]
     264               call     AuxIO_TeletypeHexDWord
     265               call     AuxIO_TeletypeNL
     266            pop      dx
     267
     268            xor      dh,dh
     269            and      dl,01111111b
     270            shl      dx,1
     271            shl      dx,1
     272            mov      bx, offset TrueSecs
     273            add      bx,dx
     274
     275            mov      ax, word ptr[bx]
     276            call     AuxIO_TeletypeHexWord
     277            call     AuxIO_TeletypeNL
     278            mov      al,[ExtendedAbsPosSet]           ; if true -> 1st sector of extpart (EBR), not logpart(BPB)
     279            call     AuxIO_TeletypeHexByte
     280            call     AuxIO_TeletypeNL
     281      ;      mov      si,offset PartitionSector
     282      ;      call     AuxIO_DumpSector
     283         popa
     284
     285         ; LBA
     286         mov      si,offset before_lvm_adjust
     287         call     AuxIO_Print
     288
     289         xchg     dx,bx
     290         call     AuxIO_TeletypeHexDWord
     291         call     AuxIO_TeletypeNL
     292         xchg     bx,dx
     293      popa
     294
     295
     296      ;or       bx,ax
     297      test     [ExtendedAbsPosSet],1
     298      jz       pri
     299
     300
     301
     302
     303      pusha
     304         mov      si,offset before_lvm_adjust_log
     305         call     AuxIO_Print
     306         ; LBA
     307         xchg     dx,bx
     308         call     AuxIO_TeletypeHexDWord
     309         call     AuxIO_TeletypeNL
     310         xchg     bx,dx
     311      popa
     312
     313
     314      push     dx
     315      push     bx
     316         xor      dh,dh
     317         and      dl,01111111b
     318         shl      dx,1
     319         shl      dx,1
     320         mov      bx,offset TrueSecs
     321         add      bx,dx
     322         mov      dx,[bx]
     323         dec      dx
     324         add      ax,dx
     325      pop      bx
     326      pop      dx
     327      adc      bx,0
     328
     329
     330      pusha
     331         mov      si,offset after_lvm_adjust_log
     332         call     AuxIO_Print
     333         ; LBA
     334         xchg     dx,bx
     335         call     AuxIO_TeletypeHexDWord
     336         call     AuxIO_TeletypeNL
     337         xchg     bx,dx
     338      popa
     339
     340      jmp      done
     341
     342
     343
     344
     345pri:
     346
     347
     348      push     ax
     349      push     cx
     350         xor      ch, ch                           ; Zero out upper-byte
     351
     352         push     dx
     353            xor      dh,dh
     354            and      dl,01111111b
     355            shl      dx,1
     356            shl      dx,1
     357            push     bx
     358               mov      bx,offset TrueSecs
     359               add      bx,dx
     360               mov      ax,[bx]
     361               ;mov      [ts2],ax
     362            pop      bx
     363         pop      dx
     364
     365
     366
     367         ;mov      al, 63
     368         ;call VideoIO_PrintByteDynamicNumber
     369         ;self: jmp self
     370
     371
     372
     373         ; DEZE WERKT SOMS NIET GOED
     374         ; ROMMELT MET CYLINDERS
     375         ; ALLEEN TOEPASSEN ALS INT13X NIET ACTIEF !
     376
     377         and      cl, al                           ; Isolate lower bits, because upper
     378         mov      ah, 0
     379         mov      si, ax                           ;  ones may be used for cylinder
     380         sub      si, cx
     381
     382      pop      cx
     383      pop      ax
     384
     385      or       cl, al                           ; Set sector to last sector
     386
     387      add      ax, si                           ; Adjust lower LBA
     388      adc      bx, 0                            ; Adjust LBA Sector (BX:AX)
     389
     390
     391
     392      ;push     ax
     393      ;call     AuxIO_TeletypeHexWord
     394      ;call     AuxIO_TeletypeNL
     395      ;mov      ax,[ts]
     396      ;call     AuxIO_TeletypeHexWord
     397      ;call     AuxIO_TeletypeNL
     398      ;mov      ax,[ts2]
     399      ;call     AuxIO_TeletypeHexWord
     400      ;call     AuxIO_TeletypeNL
     401      ;pop      ax
     402
     403      ;and      ax,[ts]
     404
     405      jmp done
     406
     407
     408
     409done:
     410
     411
     412
     413      pusha
     414         mov      si,offset after_lvm_adjust
     415         call     AuxIO_Print
     416         ; LBA
     417         xchg     dx,bx
     418         call     AuxIO_TeletypeHexDWord
     419         call     AuxIO_TeletypeNL
     420         xchg     bx,dx
     421      popa
     422
     423
     424
     425;      pusha
     426;      call     AuxIO_TeletypeNL
     427
     428      ; CYL
     429;      mov      al,ch
     430;      call     AuxIO_TeletypeHexByte
     431;      call     AuxIO_TeletypeNL
     432
     433      ; HEAD
     434;      mov      al,dh
     435;      call     AuxIO_TeletypeHexByte
     436;      call     AuxIO_TeletypeNL
     437
     438      ; SEC
     439;      mov      al,cl
     440;      call     AuxIO_TeletypeHexByte
     441;      call     AuxIO_TeletypeNL
     442
     443      ; DRIVE
     444;      mov      al,dl
     445;      call     AuxIO_TeletypeHexByte
     446;      call     AuxIO_TeletypeNL
     447
     448;      popa
     449
     450
     451
     452      ret
    183453DriveIO_LVMAdjustToInfoSector   EndP
    184454
    185 Comment *ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    186  Routine: Loads partition to ExecBase and checks for validity
    187  ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
    188  Calling : bx:ax - Absolute sector
    189            cx:dx - Cylinder/Sector, Side/Drive (hi/lo-byte)
    190  Returns : Carry Set if invalid partition encountered
    191  Preserve: all registers
    192  ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
     455drive:                  db 'drive                    : ',0
     456before_lvm_adjust:      db 'before lvm adjust        : ',0
     457after_lvm_adjust:       db 'after lvm adjust         : ',0
     458before_lvm_adjust_log:  db 'before lvm logical adjust: ',0
     459after_lvm_adjust_log:   db 'after lvm logical adjust : ',0
     460spt_used:               db 'spt used                 : ',0
     461
     462
     463
     464; #########################################################################
     465; Routine: Loads partition to ExecBase and checks for validity
     466; #########################################################################
     467; Calling : bx:ax - Absolute sector
     468;           cx:dx - Cylinder/Sector, Side/Drive (hi/lo-byte)
     469; Returns : Carry Set if invalid partition encountered
     470; Preserve: all registers
     471; #########################################################################
    193472DriveIO_LoadPartition           Proc Near  Uses si
    194473   mov     wptr cs:[CurPartition_Location+0], ax
     
    209488   stc                                   ; Set carry, so no partition table
    210489  DIOLP_Success:
     490
     491IFDEF AuxDebug
     492   ; show current partition location
     493   pushf
     494   pusha
     495      call     AuxIO_TeletypeNL
     496      mov      si,offset db_curpartloc
     497      call     AuxIO_Print
     498      mov      dx,word ptr [CurPartition_Location+02]
     499      mov      ax,word ptr [CurPartition_Location+00]
     500      call     AuxIO_TeletypeHexDWord
     501      call     AuxIO_TeletypeNL
     502      mov      si,offset PartitionSector
     503      call     AuxIO_DumpSector
     504      call     AuxIO_TeletypeNL
     505   popa
     506   popf
     507ENDIF
     508
    211509   ret
    212510  DIOLP_Failed:
     
    214512DriveIO_LoadPartition           EndP
    215513
    216 Comment *ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    217  Routine: Writes a partition from ExecBase to its original sector
    218  ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
    219  Calling : none
    220  Returns : none
    221  Preserve: all registers
    222  ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
     514; #########################################################################
     515; Routine: Writes a partition from ExecBase to its original sector
     516; #########################################################################
     517; Calling : none
     518; Returns : none
     519; Preserve: all registers
     520; #########################################################################
    223521DriveIO_SavePartition           Proc Near  Uses ax bx cx dx si
    224522   mov     ax, wptr cs:[CurPartition_Location+0]
     
    237535DriveIO_LoadTmpSector           Proc Near  Uses
    238536   mov     si, offset TmpSector
    239    call    DriveIO_LoadSector
     537   call    DriveIO_LoadSector                                                    ; Uses INT13X if needed
    240538   ret
    241539DriveIO_LoadTmpSector           EndP
     
    256554   mov     dx, wptr cs:[CurPartition_Location+4]
    257555   mov     cx, wptr cs:[CurPartition_Location+6] ; Gets cur. partition location
    258    call    DriveIO_LVMAdjustToInfoSector
     556
     557   call    DriveIO_LVMAdjustToInfoSector                                         ; Rousseau: LVM stuff !
     558
    259559   mov     si, offset LVMSector
    260560   call    DriveIO_LoadSector
    261    call    LVM_CheckSectorSignature
     561
     562IFDEF AuxDebug
     563   ; show current partition location
     564   pushf
     565   pusha
     566      call     AuxIO_TeletypeNL
     567      mov      si,offset db_curlvmsec
     568      call     AuxIO_Print
     569      mov      dx,bx
     570      call     AuxIO_TeletypeHexDWord
     571      call     AuxIO_TeletypeNL
     572      mov      si,offset LVMSector
     573      call     AuxIO_DumpSector
     574      call     AuxIO_TeletypeNL
     575   popa
     576   popf
     577ENDIF
     578
     579   ; Rousseau
     580   ;pushf
     581   ;pusha
     582   ;mov   si, offset MyText4
     583   ;call  VideoIO_Print
     584   ;mov   si, offset LVMSector
     585   ;mov   al, [si+LocLVM_VolumeLetter2]
     586   ;call  VideoIO_PrintByteDynamicNumber
     587   ;mov   al, [si+LocLVM_Startable]
     588   ;call  VideoIO_PrintByteDynamicNumber
     589   ;mov   al, [si+LocLVM_OnBootMenu]
     590   ;call  VideoIO_PrintByteDynamicNumber
     591   ;;self: jmp self
     592   ;popa
     593   ;popf
     594
     595   call    LVM_CheckSectorSignature                                              ; Rousseau: LVM stuff !
    262596   jnc     DIOLLVMS_NoLVMSector
    263    call    LVM_CheckSectorCRC
     597   call    LVM_CheckSectorCRC                                                    ; Rousseau: LVM stuff !
    264598   jnc     DIOLLVMS_NoLVMSector
    265599   ret
     
    303637   jnz     InScanMode
    304638   jmp     MBR_LoadError
    305   InScanMode:   
     639  InScanMode:
    306640   mov     si, offset TXT_BrokenPartitionTable
    307641   push    cs
     
    319653DriveIO_GotLoadError            EndP
    320654
    321 Comment *ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    322  Routine: Loads a specified sector to DS:DI
    323  ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
    324  Calling : bx:ax - Absolute sector
    325            cx:dx - Cylinder/Sector, Side/Drive (hi/lo-byte)
    326            ds:si - Destination-Adress
    327  Returns : none
    328  Preserve: all registers
    329  ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
    330 DriveIO_LoadSector              Proc Near  Uses ax bx ds si es di
     655; #########################################################################
     656; Routine: Loads a specified sector to DS:DI
     657; #########################################################################
     658; Calling : bx:ax - Absolute sector
     659;           cx:dx - Cylinder/Sector, Side/Drive (hi/lo-byte)
     660;           ds:si - Destination-Adress
     661; Returns : none
     662; Preserve: all registers
     663; #########################################################################
     664DriveIO_LoadSector              Proc Near  Uses ax bx ds si es di                ; Rousseau: Disk IO
    331665   test     cs:[CurIO_UseExtension], 1
    332666   jz       DIOLS_UseNormal
    333667   ; Are we forced do use LBA via Setting?
    334    test     cs:[CFG_ForceLBAUsage], 1
     668   test     cs:[CFG_ForceLBAUsage], 1                                            ; Rousseau: LBA
    335669   jnz      DIOLS_UseExtension
    336670   ; Is the drive not a harddrive?
     
    351685         pop      es
    352686         mov      bx, si                     ; ES:BX - Destination
    353          mov      ax, 0201h                  ; Function 2 - Load Sector
     687         mov      ax, 0201h                  ; Function 2 - Load Sector          ; Rousseau: Disk IO -- legacy BIOS call
    354688         int      13h
    355689         jnc      DIOLS_Success
     
    370704      pop     ds
    371705      mov     si, offset DriveIO_DAP
    372       mov     ah, 42h                        ; Extended Read
     706      mov     ah, 42h                        ; Extended Read                     ; Rousseau: Disk IO -- extended BIOS call
    373707      int     13h
    374708   pop     cx
     
    381715DriveIO_LoadSector              EndP
    382716
    383 Comment *ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    384  Routine: Writes DS:SI to a specified sector
    385  ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
    386  Calling : bx:ax - Absolute sector
    387            cx:dx - Cylinder/Sector, Side/Drive (hi/lo-byte)
    388            ds:si - Source-Adress
    389  Returns : none
    390  Preserve: all registers
    391  ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
     717; #########################################################################
     718; Routine: Writes DS:SI to a specified sector
     719; #########################################################################
     720; Calling : bx:ax - Absolute sector
     721;           cx:dx - Cylinder/Sector, Side/Drive (hi/lo-byte)
     722;           ds:si - Source-Adress
     723; Returns : none
     724; Preserve: all registers
     725; #########################################################################
    392726DriveIO_SaveSector              Proc Near  Uses ax bx cx ds si es di
    393727   test     cs:[CurIO_UseExtension], 1
    394728   jz       DIOSS_UseNormal
    395729   ; Are we forced do use LBA via Setting?
    396    test     cs:[CFG_ForceLBAUsage], 1
     730   test     cs:[CFG_ForceLBAUsage], 1                                            ; Rousseau: LBA
    397731   jnz      DIOSS_UseExtension
    398732   ; Is the drive not a harddrive?
     
    440774   ret
    441775DriveIO_SaveSector              EndP
     776
     777
     778; See if a LVM-sector is valid.
     779; In  : si, pointer to sector
     780; Out : ZF=true, not valid; ZF=false, valid
     781DriveIO_LVMSectorValid           Proc  Near
     782      pusha
     783
     784      call     LVM_CheckSectorSignature
     785      mov      al,0
     786      rcl      al,1                          ; Move CY to AL.0
     787      call     AuxIO_TeletypeHexByte
     788      call     AuxIO_TeletypeNL
     789      or       al,al                         ; Zero if not a valid sector
     790      jz       DriveIO_LVMSectorValid_End    ; Not a valid sector
     791
     792      call     LVM_CheckSectorCRC
     793      stc
     794      mov      al,0
     795      rcl      al,1                          ; Move CY to AL.0
     796      call     AuxIO_TeletypeHexByte
     797      call     AuxIO_TeletypeNL
     798      or       al,al                         ; Zero if not a valid sector
     799
     800   DriveIO_LVMSectorValid_End:
     801
     802      popa
     803      ret
     804DriveIO_LVMSectorValid           EndP
     805
     806; ------------------------------------------------------
     807; Rousseau: # Load the master LVM-sector is one exists #
     808; ------------------------------------------------------
     809; Load the master LVM-sector to get the number of sectors per track as eCS views the drive.
     810; If no master LVM-sector is found it is assumed eCS is not installed.
     811; The master LVM-sector can be located at three different places according to drive size
     812; and partitioning scheme and driver used.
     813; When DANIS506.ADD is used, the eCS extended geometry will be 255/127 for drives >502GiB but <1TiB.
     814; Then the location will be sector 127 which is LBA 126 (7Eh).
     815; IBM1S506.ADD will always use 255/255 for the extended eCS geometry.
     816; DANIS506.ADD will use 255/255 for drives >1TiB.
     817; Then the location of the master LVM-sector will be 255 which is LBA 254 (FEh).
     818; When eCS is installed on a huge drive that alread had a system on it, eCS will be confined to the
     819; lower 502GiB of the drive. In this case the normal geometry from Int13X will be used.
     820; This is also the case when no valid master LVM-sector can be found.
     821;
     822; Return ZF=true if not found, ZF=false when valid master LVM-sector found.
     823DriveIO_LoadMasterLVMSector      Proc  Near
     824      pusha
     825
     826      mov      si,offset db_lmlvm
     827      ;call     AuxIO_Print
     828
     829      mov      al,dl
     830      ;call     AuxIO_TeletypeHexByte
     831      ;call     AuxIO_TeletypeNL
     832
     833
     834      ; Loop over the sector-translation table,
     835      ; process the first three values from high (255) to low (bios spt, most likely 63)
     836      mov      cx,3
     837DriveIO_LoadMasterLVMSector_NextTry:
     838      mov      bx,offset secs_per_track_table         ; sector translation table that corresponds with IsHugeDrive
     839      mov      si, offset LVMSector                   ; space to load the master LVM-sector
     840      mov      [DriveIO_DAP_NumBlocks],1              ; number of sectors to read
     841      mov      wptr [DriveIO_DAP_Transfer+0],si       ; low part of transfer address
     842      mov      ax, ds
     843      mov      wptr [DriveIO_DAP_Transfer+2],ax       ; high part of transfer address
     844      mov      ax,cx                                  ; use the counter...
     845      dec      ax                                     ; as an index into the table
     846      xlatb                                           ; translate to number of sectors
     847      dec      al                                     ; LBA is zero-based, so adjust
     848
     849IFDEF AuxDebug
     850      ; Dump the value
     851      ;call     AuxIO_TeletypeHexByte
     852      ;call     AuxIO_TeletypeNL
     853ENDIF
     854
     855      mov      wptr [DriveIO_DAP_Absolute+0],ax       ; LBA low      ;
     856      mov      wptr [DriveIO_DAP_Absolute+2],00h      ; LBA high
     857      mov      si, offset DriveIO_DAP                 ; address request packet
     858      mov      ah, 42h
     859      int      13h                                    ; do the i/o
     860      jc       DriveIO_LoadMasterLVMSector_NotFound   ; oops, there was an error
     861
     862IFDEF AuxDebug
     863      ; Dump title
     864      mov      si,offset db_masterlvm
     865      ;call     AuxIO_Print
     866
     867      ; Dum sector
     868      mov      si, offset LVMSector
     869      ;call     AuxIO_DumpSector
     870      ;call     AuxIO_TeletypeNL
     871ENDIF
     872      ; See is this is a valid LVM-sector
     873      call     DriveIO_LVMSectorValid
     874
     875IFDEF AuxDebug
     876      pushf
     877      ;call     AuxIO_TeletypeNL
     878      popf
     879ENDIF
     880      ; Yep, we found the master LVM-sector
     881      jnz      DriveIO_LoadMasterLVMSector_Found
     882      ; Try next location
     883      loop     DriveIO_LoadMasterLVMSector_NextTry
     884
     885   ; No master LVM-sector found, set ZF=true
     886   DriveIO_LoadMasterLVMSector_NotFound:
     887      xor      ax,ax
     888
     889   ; Jump here with ZF=false if found
     890   DriveIO_LoadMasterLVMSector_Found:
     891
     892      popa
     893      ret
     894DriveIO_LoadMasterLVMSector     Endp
     895
     896
     897
     898
     899; ---------------------------------------------------
     900; Rousseau ## Large drives, (eCS) geometry and LBA ##
     901; ---------------------------------------------------
     902; A sector size of 512 bytes is assumed in the below calculations.
     903; Note that this scheme changes when the sector size will be 4096 or larger,
     904; like with modern drives that do not translate to 512 bytes per sector anymore.
     905; These drives will have a capacity above the 2TiB LBA32 boundary.
     906; For now, we assume drives <=2TiB with a sector size of 512 bytes.
     907
     908; There are a few boundaries that are of importance.
     909; Note that these are disk-boundaries and not partition boundaries.
     910; Even with a small partition, like <502GiB, OS/2 will use extended geometry on an
     911; empty huge disk.
     912; These boundaries are (from high to low):
     913
     914; (code 5)
     915; 2^32 = 4294967296 = 100000000 sectors = 2048 GiB
     916;   This is the LBA32 2TiB boundary.
     917;   Everything above it must be addressed using LBA48.
     918;   OS/2 can currently not address this space above.
     919
     920; (code4)
     921; 65536*255*255 = 4261478400 = FE010000 sectors ~ 2032 GiB
     922;   This is the max OS/2 boundary using 255/255 extended geometry.
     923;   OS/2 can currently not address this space above.
     924
     925; (code 3)
     926; 2^31 = 2147483648 = 80000000 sectors = 1024 GiB
     927;   This is the LBA32 1TiB boundary.
     928;   OS/2 can address this space and will use 255/255 extended geometry.
     929
     930; (code 2)
     931; 65536*255*127 = 2122383360 = 7E810000 sectors ~ 1012 GiB
     932;   This is the DANI 1TiB boundary.
     933;   OS/2 can address this space and will use 255/255 extended geometry.
     934;   Below this DANI will use 255/127 extended geometry.
     935;   This matters on where the LVM-sectors are located !
     936
     937; (code 1)
     938; 65536*255*63  = 1052835840 = 3EC10000 sectors ~ 502 GiB
     939;   This is the current OS/2 limit using this geometry because OS/2 can currently
     940;   not address more than 65536 cylinders.
     941;   DANI will address space above with 255/127 extended geometry up until the DANI 1TiB boundary (code 2)
     942
     943; (code 0)
     944; Everything below 65536*255*63 will be addressed using standard geometry.
     945
     946
     947;
     948; This function will return the following values:
     949;
     950
     951; 5 = This drive is above the 2^32 LBA32 (2TB) boundary and has more than 4294967296 sectors.
     952;     LBA48 addressing is needed to access the complete capacity of the drive.
     953;     OS/2 is currently unable to do so.
     954
     955; 4 = This drive is above the 65536*255*255 (4261478400) boundary but below 2^32.
     956;     This is an OS/2 boundary and OS/2 is not able to access the drive above this boundary.
     957
     958; 3 = This drive is above the 2^31 (1TB) boundary and has more than 2147483648 sectors.
     959;     OS/2 is able to access the drive using it's extended geometry.
     960;     Both DANIS506 and IBM1S506 will use the 255/255 scheme.
     961
     962; 2 = This drive is above the 65536*255*127 (2122383360) boundary but below 2^31.
     963;     OS/2 is able to access the drive using it's extended geometry.
     964;     Both DANIS506 and IBM1S506 will use the 255/255 scheme.
     965
     966; 1 = This drive is above the 65536*255*63 (1052835840) boundary but below 65536*255*127.
     967;     OS/2 is able to access the drive using it's extended geometry.
     968;     Note that DANIS506 will use 255/127 and IBM1S506 will use 255/255 geometry !
     969;     Using DANI or IBM influences the location of the LVM info-sectors !
     970
     971; 0 = This drive is below the 65536*255*63 (1052835840) boundary.
     972;     OS/2 is able to access this drive using the standard 255/63 geometry.
     973
     974; So, any return value >0 means OS/2 extended geometry will be used.
     975; Value 1 will use 255/127 with DANIS506 but 255/255 with IBM1S506.
     976; Values 2 and 3 will use 255/255 on both drivers.
     977; You can or with 0x01 and check for 3 in this case.
     978; Any value above 3 will be a drive who's capacity cannot be fully used by OS/2
     979; The upper limit of 65536*255*255 will be in effect here.
     980
     981; Note this function currently handles the boot-drive only !
     982; It should be extended and use dl for the drive-number as a parameter.
     983; Because we use this function to get this info in a number of places,
     984; all regs and flags except AX are saved and restored.
     985
     986; DL contains BIOS disk-number; 80h for first, 81h for second, etc.
     987DriveIO_GatherDiskInfo  Proc Near
     988      pushf
     989      push    bx
     990      push    cx
     991      push    dx
     992      push    si
     993      push    di
     994      push    es
     995
     996      ; Set ES to CS for buffer clearing
     997      push    cs
     998      pop     es
     999
     1000      ; Clear the buffer
     1001      ; Don't overwrite the word of the buffersize at index 0 !
     1002      ; Old Phoenix BIOSses require word (flags) at 02 to be zero,
     1003      ; so we clear the whole buffer to be sure.
     1004      mov     cx, i13xbuf_size
     1005      mov     di, offset i13xbuf
     1006      mov     [di],cx
     1007      inc     di
     1008      inc     di
     1009      xor     ah,ah
     1010      cld
     1011      rep stosb
     1012
     1013      ; Get the drive parameters
     1014      mov     ah, 48h                                 ; Get Drive Parameters (extended version)
     1015      ;mov     dl, 80h                                ; Drive number
     1016      mov     si, offset i13xbuf                      ; Buffer for result-info
     1017      push    dx
     1018      int     13h                                     ; Call the BIOS-function
     1019      pop     dx
     1020
     1021      ; Do some error-checking
     1022      or      ah,ah                                   ; AH is zero if no error (ZF=1 if no error)
     1023      mov     ax,0                                    ; Setup code for non-huge drive (does not influence ZF)
     1024      jz      DriveIO_GatherDiskInfo_ok               ; Return if error (AL<>0 thus ZF=0) but CY not set, assuming non-huge drive
     1025      jnc     DriveIO_GatherDiskInfo_ok               ; Return if error (CY=1), assuming non-huge drive
     1026      jmp     DriveIO_GatherDiskInfo_ret
     1027
     1028
     1029   DriveIO_GatherDiskInfo_ok:
     1030
     1031      ;
     1032      ; Store the drive geometry
     1033      ;
     1034
     1035      mov      si, offset i13xbuf
     1036
     1037      xor      dh,dh
     1038      and      dl,01111111b
     1039      shl      dx,1
     1040      shl      dx,1
     1041
     1042      ; Store number of cylinders on disk
     1043      mov      bx, offset BIOS_Cyls
     1044      add      bx,dx
     1045      mov      ax,[si+04h]
     1046
     1047      mov      word ptr [bx+00],ax
     1048      mov      ax,[si+06]
     1049      mov      word ptr [bx+02],ax
     1050
     1051      ; Store number of heads per cylinder
     1052      mov      bx, offset BIOS_Heads
     1053      add      bx,dx
     1054      mov      ax,[si+08h]
     1055      mov      word ptr [bx+00],ax
     1056      mov      ax,[si+0ah]
     1057      mov      word ptr [bx+02],ax
     1058
     1059      ; Store number of sectors per track
     1060      mov      bx, offset BIOS_Secs
     1061      add      bx,dx
     1062      mov      ax,[si+0ch]
     1063      mov      word ptr [bx+00],ax
     1064
     1065      ; Update first byte of translation-table to conform to BIOS SPT
     1066      mov      byte ptr [secs_per_track_table], al
     1067
     1068      mov      ax,[si+0eh]
     1069      mov      word ptr [bx+02],ax
     1070
     1071      ; Store total secs
     1072      mov      bx, offset BIOS_TotalSecs
     1073      add      bx,dx
     1074      add      bx,dx
     1075      mov      ax,[si+10h]
     1076
     1077      mov      word ptr [bx+00],ax
     1078      mov      ax,[si+12h]
     1079      mov      word ptr [bx+02],ax
     1080      mov      ax,[si+14h]
     1081      mov      word ptr [bx+04],ax
     1082      mov      ax,[si+18h]
     1083      mov      word ptr [bx+06],ax
     1084
     1085      ; Store number of bytes per sector
     1086      mov      bx, offset BIOS_Bytes
     1087      add      bx,dx
     1088      mov      ax,[si+18h]
     1089      mov      [bx],ax
     1090
     1091
     1092      ;
     1093      ; See of it's a huge drive of not
     1094      ;
     1095
     1096      ; Drive is larger than 2TiB
     1097      mov     ax,5                                    ; Drive code (5)
     1098      mov     bx, [si+14h]                            ; Low word of high dword of sector-count
     1099      or      bx, [si+16h]                            ; High word of high dword of sector-count
     1100      jnz     DriveIO_GatherDiskInfo_ret              ; If non-zero we have a drive with >2^32 sectors and thus LBA48 addressing
     1101
     1102      ; Drive is larger than max OS/2 capacity
     1103      dec     ax                                      ; Drive code (4)
     1104      mov     bx, [si+12h]                            ; High word of low dword of sector-count
     1105      cmp     bx, 0fe01h                              ; Boundary
     1106      jae     DriveIO_GatherDiskInfo_ret              ; If above or equal to boundary,
     1107                                                      ; we have a drive larger than to 65536*255*255 = FE010000 sectors
     1108
     1109      ; Drive can be completely utilized by OS/2
     1110      dec     ax                                      ; Drive code (3)
     1111      cmp     bx, 8000h                               ; Boundary
     1112      jae     DriveIO_GatherDiskInfo_ret              ; If above or equal to boundary,
     1113                                                      ; we have a drive larger than 2^31 sectors but smaller than 65536*255*255
     1114
     1115      ; This is the small area between DANI 1TiB and LBA 1TiB
     1116      dec     ax                                      ; Drive code (2)
     1117      cmp     bx, 7e81h                               ; Boundary
     1118      jae     DriveIO_GatherDiskInfo_ret              ; If above or equal to boundary,
     1119                                                      ; we have a drive larger than 65536*255*127 but <65536*255*255
     1120                                                      ; DANIS506.ADD will use 255/255 extended geometry
     1121
     1122      ; DANI will use 255/127 in this area, this could impact the location of LVM-sectors ! (last sec on track)
     1123      dec     ax                                      ; Drive code (1)
     1124      cmp     bx, 3ec1h                               ; Boundary
     1125      jae     DriveIO_GatherDiskInfo_ret              ; If above or equal to boundary,
     1126                                                      ; we have a drive larger than 65536*255*63 sectors (OS/2 502GiB Limit!)
     1127                                                      ; DANIS506.ADD will use 255/127 extended geometry !
     1128                                                      ; IBM1S506.ADD will use 255/255 extended geometry !
     1129
     1130      ; We have a drive that can be addressed using standard 255/63 geometry
     1131      dec     ax                                      ; Drive code (0)
     1132                                                      ; We have a drive smaller than 65536*255*63 = 3EC10000 sectors
     1133
     1134   DriveIO_GatherDiskInfo_ret:
     1135      pop     es
     1136      pop     di
     1137      pop     si
     1138      pop     dx
     1139      pop     cx
     1140      pop     bx
     1141
     1142      mov      [CurIO_UseExtension],1
     1143
     1144      popf
     1145      ret
     1146DriveIO_GatherDiskInfo  EndP
     1147
     1148
     1149
     1150; Values for sectors per track table corresponding to DriveIO_IsHugeDrive return value.
     1151secs_per_track_table:   db    63,127,255,255,255,255
     1152
     1153db_lmlvm:   db 'Load Master LVM -- disk: ',0
  • tags/v1.07r/BOOTCODE/REGULAR/OTHER.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'OTHER',0
     24ENDIF
     25
    2226;        In: DS:SI - Pointer to begin of string
    2327;            CX - Len of string
     
    7276   dec     dh
    7377   jnz     GLOSS_StringsLoop
    74    movzx   cx, dl
     78   ;movzx   cx, dl
     79   mov   cl,dl
     80   mov   ch,0
     81
    7582   ret
    7683GetLenOfStrings                EndP
     
    8794   mov     VideoIO_Segment, VideoIO_Page0
    8895
     96   ; Don't use blinking attribute
     97   call     VideoIO_NoBlinking
     98
     99   ; Get HardDriveCount
     100   call    DriveIO_GetHardDriveCount
     101
     102
     103               ; Rousseau: added
     104               call    VideoIO_ClearScreen
     105
     106               ; Cursor to upper-left
     107               mov     TextPosX, 0
     108               mov     TextPosY, 0
     109               call    VideoIO_CursorSet
     110
     111               ;mov     ax, VideoIO_Page1
     112               ;call    VideoIO_BackUpTo   ; Copy BIOS POST to Second Page
     113
     114               ; Copyright
     115               mov     si, offset Copyright
     116               call    MBR_Teletype
     117               xor     si,si
     118               call    MBR_TeletypeNL
     119
     120
     121               ;call    SOUND_Beep
     122
     123               ; Build Date
     124               mov     si, offset BUILD_DATE
     125               call    MBR_TeletypeNL
     126
     127               ; Initialize the com-port for debugging
     128               call     AuxIO_Init
     129
     130               xor     si,si
     131               call    MBR_TeletypeNL
     132
     133               xor      cx,cx
     134            PRECRAP_Main_next_disk:
     135
     136               mov      dl,cl
     137               or       dl,80h
     138
     139               call     DriveIO_GatherDiskInfo              ; Also used to fill the geo, should be separate function
     140
     141               mov      bx,offset HugeDisk
     142               add      bx,cx
     143               mov      [bx], al
     144
     145               call     DriveIO_LoadMasterLVMSector         ; returns ZF=1 if no valid LVM record found
     146
     147               pushf
     148               mov      bx, offset TrueSecs
     149               add      bx,cx
     150               add      bx,cx
     151               add      bx,cx
     152               add      bx,cx
     153               popf
     154
     155               ; bx now contains pointer to truesecs for this drive
     156
     157               jz       NoValidMasterLVM
     158
     159               mov      si,offset LVMSector
     160               mov      ax,[si+LocLVM_Secs]
     161               mov      word ptr [bx],ax
     162               jmp      SkipUseBiosSecs
     163
     164
     165            NoValidMasterLVM:
     166               push     bx                   ; push truesecs pointer
     167               mov      bx, offset BIOS_Secs
     168               add      bx,cx
     169               add      bx,cx
     170               add      bx,cx
     171               add      bx,cx
     172
     173               mov      ax,[bx]              ; get biossecs
     174               pop      bx
     175               mov      word ptr [bx],ax     ; store bios secs in truesecs
     176
     177
     178            SkipUseBiosSecs:
     179               inc      cx
     180               cmp      cl,[TotalHarddiscs]
     181               jb       PRECRAP_Main_next_disk
     182
     183
     184
     185IFDEF AuxDebug
     186               ; Write some debug-info to the com-port
     187               call     DEBUG_Dump1
     188ENDIF
     189
     190              ; jz       NoValidMasterLVM
     191
     192
     193               ; A valid Master LVM has been found.
     194               ; We use the values in here to determine the number of sectors per track,
     195               ; since this could be OS/2 extended geometry.
     196
     197              ; jmp      Continue1
     198
     199
     200               ;mov      word ptr [LOG_Secs],63
     201
     202               mov      al,[HugeDisk]           ;; fout, moet nog index bij
     203               call     AuxIO_TeletypeHexByte
     204               call     AuxIO_TeletypeNL
     205
     206               mov      ax,word ptr [TrueSecs]  ;; fout, moet nog index bij
     207               call     AuxIO_TeletypeHexWord
     208               call     AuxIO_TeletypeNL
     209
     210
     211
     212                 ; Huge Disk indicator
     213                 mov     si, offset HugeBootDisk
     214                 call    MBR_Teletype
     215                 mov     al,[HugeDisk]
     216                 mov     si, offset No
     217                 test    al,al
     218                 jz      MBR_HugeDriveIndicator
     219                 mov     si, offset Yes
     220
     221               MBR_HugeDriveIndicator:
     222                 call    MBR_Teletype
     223                 xor     si,si
     224                 call    MBR_TeletypeNL
     225
     226
     227
     228
     229
     230                 ;
     231                 ; Phase 1 Indicator
     232                 ;
     233                 mov     si, offset Phase1
     234                 call    MBR_Teletype
     235
     236                 mov     si, offset eCS_InstallVolume
     237                 mov     al, [si]
     238                 test    al,al                                 ; See if phase 1 is active
     239                 jnz     MBR_Main_BootThrough
     240                 mov     si, offset NotActive
     241
     242               MBR_Main_BootThrough:
     243                 call    MBR_TeleType
     244                 xor     si,si
     245                 call    MBR_TeletypeNL                                          ; ALP barks undefined symbol; must use prototypes ?
     246
     247
    89248   ; Calculate Cooper-Bar Tables
    90249   call    FX_CalculateTables
     
    108267
    109268   call    PRECRAP_CheckFor13extensions
     269
    110270   IFNDEF ReleaseCode
    111271      ret
    112272   ENDIF
     273
    113274   call    PRECRAP_CheckConfiguration
     275
    114276   ; =======================================
    115277   ; Checks for MBR Virii :) I love that job
     
    123285      call    VIRUS_CheckForVirus
    124286  PCM_NoVirusDetection:
     287
     288
    125289   ; ============================================
    126290   ;  Delay for some time and get Strg/Alt State
     
    132296   jz      PCM_LongDelay
    133297  PCM_ShortDelay:
     298
    134299   mov     al, 13                        ; shorten delay,if floppy gets accessed
    135300  PCM_LongDelay:
     301
    136302   call    TIMER_WaitTicCount
     303
    137304   ; First check, if any normal key got pressed...
    138305   mov     ah, 1
     
    143310   call    MBR_Teletype
    144311   mov     al, 54                        ; about 3 seconds, delay again
     312
    145313   call    TIMER_WaitTicCount
     314
    146315  PCM_NoNormalKeyPressed:
    147316   ; Now get keyboard Strg/Alt State
     
    156325   ret
    157326PRECRAP_Main                    EndP
     327
     328
    158329
    159330AFTERCRAP_Main                  Proc Near  Uses
     
    209380   jmp     MBR_HaltSystem
    210381PRECRAP_CheckConfiguration      EndP
     382
     383
     384; Rousseau: added
     385;        In: SI - Pointer to begin of string (EOS is 0)
     386; Destroyed: SI
     387; Fixme: Uses double writes to use attribute with teletype-function.
     388MBR_TeletypeBold                Proc Near   Uses ax bx cx
     389  MBRT_LoopBold:
     390   lodsb
     391   or      al, al
     392   jz      MBRT_EndBold
     393   push    ax
     394   mov     ah,09h
     395   mov     bx,15
     396   mov     cx,1
     397   int     10h
     398   pop     ax
     399   mov     ah,0eh
     400   mov     bx,7            ; Does not do anything in text-modus
     401   mov     cx,1
     402   int     10h
     403   jmp     MBRT_LoopBold
     404  MBRT_EndBold:
     405   ret
     406MBR_TeletypeBold                EndP
     407
     408;        In: SI - Pointer to begin of string (EOS is 0)
     409; Destroyed: SI
     410; Fixme: Uses double writes to use attribute with teletype-function.
     411MBR_TeletypeVolName             Proc Near   Uses ax bx cx
     412   mov     cx, 11
     413  MBRT_LoopVolName:
     414   mov     dx,cx           ; Backup counter
     415   lodsb
     416   or      al, al
     417   jz      MBRT_EndVolName
     418   push    ax
     419   mov     ah,09h
     420   mov     bx,15
     421   mov     cx,1
     422   int     10h             ; DX is preserved
     423   pop     ax
     424   mov     ah,0eh
     425   mov     bx,7            ; Does not do anything in text-modus
     426   mov     cx,1
     427   int     10h             ; DX is preserved
     428   mov     cx,dx           ; Restore counter
     429   loop    MBRT_LoopVolName
     430  MBRT_EndVolName:
     431   ret
     432MBR_TeletypeVolName             EndP
     433
     434; Rousseau: added
     435; Move cursor to next line
     436; Just do a new-line if SI==0
     437MBR_TeletypeNL                  Proc Near   Uses ax bx cx
     438   test    si,si
     439   jz      MBR_TeletypeNL_NL
     440   call    MBR_Teletype
     441  MBR_TeletypeNL_NL:
     442   push    si
     443   mov     si, offset NL
     444   call    MBR_Teletype
     445   pop     si
     446   ret
     447MBR_TeletypeNL                  EndP
     448
     449; Sync teletype position to VideoIO
     450MBR_TeletypeSyncPos     Proc Near   Uses ax bx cx dx
     451   pushf
     452   mov   bh, 0
     453   mov   ah, 02h
     454   mov   dh,[TextPosY]
     455   mov   dl,[TextPosX]
     456   int   10h
     457   popf
     458   ret
     459MBR_TeletypeSyncPos     EndP
  • tags/v1.07r/BOOTCODE/REGULAR/PARTMAIN.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'PARTMAIN',0
     24ENDIF
     25
    2226PART_FixUpDefaultPartitionValues Proc Near  Uses dx si di
    2327   ; Fix-Up Default and Last Partition - If lost, search for Bootable
     
    140144; Copies the device-name to the Resume-BIOS IPT entry
    141145PART_UpdateResumeBIOSName       Proc Near Uses ax bx cx si di
    142    movzx   bx, CFG_ResumeBIOSbootSeq
     146   ;movzx   bx, CFG_ResumeBIOSbootSeq
     147   mov   bl,CFG_ResumeBIOSbootSeq
     148   mov   bh,0
     149
    143150   dec     bx
    144151   shl     bx, 1
     
    213220;  PCMPP_NoLinuxKernels:
    214221
    215    movzx   cx, CFG_Partitions ; LocIPT_MaxPartitions
     222   ;movzx   cx, CFG_Partitions ; LocIPT_MaxPartitions
     223   mov   cl,CFG_Partitions ; LocIPT_MaxPartitions
     224   mov   ch,0
     225
    216226   or      cx, cx
    217227   jz      PCMPP_NoPartitions
     
    240250   je      PGPP_IsBIOSbootSeq            ; FEh -> Resume BIOS boot Sequence
    241251   ja      PGPP_IsFloppy                 ; FFh -> Floppy
    242    movzx   bx, dl
     252   ;movzx   bx, dl
     253   mov   bl,dl
     254   mov   bh,0
     255
    243256   shl     bx, 1
    244257   mov     si, wptr [PartitionPointers+bx]
     
    278291;       Out: DL - Number of partition in straight view
    279292PART_ConvertToStraight          Proc Near   Uses
    280    movzx   bx, dl
    281    shl     bx, 1
    282    mov     ax, wptr cs:[PartitionPointers+bx]
     293   ;movzx   bx, dl
     294   mov   bl,dl                                  ; partition number to bl
     295   mov   bh,0                                   ; zero extend to word
     296
     297   shl     bx, 1                                ; convert to word index
     298   mov     ax, wptr cs:[PartitionPointers+bx]   ; get the partition pointer
    283299   cmp     ax, offset FloppyIPTentry
    284300   jb      PCTS_IsBIOSbootSeq
     
    315331  PCFS_IsPartition:
    316332   ; First we get Partition-Offset in AX
    317    movzx   ax, dl
     333   ;movzx   ax, dl
     334   mov   al,dl
     335   mov   ah,0
     336
    318337   mov     bl, LocIPT_LenOfIPT
    319338   mul     bl
     
    354373   mov     bl, LocIPT_LenOfIPT
    355374   div     bl                            ; Divide with IPTlength
    356    movzx   bx, al
     375   ;movzx   bx, al
     376   mov   bl,al
     377   mov   bh,0
     378
    357379   shl     ax, 1
    358380   shl     bx, 2
     
    409431      dec     di                         ; Go to previous char
    410432      jmp     PFOSE_DigitLoop
    411      
     433
    412434  PFOSE_EndOfDigitLoop:
    413435   ret
    414436PART_FillOutSizeElement         EndP
     437
     438
     439
     440
     441; ###################
     442; # START PARTITION #
     443; ###################
    415444
    416445; Starts Partition DL from Internal Partition Table.
     
    454483         mov     di, offset TXT_BootingNowPartName
    455484         jz      PSP_NoName
    456          rep     movsb
     485         rep     movsb                                                           ; Copy label-name to boot
    457486        PSP_NoName:
    458487         xor     al, al
    459488         stosb              ; Ending Zero
    460       mov     si, offset TXT_BootingNow1
     489      mov     si, offset TXT_BootingNow1                                         ; "Booting the system using "
    461490      call    MBR_Teletype
    462491; [Linux support removed since v1.02]
     
    484513      IFDEF ReleaseCode
    485514         ; Save configuration on HDD boots (save CFG_PartLast)
    486          call    DriveIO_SaveConfiguration
     515         call    DriveIO_SaveConfiguration                                       ; Rouaaseu: SAVE CONFIGURATION !
    487516      ENDIF
    488517      call    MBR_Teletype     ; Prints out BootingNow2 including PartitionName
     
    496525   mov     dh, bptr [si+LocIPT_LocationPartTable+0]
    497526   mov     dl, [si+LocIPT_Drive]
    498    call    DriveIO_LoadPartition         ; Load Table...
     527   call    DriveIO_LoadPartition         ; Load Table...                         ; Rousseau: LOAD PARTITION !
    499528   ; --------------------------------------------------- MODIFY PARTITION TABLE
    500529   push    cs
     
    536565   or      byte ptr es:[di+LocBRPT_Flags], 80h ; set ACTIVE partition
    537566   IFDEF ReleaseCode
    538       call    DriveIO_SavePartition      ; Saves the Partition-Table
     567      call    DriveIO_SavePartition      ; Saves the Partition-Table             ; Rousseau: SAVE PARTITION !
    539568   ENDIF
    540569
     
    549578   ; BX:AX -> Absolute End-Position of Partition
    550579
    551    test    CFG_ForceLBAUsage, 1
     580   test    CFG_ForceLBAUsage, 1                                                  ; Rousseau: LBA
    552581   jnz     PSP_ForceI13X
    553    ; LBA-boundary at 16450560 (FB0400h)
     582   ; LBA-boundary at 16450560 (FB0400h) (16320x16x63)
    554583   cmp     bx, 00FBh
    555584   jb      PSP_NoI13X
    556585  PSP_ForceI13X:
    557    push    es di
     586   push    es di si
    558587      mov     ax, 3000h
    559588      mov     es, ax
    560589      xor     di, di
     590      ; Blokkeert starten van IBM BM !!
    561591      mov     wptr es:[di], '1I'
    562592      mov     wptr es:[di+2], 'X3'
    563    pop     di es
     593
     594      ;mov      si,3000h
     595      ;call     AuxIO_DumpSector
     596
     597   pop     si di es
    564598  PSP_NoI13X:
    565599
     
    607641      mov     cx, 0001h                  ; Cylinder 0, Sector 1
    608642      mov     dx, 0080h                  ; First HD, Head 0
    609       call    DriveIO_LoadPartition      ; Load Primary Partition Table
     643      call    DriveIO_LoadPartition      ; Load Primary Partition Table          ; Rousseau: LOAD MBR !
    610644      call    PART_MarkFirstGoodPrimary
    611645      IFDEF ReleaseCode
    612          call    DriveIO_SavePartition   ; Saves the Partition-Table
     646         call    DriveIO_SavePartition   ; Saves the Partition-Table             ; Rousseau: SAVE MBR !
    613647      ENDIF
    614648     PSP_NoHideAdjustPrimaryMark:
     
    622656      test    byte ptr [si+LocIPT_Flags], Flags_DriveLetter
    623657      jz      PSP_NoLVMReassignment
    624       movzx   bx, BootPartNo             ; EntryNumber is straight view
     658      ;movzx   bx, BootPartNo             ; EntryNumber is straight view
     659      mov   bl,BootPartNo             ; EntryNumber is straight view
     660      mov   bh,0
     661
    625662      mov     al, bptr [DriveLetters+bx]
    626663      sub     al, 3Dh                    ; Convert e.g. 80h -> 'C'
     
    679716   mov     dh, [si+LocIPT_LocationBegin+0]
    680717   mov     dl, [si+LocIPT_Drive]
    681    call    DriveIO_LoadPartition         ; Loads boot-sector...
     718   call    DriveIO_LoadPartition         ; Loads boot-sector...                  ; Rousseau: LOAD PART BOOT-SECTOR !!
    682719
    683720   test    CFG_DetectVIBR, 1
     
    734771      mov     si, 10h*4
    735772      xor     di, di                     ; INT 10h Vector to MBR Protection
    736       movsd
     773      ;movsd
     774      movsw
     775      movsw
     776
    737777      mov     si, 13h*4                  ; INT 13h Vector to MBR Protection
    738       movsd
     778      ;movsd
     779      movsw
     780      movsw
     781
    739782      mov     al, CFG_IgnoreWriteToMBR   ; Option to MBR Protection
    740783      stosb
     
    753796  PSP_NoMBRprotect:
    754797   cmp     bptr [si+LocIPT_SystemID], 08 ; I hate Microsuck NTFS check
    755    je      PSP_NoSpecialSupport
     798
     799   ;je      PSP_NoSpecialSupport
    756800
    757801      mov     di, offset PartitionSector ; ES:DI - Actual Boot-Record
     
    759803      mov     ax, wptr es:[di+24]
    760804      cmp     ax, 003Fh                  ; Physical Layout-Sectors... Safety check
    761       ja      PSP_NoSpecialSupport
     805
     806
     807      ; Rousseau: # Boot Logical Partitions)
     808      ; FreeDOS and eCS on extpart on non-huge needs special support. (old ja jump)
     809      ; PC-DOS7 on huge pri fat16 2G works with both (XP too) when at start of disk. (also when offset at 20MiB)
     810      ; PCD7 bonkt vast als in 2GiB log at start of space. "Starting PC DOS..." verschijnt. PCD Loader probleem.
     811      ; Offset van start-of-disk bij PCD7 niet meer dan 2GiB maken.
     812      ; Special is needed to boot ECS-CXXVAC (log-part) on Douwskie Box with 40G disk.
     813      ; FreeDOS 20G PRI SOD op 400G start niet met special.
     814      ; Heeft drive-id op 26h (36d) van 0dh !
     815      ; WinXP werkt met special en not-special op 400G normal geo.
     816      ; eCS op PRI op 2G met os2 ext geo werkt ook met beide.
     817      ; eCS LOG werkt niet zonder special op 400G.
     818      ; (hidden secs op 3F en moet 3F00 zijn; BM staat ervoor, 3F00=255*63+63)
     819      ; Laatste 63 is MBR.
     820      ;
     821      ; It seems PRI's already get special treatment in that they get their hidden secs updated.
     822      ; (100MB HD, moved 50MB PRI-DOS part UP, DFSee complains about wrong hidden, but AiR-BOOT corrects it before booting)
     823
     824      ; FreeDOS zet 63 in SPT in BPB op 255/255 geo !!!!
     825
     826      ; PC-DOS7 wil vaak niet starten als er meerdere pri's actief zijn.
     827      ; Logo verschijnt wel maar start niet door.
     828
     829
     830      ; Display volume-name
     831      pushf
     832      push     si
     833      add      si, LocIPT_Name
     834      call     MBR_TeletypeVolName
     835      xor      si,si
     836      call     MBR_TeletypeNL                                                    ; Rousseau: Just before booting the selected partition
     837      pop      si
     838      popf
     839
     840
     841
     842      jmp     special                                                            ; Rousseau: GOT IT !!! (LOG-BOOT) (alleen op huge disks !)
     843      ;jmp      PSP_NoSpecialSupport
     844      ;ja      PSP_NoSpecialSupport                                              ; Rousseau: original M. Kiewitz...
     845      ;jbe     PSP_NoSpecialSupport                                               ;   had to change to opposite !
     846
     847
    762848      mov     ax, wptr es:[di+26]
    763849      cmp     ax, 00FFh                  ; Physical Layout-Heads... Safety check
    764850      ja      PSP_NoSpecialSupport
    765851      mov     al, bptr es:[di+36]
    766       cmp     al, 80h                    ; Drive Letter
     852      cmp     al, 80h                    ; Drive Letter (ID)
    767853      jne     PSP_NoSpecialSupport
     854
    768855      ; Special Support needed
     856special:
     857      ; Write actual drive-letter to partition boot-record.
     858      ; This is according to BPB.
    769859      mov     al, bptr [si+LocIPT_Drive]
    770       mov     bptr es:[di+36], al        ; Write Actual Drive-Letter
     860      ; Also an influence with FreeDOS !
     861      ; Generates JFS ERROR when not set correctly !!!
     862      mov     bptr es:[di+36], al               ; Write Actual Drive-Letter (80h id first drive)        !!!!!!!!!!!!!!!!!!!!!!!
     863
     864      ; This could be incorrect when a partition is moved,
     865      ; or the system installer puts the wrong value here.
     866      ; FreeDOS (log-part) i.e. puts 03fH (63d) here, eventhough it is not a the start of the disk.
     867      ; This fixing is done by OS/2 BM as well, according to Martin.
    771868      mov     ax, [si+LocIPT_AbsoluteBegin]
    772       mov     wptr es:[di+28], ax        ; Fixing Hidden Sectors count
     869      mov     wptr es:[di+28], ax               ; low word of hidden sectors
    773870      mov     ax, [si+LocIPT_AbsoluteBegin+2]
    774       mov     wptr es:[di+30], ax        ; Done by OS/2 BootMan as well...
     871      mov     wptr es:[di+30], ax               ; high word of hidden sectors
    775872
    776873   ; ------------------------------------------------ LOGICAL PARTITION SUPPORT
    777874  PSP_NoSpecialSupport:
     875
     876;jmp   PSP_NoLogicalSupport
     877
    778878   test    byte ptr [si+LocIPT_Flags], Flags_DriveLetter
    779879   jz      PSP_NoLogicalSupport
    780880
    781       movzx   bx, BootPartNo             ; EntryNumber is straight view
     881      ;movzx   bx, BootPartNo             ; EntryNumber is straight view
     882      mov   bl,BootPartNo             ; EntryNumber is straight view
     883      mov   bh,0
     884
    782885      mov     al, bptr [DriveLetters+bx]
    783886      mov     bptr es:[di+37], al        ; Write Drive Letter (OS/2 only)
     
    793896      rep     movsw
    794897   pop     si
    795    ; ---------------------------------------------------- NOW START BOOT-RECORD
     898   ; ---------------------------------------------------- NOW START BOOT-RECORD  ; Rousseau: START PARTITION BOOT-RECORD !!
     899
     900
     901IFDEF AuxDebug
     902;   call     DEBUG_Dump2
     903ENDIF
     904
     905               ;
     906               ; ########################### WAIT FOR KEY ################################
     907               ;
     908
     909   ; Rousseau:
     910   ; Wait for key so we can see which volume is going to be started.
     911   ;xor     ax, ax
     912   ;int     16h
     913   ;cmp     al, 1bh                        ; is escape-key ?
     914   ;jne   skip_reenter
     915
     916   ;jmp      MBR_Main_ReEnterBootMenuPre   ; yep, re-enter boot-menu
     917
     918skip_reenter:
     919
     920
     921
     922
     923
     924
     925
     926
     927   ;
     928   ; BYE BYE
     929   ;
    796930   xor     ax, ax
    797931   xor     bx, bx
     
    801935   xor     dh, dh                        ; Drive supported by BIOS
    802936   mov     dl, cs:[si+LocIPT_Drive]      ; Drive Physical No
     937
    803938   IFDEF ReleaseCode
    804       db      0EAh                          ; JUMP TO Entry Point...Bye Bye
     939      db      0EAh                       ; JUMP TO Entry Point...Bye Bye
    805940      dw      StartBasePtr
    806941      dw      StartBaseSeg
    807942   ENDIF
    808943PART_StartPartition             EndP
     944
     945
     946
     947
     948
     949
     950
     951
     952
     953
    809954
    810955; This routine is called to hide a partition
     
    9231068; Destroyed: *none*
    9241069PART_SearchFileSysName          Proc Near  Uses bx dx
    925    movzx   bx, al
     1070   ;movzx   bx, al
     1071   mov   bl,al
     1072   mov   bh,0
     1073
    9261074   mov     si, offset FileSysIDs
    9271075  PSFSN_SearchLoop:
     
    9431091   mov     ah, dl
    9441092   ; AH is now the FileSystem-Flag
    945    movzx   bx, bh
     1093   ;movzx   bx, bh
     1094   mov   bl,bh
     1095   mov   bh,0
     1096
    9461097   shl     bx, 3   ; Offsets * 8
    9471098   mov     si, offset FileSysNames
    9481099   add     si, bx
    949    ret         
     1100   ret
    9501101PART_SearchFileSysName          EndP
    9511102
     
    9541105;       Out: AL - Hidden File-System-ID
    9551106PART_SearchFileSysHiddenID      Proc Near  Uses bx
    956    movzx   bx, al
     1107   ;movzx   bx, al
     1108   mov   bl,al
     1109   mov   bh,0
     1110
    9571111   mov     si, offset FileSysIDs
    9581112  PSFSHI_SearchLoop:
     
    10191173   ret
    10201174PART_CheckForValidPartName      EndP
     1175
     1176
     1177; Rousseau: added
     1178; Compare a volume-label in the IPT to the install-volume
     1179; SI holds pointer to entry in IPT
     1180; CY set if this entry is also the install-volume
     1181PART_IsInstallVolume            Proc Near   Uses ax cx dx si di
     1182      cld                                    ; Advance upwards with lodsb
     1183      mov   di, offset eCS_InstallVolume     ; Address of install-volume label (max. 11 chars)
     1184
     1185      mov   cx, 11                           ; Maximum length of label
     1186      xor   dl, dl                           ; Not found yet
     1187
     1188    ; Compare next character
     1189    PART_IsInstallVolumeNext:
     1190      lodsb                                  ; Load byte from SI (IPT-entry)
     1191      ;cmp      al,' '                        ; If space then use zero
     1192      ;jne      PART_IsInstallVolume_skip1
     1193      ;xor      al,al
     1194   PART_IsInstallVolume_skip1:
     1195      xchg     ah,al                         ; Save char to AH
     1196      xchg     si,di                         ; Exchange pointers
     1197      lodsb                                  ; Load byte from SI (install-volume label)
     1198      ;cmp      al,' '                        ; If space then use zero
     1199      ;jne      PART_IsInstallVolume_skip2
     1200      ;xor      al,al
     1201   PART_IsInstallVolume_skip2:
     1202      xchg     si,di                         ; Reexchange pointers
     1203      call     AuxIO_Teletype
     1204      call     CONV_ToUpper
     1205      call     AuxIO_Teletype
     1206      xchg     al,ah
     1207      call     AuxIO_Teletype
     1208      call     CONV_ToUpper
     1209      call     AuxIO_Teletype
     1210      call     AuxIO_TeletypeNL
     1211
     1212      ; Are both of them zero ?
     1213      ; Then the names could be the same, but cx must not equal 11
     1214      ; because that would indicate a null-string.
     1215      mov      dh,al
     1216      or       dh,ah
     1217      jz       PART_IsInstallVolumeFound
     1218
     1219      cmp      ah,al                         ; Are the the same ?
     1220      jnz      PART_IsInstallVolumeNotFound  ; Nope, compare ended
     1221      loop     PART_IsInstallVolumeNext      ; Yep, Compare next character
     1222
     1223   PART_IsInstallVolumeFound:
     1224      ; If CX is still 11 this was a zero string
     1225      ; and thus not a valid volume-name.
     1226      ; This should not occur as this function is only called when the first
     1227      ; byte is non-zero.
     1228      cmp      cx,11
     1229      je       PART_IsInstallVolumeNotFound
     1230      ; Found !
     1231      mov      dl,1                          ; Found
     1232      jmp      PART_IsInstallVolumeEnd
     1233
     1234
     1235   PART_IsInstallVolumeNotFound:
     1236      mov      dl,0
     1237      jmp      PART_IsInstallVolumeEnd
     1238
     1239
     1240   PART_IsInstallVolumeEnd:
     1241      ; Set the status in CY
     1242      mov      al,dl
     1243      add      al,'0'
     1244      call     AuxIO_TeletypeHexByte
     1245      call     AuxIO_TeletypeNL
     1246      rcr      dl,1                          ; Put found-flag in CY
     1247      ret
     1248PART_IsInstallVolume            EndP
  • tags/v1.07r/BOOTCODE/REGULAR/PARTSCAN.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22
     23IFDEF ModuleNames
     24DB 'PARTSCAN',0
     25ENDIF
     26
    2227; Note: This is complex code. So make sure that you know what you are doing in
    2328;        here.
     
    4853   mov     si, offset NewPartTable
    4954   mov     di, offset PartitionTable
    50    movzx   ax, NewPartitions
     55   ;movzx   ax, NewPartitions
     56   mov   al,NewPartitions
     57   mov   ah,0
     58
    5159   mov     CFG_Partitions, al
    5260   mov     bl, LocIPT_LenOfIPT
     
    5866   mov     si, offset NewDriveLetters
    5967   mov     di, offset DriveLetters
    60    mov     cx, LocIPT_MaxPartitions/2
    61    rep     movsw
     68   mov     cx, LocIPT_MaxPartitions
     69   rep     movsb
    6270
    6371; [Linux support removed since v1.02]
     
    8290   or      dl, dl
    8391   jz      PSSFP_NoAutoDriveLetter
    84    movzx   cx, CFG_Partitions
     92   ;movzx   cx, CFG_Partitions
     93   mov   cl,CFG_Partitions
     94   mov   ch,0
     95
    8596   or      cx, cx
    8697   jz      PSSFP_NoAutoDriveLetter
     
    118129   mov     wptr [ExtendedAbsPos+2], ax
    119130  PSSDFP_LoadThisPartition:
    120    call    DriveIO_LoadPartition
     131
     132   call    DriveIO_LoadPartition                                                 ; Rousseau: load a partition record
     133
    121134   jc      PSSDFP_InvalidPartition
     135
    122136   ; LVM Support - Reads LVM Information Sector
    123    call    DriveIO_LoadLVMSector
     137   call    DriveIO_LoadLVMSector                                                 ; Rousseau: load LVM sector
     138
    124139   call    PARTSCAN_ScanPartition
    125140   IFDEF ReleaseCode
     
    223238   add     ax, wptr [CurPartition_Location+0] ; +Partition-Absolute
    224239   adc     bx, wptr [CurPartition_Location+2] ;  sectors
    225    call    DriveIO_LoadTmpSector         ; Loads Boot record
     240   call    DriveIO_LoadTmpSector         ; Loads Boot record                     ; Rousseau: LOAD PARTITION BOOT RECORD !!
    226241   ; Sets up DS:SI - TmpSector
    227242
     
    249264   cmp     PartSystemID, 07h          ; We got IFS here?
    250265   jne     PCCTP_IFSdone
    251    ; Check, if 'JFS ' is at DWORD offset 36h
     266   ; Check, if 'JFS ' is at DWORD offset 36h                                     ; Rousseau: JFS check (LVM / IPT?)
    252267   cmp     wptr [si+36h], 'FJ'
    253268   jne     PCCTP_IFSnoJFS
     
    284299     PCCTP_HasVolumeLetter:
    285300      ; Save VolumeLetter in separate table
    286       movzx   bx, NewPartitions          ; NewPartitions is one behind here, so
     301      ;movzx   bx, NewPartitions          ; NewPartitions is one behind here, so
     302      mov   bl,NewPartitions          ; NewPartitions is one behind here, so
     303      mov   bh,0
     304
    287305      mov     [PartitionVolumeLetters+bx], al ; it's already a zero-based offset
    288306      ; Now copy VolumeID and VolumeName to temporary space
     
    291309      stosw
    292310      mov     ax, [si+LocLVM_PartitionID+2]
    293       stosw                              ; Set Serial-Field to LVM-VolumeID
     311      stosw
     312                              ; Set Serial-Field to LVM-VolumeID
     313      push     di
    294314      add     si, LocLVM_PartitionName
     315
    295316      mov     cx, 5
    296317      rep     movsw                      ; Copy LVM-PartitionName to Temp Space
    297       movsb                              ;  (11 bytes in total)
     318      movsb                               ;  (11 bytes in total)
     319
     320      pop   di
     321      cmp   PartSystemID, 0ah
     322
     323      jne   PCCTP_NoIbmBm
     324      mov   si, offset ibm_bm_name
     325      mov   cx,5
     326      rep   movsw
     327      movsb
     328
     329
     330
     331   PCCTP_NoIbmBm:
     332
     333
    298334   pop     di si dx ax
    299335   mov     si, offset MBR_NoName_Patched
     
    304340   pop     di si dx ax
    305341   test    ah, FileSysFlags_NoName       ; No-Name-Flag ? -> No Partition Name
    306    jnz     PCCTP_ThereIsNoName           ;                    available
     342
     343   jz      PCCTP_ThereIsAName
     344   jmp     PCCTP_ThereIsNoName           ;                    available
     345
     346   PCCTP_ThereIsAName:
     347
    307348      ; We check for NTFS (got detected a little bit earlier in this routine)
    308349      cmp     PartSystemID, 08h          ; We got IFS/NTFS here?
     
    312353      add     si, 2Bh                    ; DS:SI - Partition-Name
    313354      test    ah, FileSysFlags_FAT32     ; FAT32 specific name getting ?
     355
    314356      jz      PCCTP_ResumeNormal
     357
    315358      add     si, 1Ch                    ; Fix for FAT 32, shiat
    316359     PCCTP_ResumeNormal:
    317360      mov     cx, 11                     ;         11 bytes length
    318361      call    PART_CheckForValidPartName
    319       jnc     PCCTP_ThereIsNoName
     362      jc    PCCTP_ThereIsAName2
     363
     364      jmp     PCCTP_ThereIsNoName
     365
     366   PCCTP_ThereIsAName2:
     367
    320368      sub     si, 4                      ; DS:SI -> Serial&Name (15-Bytes)
    321369      xor     ah, ah                     ; no Flags_NoPartName
     
    343391            repz    cmpsb
    344392         pop     di si
    345          je      PCCTP_Match
     393
     394         jne   PCCTP_NoMatchYet
     395
     396         jmp      PCCTP_Match
     397
     398      PCCTP_NoMatchYet:
     399
    346400        PCCTP_SerialNameAlreadyFound:
    347401         add     di, LocIPT_LenOfIPT
     
    477531     PCCTP_LocCompFailed:
    478532      jmp     PCCTP_CompareFailed
    479      
     533
    480534   ; ==================================
    481535   ; =MATCH=, found partition in IPT...
     
    557611   ; Calculate Pointer to IPT
    558612   mov     di, offset NewPartTable       ; ES:DI - NewPartTable
    559    movzx   ax, NewPartitions
     613   ;movzx   ax, NewPartitions
     614   mov   al,NewPartitions
     615   mov   ah,0
     616
    560617   mov     bl, LocIPT_LenOfIPT
    561618   mul     bl
     
    575632   stosb
    576633   mov     al, cl                        ; Partition-Flags from register...
    577    stosb 
     634   stosb
    578635   mov     ax, PartCRC                   ; BootRecordCRC...
    579636   stosw
     
    620677
    621678   ; Calculate Size of this partition and put it into separate table...
    622    movzx   ax, NewPartitions
     679   ;movzx   ax, NewPartitions
     680   mov   al,NewPartitions
     681   mov   ah,0
     682
    623683   dec     ax
    624684   mov     bx, ax
     
    658718; Destroyed: None
    659719PARTSCAN_DefXref                Proc Near   Uses ax bx cx dx si di
    660    movzx   bx, dl
     720   ;movzx   bx, dl
     721   mov   bl,dl
     722   mov   bh,0
     723
    661724   mov     bptr [PartitionXref+bx], dh      ; X-Reference
    662725   ; Copy Hide-Config of IPT partition to new location in new table
     
    673736   rep     movsb                            ; Copy Hide-Config to NewHideTable
    674737   ; Process Logical-Drive-Letter table as well...
    675    movzx   bx, dl
     738   ;movzx   bx, dl
     739   mov   bl,dl
     740   mov   bh,0
     741
    676742   mov     al, bptr [DriveLetters+bx]       ; Get Drv-Letter from org. pos
    677    movzx   bx, dh
     743   ;movzx   bx, dh
     744   mov   bl,dl
     745   mov   bh,0
     746
    678747   mov     bptr [NewDriveLetters+bx], al    ; Put Drv-Letter to new pos
    679748   ret
     
    684753; Destroyed: None
    685754PARTSCAN_GetXref                Proc Near   Uses bx
    686    movzx   bx, dl
     755   ;movzx   bx, dl
     756   mov   bl,dl
     757   mov   bh,0
     758
    687759   mov     dh, bptr [PartitionXref+bx]      ; X-Reference
    688760   ret
     
    702774         cmp     al, 0FFh
    703775         je      PSSHCWX_SyncEmpty
    704          movzx   bx, al
     776         ;movzx   bx, al
     777         mov   bl,al
     778         mov   bh,0
     779
    705780         mov     al, [PartitionXref+bx]     ; Translate it
    706781         cmp     al, 0FFh
     
    729804   ret
    730805PARTSCAN_SyncHideConfigWithXref EndP
     806
     807ibm_bm_name:   db 'IBM BootMan',0
  • tags/v1.07r/BOOTCODE/REGULAR/PASSWORD.ASM

    r29 r30  
    1919;                                                       AiR-BOOT / PASSWORD
    2020;---------------------------------------------------------------------------
     21
     22IFDEF ModuleNames
     23DB 'PASSWORD',0
     24ENDIF
     25
    2126
    2227; Don't ask me, what I'm doing in here to encode the passwords. I don't even
     
    164169  PE_ContinueLoop:
    165170      mov     al, ds:[si]
    166       movzx   bx, ds:[si+8]
     171      ;movzx   bx, ds:[si+8]
     172      mov   bl,ds:[si+8]
     173      mov   bh,0
     174
    167175      add     bl, 16
    168176      mov     ah, ds:[si+bx]
  • tags/v1.07r/BOOTCODE/REGULAR/STD_TEXT.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'STD_TEXT',0
     24ENDIF
     25
    2226; If you modify this Copyright and release this under your own name,
    2327;  I'm going to sue your cheap ass, rape your dog and blow up your house. =)
    2428
    25 CopyrightVersionLen   equ   5
    26 Copyright             db ' AiR-BOOT v1.06 - (c) 1998-2009 M. Kiewitz, Dedicated to Gerd Kiewitz', 0
    27 BootEndMsg            db 'Free usage allowed, as long as you dont or have not worked for US government', 0
    28 BootEndMsg2           db 'This is GPLv3+ software. Please visit http://AiR-BOOT.sourceforge.net', 0
     29CopyrightVersionLen   equ   6
     30;Copyright             db ' AiR-BOOT v1.06 - (c) 1998-2009 M. Kiewitz, Dedicated to Gerd Kiewitz', 0
     31Copyright             db ' AiR-BOOT v1.07 - (c) 1998-2011 M. Kiewitz, Dedicated to Gerd Kiewitz', 0
     32;Copyright             db ' AiR-BOOT v1.07 - (c) 2011 M. Kiewitz - Rousseau test-version >502G (build: #24)', 0
     33;Copyright             db ' AiR-BOOT v1.07 - (c) 2011 M. Kiewitz   -  Release Candidate 1  -  (build: #25)', 0
     34;Copyright             db ' AiR-BOOT v1.07 - (c) 1998-2011 M. Kiewitz, Dedicated to Gerd Kiewitz (rc2-b27)', 0
     35;Copyright             db ' AiR-BOOT v1.07 - (c) 1998-2011 M. Kiewitz, Dedicated to Gerd Kiewitz (rc3-b31)', 0
     36;Copyright             db ' AiR-BOOT v1.07 - (c) 1998-2011 M. Kiewitz, Dedicated to Gerd Kiewitz (rc4-b33)', 0
     37;Copyright             db ' AiR-BOOT v1.07 - (c) 1998-2011 M. Kiewitz, Dedicated to Gerd Kiewitz (rc5-b35)', 0
     38
     39;BootEndMsg            db 'Free usage allowed, as long as you dont or have not worked for US government', 0
     40
     41; Rousseau: switch around
     42BootEndMsg           db 'This is GPLv3+ software. Please visit http://AiR-BOOT.sourceforge.net', 0
     43BootEndMsg2            db 'http://www.gnu.org/licenses/gpl.txt', 0
     44
     45AuxInitMsg           db 'Initializing Serial Communications on COM',0
    2946
    3047CheckID_MBR           db 'AiRBOOT'
     
    3350; Colors for special words hard-coded. Keep all 0s.
    3451TXT_SETUP_LowerMessage      db 'This software is released under ', 0, 'GPLv3+.', 0
    35                             db 'It may not be used by US government', 0
     52;                            db 'It may not be used by US government', 0
     53                            db 'http://www.gnu.org/licenses/gpl.txt', 0
    3654                            db 'For more information and source, please visit', 0
    3755                            db 'http://AiR-BOOT.sourceforge.net', 0
    38                             db 'Contact via e-mail: ', 0, 'm_kiewitz [AT] users.sourceforge.net', 0
     56;                            db 'Contact via e-mail: ', 0, 'm_kiewitz [AT] users.sourceforge.net', 0
     57                            db 'Contact via e-mail: ', 0, 'airboot@ecomstation.com', 0
    3958
    4059ContinueBIOSbootTable dw offset TXT_SETUP_MAGIC_CDROM
  • tags/v1.07r/BOOTCODE/REGULAR/TIMER.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'TIMER',0
     24ENDIF
     25
    2226; This here is one of the rare cases that I'm using DIV and MUL opcodes. I
    2327;  could have coded around them in here as well, but I was too lazy. Most of
     
    3943;       Out: Nothing
    4044TIMER_WaitTicCount              Proc Near   Uses ax bx dx
    41    movzx   bx, al
     45   ;movzx   bx, al
     46   mov   bl,al
     47   mov   bh,0
     48
    4249   call    TIMER_GetTicCount
    4350   add     bx, ax                        ; BX - Required lower Tic
     
    6269   mul     bl                            ; Result * 91
    6370   mov     dx, ax
    64    movzx   ax, bh
     71   ;movzx   ax, bh
     72   mov   al,bh
     73   mov   ah,0
     74
    6575   mov     bl, 18
    6676   mul     bl                            ; Remainder * 18
     
    8090   div     dl                            ; Tics : 91
    8191   mov     dh, al
    82    movzx   ax, ah
     92   ;movzx   ax, ah
     93   mov   al,ah
     94   mov   ah,0
     95
    8396   mov     dl, 18
    8497   div     dl                            ; Remainder : 18
     
    87100   mov     bl, 5
    88101   mul     bl                            ; Result * 5
    89    movzx   dx, dh
     102   ;movzx   dx, dh
     103   mov   dl,dh
     104   mov   dh,0
     105
    90106   add     ax, dx                        ; Add both together...
    91107   ret
  • tags/v1.07r/BOOTCODE/REGULAR/VIDEOIO.ASM

    r29 r30  
    1919;                                                      AiR-BOOT / VIDEO I/O
    2020;---------------------------------------------------------------------------
     21
     22IFDEF ModuleNames
     23DB 'VIDEOIO',0
     24ENDIF
    2125
    2226VideoIO_WaitRetrace             Proc Near   Uses ax dx
     
    3236   ret
    3337VideoIO_WaitRetrace             EndP
     38
     39
    3440
    3541; Holds the current position. Yeah, I know this is in the code area, but who
     
    100106   mov     ax, VideoIO_Segment
    101107   mov     es, ax
    102    movzx   ax, TextPosY
     108   ;movzx   ax, TextPosY
     109   mov   al,TextPosY
     110   mov   ah,0
     111
    103112   mov     bl, 160
    104113   mul     bl
     
    169178VideoIO_FixedPrint              EndP
    170179
     180; Rousseau:
     181; Turn off blinking
     182; http://www.ctyme.com/intr/rb-0088.htm does not mention this
     183VideoIO_NoBlinking              Proc Near   Uses ax bx
     184      mov      bx,0
     185      mov      ax,1003h
     186      int      10h
     187   ret
     188VideoIO_NoBlinking              EndP
     189
    171190;        In: AL - Single Char to Print
    172191; Destroyed: None
     
    179198   ret
    180199VideoIO_PrintSingleChar         EndP
     200
     201
     202
     203; Print hex-byte to screen
     204; This outputs two characters
     205; In:          AL - byte to send
     206; Out:         AL - byte sent
     207; Destroyed:   None
     208VideoIO_PrintHexByte    Proc     Near  Uses  ax
     209      call     CONV_BinToAsc              ; Returns high hex-nibble in AH, low hex-nibble in AL
     210      xchg     al,ah                      ; High hex-nibble first
     211      call     VideoIO_PrintSingleChar    ; Output to screen
     212      xchg     al,ah                      ; Low hex-nibble next
     213      call     VideoIO_PrintSingleChar    ; Output to screen
     214      ret
     215VideoIO_PrintHexByte    EndP
     216
     217
     218; Print hex-word to screen
     219; This outputs four characters
     220; In:          AX - word to send
     221; Out:         AX - word sent
     222; Destroyed:   None
     223VideoIO_PrintHexWord    Proc     Near
     224      xchg     al,ah                      ; High byte first
     225      call     VideoIO_PrintHexByte       ; Output to screen
     226      xchg     al,ah                      ; low byte next
     227      call     VideoIO_PrintHexByte       ; Output to screen
     228      ret
     229VideoIO_PrintHexWord    EndP
     230
     231
     232; Print hex-dword to screen
     233; This outputs eight characters
     234; In:          DX:AX - dword to send
     235; Out:         DX:AX - dword sent
     236; Destroyed:   None
     237VideoIO_PrintHexDWord   Proc     Near
     238      xchg     ax,dx
     239      call     VideoIO_PrintHexWord       ; High word first
     240      xchg     ax,dx
     241      call     VideoIO_PrintHexWord       ; Low word next
     242      ret
     243VideoIO_PrintHexDWord   EndP
     244
     245
     246; Print hex-qword to screen
     247; This outputs sixteen characters
     248; In:          BX:CX:DX:AX - qword to send
     249; Out:         BX:CX:DX:AX - qword sent
     250; Destroyed:   None
     251VideoIO_PrintHexQWord   Proc     Near
     252      xchg     dx,bx
     253      xchg     ax,cx
     254      call     VideoIO_PrintHexDWord      ; High dword first
     255      xchg     dx,bx
     256      xchg     ax,cx
     257      call     VideoIO_PrintHexDWord      ; Low dword next
     258      ret
     259VideoIO_PrintHexQWord   EndP
     260
     261
     262
     263
    181264
    182265;        In: AL - Single Char to Print
     
    205288   cmp     al, 99
    206289   ja      VIOPBN_DoNotWriteAnything
    207    movzx   bx, al
     290   ;movzx   bx, al
     291   mov   bl,al
     292   mov   bh,0
     293
    208294   call    VideoIO_Internal_SetRegs
    209295   cmp     bl, 10
    210296   jb      VIOPBN_Lower10
    211297   push    ax
    212       movzx   ax, bl
     298      ;movzx   ax, bl
     299      mov   al,bl
     300      mov   ah,0
     301
    213302      mov     dl, 10
    214303      div     dl
     
    231320;        In: AL - Single Byte to Print
    232321; Destroyed: None
    233 VideoIO_PrintByteDynamicNumber  Proc Near   Uses ax bx dx es di
     322VideoIO_PrintByteDynamicNumber  Proc Near   Uses ax bx cx dx es di               ; Rousseau: cx was missing from push-list
    234323   xor     cl, cl
    235324   mov     bh, al
     
    240329   cmp     ah, 100
    241330   jb      VIOPBDN_Lower100
    242    movzx   ax, ah
     331   ;movzx   ax, ah
     332   mov   al,ah
     333   mov   ah,0
     334
    243335   mov     dl, 100
    244336   div     dl
     
    249341   add     di, 2
    250342 VIOPBDN_Lower100:
    251    movzx   ax, ah
     343   ;movzx   ax, ah
     344   mov   al,ah
     345   mov   ah,0
     346
    252347   mov     dl, 10
    253348   div     dl
     
    270365; Destroyed: None Important
    271366VideoIO_Internal_MakeWinDown    Proc Near   Uses dx di
    272    movzx   dx, cl
     367   ;movzx   dx, cl
     368   mov   dl,cl
     369   mov   dh,0
     370
    273371   mov     bl, al
    274372   call    VideoIO_Internal_SetRegs
     
    281379   dec     dx
    282380   jnz     VIOIMWD_Loop
    283    ret     
     381   ret
    284382VideoIO_Internal_MakeWinDown    EndP
    285383
     
    287385; Destroyed: None Important
    288386VideoIO_Internal_MakeWinRight   Proc Near   Uses dx di
    289    movzx  dx, cl
     387   ;movzx  dx, cl
     388   mov   dl,cl
     389   mov   dh,0
     390
    290391   mov    bl, al
    291392   call   VideoIO_Internal_SetRegs
     
    298399      dec    dx
    299400   jnz    VIOIMWR_Loop
    300    ret     
     401   ret
    301402VideoIO_Internal_MakeWinRight   EndP
    302403
     
    366467   sub     bl, WinBeginPosX
    367468   dec     bl
    368  
     469
    369470  VIOIMW_Loop:
    370471      mov     ch, WinBeginPosY
     
    439540      call    VideoIO_CursorSet
    440541      call    VideoIO_CursorOn           ; Set and turn cursor on
    441      
     542
    442543      ; ES:DI - Screen-Position to Start of String
    443544      ; DL    - Position in String (relative to begin, base=0)
     
    460561         cmp     dl, StringLen           ; String "full" ?
    461562         jae     VIOLUES_Loop
    462          movzx   bx, dl
     563         ;movzx   bx, dl
     564         mov   bl,dl
     565         mov   bh,0
     566
    463567         shl     bx, 1
    464568         mov     es:[di+bx], al
     
    476580         mov     al, ' '
    477581         dec     dl
    478          movzx   bx, dl
     582         ;movzx   bx, dl
     583         mov   bl,dl
     584         mov   bh,0
     585
    479586         shl     bx, 1
    480587         mov     es:[di+bx], al
     
    502609   ret
    503610VideoIO_LetUserEditString       EndP
     611
     612
     613
     614;
     615; Rousseau Additions.
     616;
     617
     618
     619; Function Template
     620;ProcName                        Proc Near   Uses ax bx cx dx si es di
     621;ProcName                        EndP
     622
     623
     624;
     625; Clear the current page
     626;
     627VideoIO_ClearScreen             Proc Near   Uses ax bx cx dx si es di
     628   mov   al, 0       ; clear entire window
     629   mov   bh,07h      ; Attribute for new lines
     630   xor   cx,cx       ; Row, Column ULC
     631   xor   dx,dx
     632   dec   dx          ; Row, Column LRC (does this corrupt other pages ?)
     633   mov   ah, 06h     ; Function Code
     634   int   10h         ; Do It !
     635   ret
     636VideoIO_ClearScreen             EndP
     637
     638;
     639; Rousseau: added
     640; Set poosition to teletype cursor
     641;
     642VideoIO_SyncPos                 Proc Near   Uses ax bx cx dx
     643   pushf
     644   mov   bh, 0
     645   mov   ah, 03h
     646   int   10h
     647   mov   [TextPosX], dl
     648   mov   [TextPosY], dh
     649   popf
     650   ret
     651VideoIO_SyncPos                 EndP
     652
     653
     654
     655VideoIO_DBG_WriteString         Proc Near   Uses ax bx cx dx si es di
     656   mov   ch, [CFG_Partitions]                                                    ; y
     657   add   ch, 7
     658   add   ch, [CFG_IncludeFloppy]
     659   push cx
     660   mov   cl, 1                                                                   ; x
     661   call  VideoIO_Locate
     662   mov   ch, 15                                                                  ; fgc
     663   mov   cl, 0                                                                   ; bgc
     664   call  VideoIO_Color
     665   mov   si, offset ShowBootLog
     666   call  VideoIO_Print
     667   pop cx
     668   inc   ch
     669
     670   ;mov   ch, 21                                                                 ; y
     671   mov   cl, 1                                                                   ; x
     672   call  VideoIO_Locate
     673   mov   ch, 15                                                                  ; fgc
     674   mov   cl, 0                                                                   ; bgc
     675   call  VideoIO_Color
     676
     677
     678   ; Rousseau:
     679   mov al, [NewPartitions]
     680   ;call  VideoIO_PrintByteDynamicNumber
     681   mov al, [CFG_Partitions]
     682   ;call  VideoIO_PrintByteDynamicNumber
     683   ret
     684VideoIO_DBG_WriteString         EndP
     685
     686
     687; Dump the disk-info.
     688; Disk number is in DL.
     689VideoIO_DumpDiskInfo    Proc Near
     690
     691   VideoIO_DumpDiskInfo_next_disk:
     692      push     dx
     693      xor      ax,ax
     694      mov      al,[TextPosY]
     695      push     ax
     696
     697      mov      ax,21
     698      mov      dh,dl
     699      and      dh,01111111b
     700      mul      dh
     701      mov      dh,al
     702
     703      mov      [TextPosX],dh
     704
     705      mov   si, offset Disk
     706      call  VideoIO_Print
     707      mov   al,dl
     708
     709      ; NIET GOED, GAAT FOUT > 9, HEX PRINT GEBRUIKEN !!
     710      shr      al,4
     711      add      al,'0'
     712      call     VideoIO_PrintSingleChar
     713      mov      al,dl
     714      and      al,01111111b
     715      add      al,'0'
     716      call     VideoIO_PrintSingleChar
     717      mov      al,'h'
     718      call     VideoIO_PrintSingleChar
     719
     720      inc      [TextPosY]
     721      mov      [TextPosX],dh
     722
     723      mov      al,'-'
     724      mov      cl,17
     725      call     VideoIO_PrintSingleMultiChar
     726
     727      inc      [TextPosY]
     728      mov      [TextPosX],dh
     729      mov      si, offset BiosCyls
     730      call     VideoIO_Print
     731
     732      push     dx
     733      mov      bx,offset BIOS_Cyls
     734      xor      dh,dh
     735      and      dl,01111111b
     736      shl      dx,1
     737      shl      dx,1
     738      add      bx,dx
     739      mov      ax,[bx]
     740      mov      dx,[bx+02]
     741      call     VideoIO_PrintHexDWord
     742      pop      dx
     743
     744      inc      [TextPosY]
     745      mov      [TextPosX],dh
     746      mov      si, offset BiosHeads
     747      call     VideoIO_Print
     748
     749      push     dx
     750      mov      bx,offset BIOS_Heads
     751      xor      dh,dh
     752      and      dl,01111111b
     753      shl      dx,1
     754      shl      dx,1
     755      add      bx,dx
     756      mov      ax,[bx]
     757      mov      dx,[bx+02]
     758      call     VideoIO_PrintHexDWord
     759      pop      dx
     760
     761      inc      [TextPosY]
     762      mov      [TextPosX],dh
     763      mov      si, offset BiosSecs
     764      call     VideoIO_Print
     765
     766      push     dx
     767      mov      bx,offset BIOS_Secs
     768      xor      dh,dh
     769      and      dl,01111111b
     770      shl      dx,1
     771      shl      dx,1
     772      add      bx,dx
     773      mov      ax,[bx]
     774      mov      dx,[bx+02]
     775      call     VideoIO_PrintHexDWord
     776      pop      dx
     777
     778      inc      [TextPosY]
     779      mov      [TextPosX],dh
     780      mov      si, offset LvmSecs
     781      call     VideoIO_Print
     782
     783      push     dx
     784      mov      bx,offset TrueSecs
     785      xor      dh,dh
     786      and      dl,01111111b
     787      shl      dx,1
     788      shl      dx,1
     789      add      bx,dx
     790      mov      ax,[bx]
     791      mov      dx,[bx+02]
     792      call     VideoIO_PrintHexDWord
     793      pop      dx
     794
     795      inc      [TextPosY]
     796      mov      [TextPosX],dh
     797      mov      si, offset BiosLBA
     798      call     VideoIO_Print
     799
     800      push     dx
     801      mov      bx,offset BIOS_TotalSecs
     802      xor      dh,dh
     803      and      dl,01111111b
     804      shl      dx,1
     805      shl      dx,1
     806      shl      dx,1
     807      add      bx,dx
     808      mov      ax,[bx]
     809      mov      dx,[bx+02]
     810      call     VideoIO_PrintHexDWord
     811      pop      dx
     812
     813      inc      [TextPosY]
     814      mov      [TextPosX],dh
     815
     816      pop      ax
     817      mov      [TextPosY],al
     818      pop      dx
     819
     820      inc      dl
     821      mov      al,dl
     822      and      al,01111111b
     823      cmp      al,[TotalHarddiscs]
     824      jae      VideoIO_DumpDiskInfo_end
     825      jmp      VideoIO_DumpDiskInfo_next_disk
     826
     827   VideoIO_DumpDiskInfo_end:
     828      mov      [TextPosX],0
     829      add      [TextPosY],6
     830      ret
     831VideoIO_DumpDiskInfo    EndP
     832
     833
     834
     835; Disk Info to Dump to AB LogScreen
     836Disk:             db "DISK ",0
     837BiosCyls:         db "Cyls    :",0
     838BiosHeads:        db "Heads   :",0
     839BiosSecs:         db "Secs    :",0
     840LvmSecs:          db "SecsLVM :",0
     841BiosLBA:          db "LBA Secs:",0
     842
     843
     844HugeBootDisk:     db "Boot Disk is Huge    : ",0
     845DisksFound:       db "Disks Found          : ",0
     846PartitionsFound:  db "Partitions Found     : ",0
     847;AutoStartPart:    db "Auto Start Partition : ",0
     848
     849Phase1:           db "eCS Install Phase 1  : ",0
     850
     851
     852ShowMenu:         db "Press TAB to return to the AiR-BOOT Menu",0
     853ShowBootLog:      db "Press TAB to see the Boot Log...",0
     854
     855Yes:              db "YES",0
     856No:               db "NO",0
     857On:               db "ON",0
     858Off:              db "OFF",0
     859None:             db "NONE",0
     860Active:           db "ACTIVE",0
     861NotActive:        db "NOT ACTIVE",0
     862
     863; New Line for use by MBR_Teletype
     864NL:         db 0dh, 0ah, 0
  • tags/v1.07r/BOOTCODE/SETUP/MAIN.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'MAIN',0
     24ENDIF
     25
    2226LocMENU_RoutinePtr           equ          0
    2327LocMENU_VariablePtr          equ          2
     
    6670
    6771SETUP_CheckEnterSETUP           Proc Near   Uses
     72
     73
     74
     75   ; Rousseau: added
     76   ;mov     SETUP_ExitEvent, 0
     77   ;xor     al, al                        ; -PARTITION SETUP PreDefines-
     78   ;mov     PartSetup_UpperPart, al       ; Upper-Partition == 0
     79   ;mov     PartSetup_ActivePart, al      ; Active-Partition == 0
     80
     81   ; Setup PartitionPointers-Table...again (needed when re-entering setup)
     82   ;call    PART_CalculateStraightPartPointers
     83   ;call    VideoIO_DBG_WriteString
     84   ; Rousseau: end added
     85
     86
     87
    6888   test    CFG_AutoEnterSetup, 1
    6989   jnz     SCES_ForceEnter
     
    152172      je      SMT_KeyEsc
    153173      cmp     ah, Keys_F1
    154       je      SMT_KeyHelp
     174      jne   skip_xx
     175      jmp      SMT_KeyHelp
     176   skip_xx:
    155177      cmp     ah, Keys_F10
    156       je      SMT_SaveAndExitNOW
     178      jne   skip_yy
     179      jmp      SMT_SaveAndExitNOW
     180   skip_yy:
    157181      ; ASCII values...
    158182      cmp     al, Keys_Space
     
    264288SETUP_MenuTask                  EndP
    265289
     290
     291
     292CLR_MENU_WINDOW_CLASSIC    = 0e01h
     293CLR_MENU_WINDOW_BM   = 0e01h
    266294;        In: BP - Pointer to Menu
    267295;       Out: DH - Active Item on Screen
    268296SETUP_DrawMenuOnScreen          Proc Near   Uses
    269297   call    SETUP_DrawMenuWindow
    270    mov     cx, 0E01h
     298   mov     cx, CLR_MENU_WINDOW_BM
    271299   call    VideoIO_Color
    272300   xor     ch, ch
     
    294322SETUP_FillUpItemPacks           EndP
    295323
     324
     325
     326CLR_SELECTED_ITEM_CLASSIC  = 0f04h
     327CLR_SELECTED_ITEM_BM = 0f04h
    296328; Displays selected Item on screen
    297329;        In: DH - Active Item
    298330; Destroyed: None
    299331SETUP_DrawSelectItem            Proc Near Uses cx
    300    mov     cx, 0F04h
     332   mov     cx, CLR_SELECTED_ITEM_BM
    301333   call    VideoIO_Color
    302334   mov     ch, dh
     
    305337SETUP_DrawSelectItem            EndP
    306338
     339
     340CLR_DESELECTED_ITEM_CLASSIC  = 0e01h
     341CLR_DESELECTED_ITEM_BM  = 0e01h
    307342; Display last-selected Item on screen (De-Select)
    308343;        In: DL - Active Item
    309344; Destroyed: None
    310345SETUP_DrawDeSelectItem          Proc Near Uses cx
    311    mov     cx, 0E01h
     346   mov     cx, CLR_DESELECTED_ITEM_BM
    312347   call    VideoIO_Color
    313348   mov     ch, dl
     
    356391   mov     wptr TextColorFore, dx
    357392   ret
    358          
     393
    359394   ; ------------------------------------------------------ Draw ITEMPACK
    360395  SDIOS_ItemPackDraw:
     
    368403        SDIOS_ItemPack_NoFixUpItemPack:
    369404         call    VideoIO_Locate
    370          mov     cx, 0F01h
     405
     406CLR_ITEM_PACK_CLASSIC   = 0f01h
     407CLR_ITEM_PACK_BM  = 0f01h
     408
     409         mov     cx, CLR_ITEM_PACK_BM
    371410         call    VideoIO_Color           ; White on blue background
    372411         mov     si, ds:[si+LocMENU_ItemNamePtr] ; SI - Name of Item
     
    418457   ret
    419458SETUP_FillUpItemPack_Now        EndP
     459
     460
    420461
    421462SETUP_DrawMenuWindow            Proc Near   Uses es
     
    474515   mov     cl, CopyrightVersionLen
    475516   call    VideoIO_FixedPrint            ; and 'vX.XX'.
    476    add     si, 3
     517
     518   ; Rousseau:
     519   ; Strange, had to adjust this value.
     520   ; Somewhere some offset changed...
     521   ; Possibly happened with the movzx change to 286 instructions because some
     522   ; offsets are hard coded.
     523   ;add     si, 3
     524   add     si, 2
     525
    477526   call    GetLenOfString                ; CX - Len of "Copyright" string
    478527   mov     dx, cx
     
    871920   mov     si, di                        ; DS:SI - Current Password
    872921   xor     dl, dl
    873    ; DL - location of cursor (first=0)         
     922   ; DL - location of cursor (first=0)
    874923  SLEP_Loop:
    875924   mov     cx, EnterPwd_Location
     
    910959   cmp     dl, 8
    911960   je      SLEP_SkipThiz
    912    movzx   bx, dl
     961
     962   ;movzx   bx, dl
     963   mov   bl,dl
     964   mov   bh,0
     965
    913966   mov     ds:[si+bx], al
    914967   mov     al, 42                        ; fixed star :]
     
    920973   je      SLEP_SkipThiz
    921974   dec     dl
    922    movzx   bx, dl
     975
     976   ;movzx   bx, dl
     977   mov   bl,dl
     978   mov   bh,0
     979
    923980   mov     al, 32
    924981   mov     ds:[si+bx], al
     
    10981155   jz      SMICTN_NoFiller
    10991156   dec     al
    1100    movzx   cx, al
     1157
     1158   ;movzx   cx, al
     1159   mov   cl,al
     1160   mov   ch,0
     1161
    11011162   xor     al, al
    11021163   rep     stosb                         ; and fill up with NULs, if required
     
    15231584  SMCBBS_Enabled:
    15241585   dec     dl
    1525    movzx   bx, dl
     1586
     1587   ;movzx   bx, dl
     1588   mov   bl,dl
     1589   mov   bh,0
     1590
    15261591   shl     bx, 1
    15271592   mov     si, wptr [ContinueBIOSbootTable+bx]
  • tags/v1.07r/BOOTCODE/SETUP/MENUS.ASM

    r29 r30  
    5555;
    5656
     57IFDEF ModuleNames
     58DB 'MENUS',0
     59ENDIF
     60
    5761LocMENU_LenOfMenuPtrBlock    equ          8
    5862LocMENU_LenOfItemPack        equ         12
     
    6367LocMENU_ItemPack             equ          8 ; only if VariablePtr>0
    6468
    65 SETUP_MainMenu: 
     69SETUP_MainMenu:
    6670                db      0                ; Where Current Item will get saved
    6771                dw      offset TXT_SETUPHELP_MAIN ; Pointer to help information
     
    209213                dw      offset TXT_SETUP_IgnoreLVM, offset TXT_SETUPHELP_IgnoreLVM
    210214                dw      6 dup (0)
    211                 dw      offset SETUPMAGIC_EnableDisable, offset CFG_ForceLBAUsage
     215                dw      offset SETUPMAGIC_EnableDisable, offset CFG_ForceLBAUsage            ; Rousseau: LBA
    212216                dw      offset TXT_SETUP_ForceLBAUsage, offset TXT_SETUPHELP_ForceLBAUsage
    213217                dw      6 dup (0)
  • tags/v1.07r/BOOTCODE/SETUP/PART_SET.ASM

    r29 r30  
    1919;                                          AiR-BOOT SETUP / PARTITION SETUP
    2020;---------------------------------------------------------------------------
     21
     22IFDEF ModuleNames
     23DB 'PART_SET',0
     24ENDIF
    2125
    2226; This here is called from Menu in AIR-BSET.asm
     
    5862      je      PSM_KeyVIBRdetection
    5963      cmp     al, TXT_SETUP_FlagLetterHide
    60       je      PSM_KeyHiddenSetup
     64
     65      jne   skip_x
     66      jmp      PSM_KeyHiddenSetup
     67   skip_x:
    6168      cmp     al, TXT_SETUP_FlagLetterDrvLetter
    62       je      PSM_KeyDriveLetterForceSetup
     69
     70      jne   skip_y
     71      jmp      PSM_KeyDriveLetterForceSetup
     72   skip_y:
     73
    6374      cmp     al, TXT_SETUP_FlagLetterExtMShack
    64       je      PSM_KeyDriveLetterExtMShack
     75      jne   skip_z
     76      jmp      PSM_KeyDriveLetterExtMShack
     77   skip_z:
    6578      jmp     PSM_MainLoop
    6679
     
    331344   inc     al
    332345   call    VideoIO_PrintByteNumber
    333    
     346
    334347   ; Display "No Hd" field aka "01/01"
    335348   call    VideoIO_Locate
     
    426439   call    PARTSETUP_ReColorPart
    427440
    428    ; Running Fixing 
     441   ; Running Fixing
    429442   cmp     dh, 0FFh
    430443   jne     PSBCB_NoUnderflow
     
    558571   ;  This is done for security purposes, because if they match, we will update
    559572   ;  the name in both - IPT and BR/LVM.
    560    movzx   bx, dl
     573
     574   ;movzx   bx, dl
     575   mov   bl,dl
     576   mov   bh,0
     577
    561578   cmp     [PartitionVolumeLetters+bx], 0 ; ==0 means not supported by LVM
    562579   je      PSCPN_NotLVMSupported
     
    638655
    639656   ; Check, where to save 2nd destination to...
    640    movzx   bx, dl
     657
     658   ;movzx   bx, dl
     659   mov   bl,dl
     660   mov   bh,0
     661
    641662   cmp     [PartitionVolumeLetters+bx], 0 ; ==0 means not supported by LVM
    642663   je      PSCPN_SaveBootRecord
     
    775796PARTHIDESETUP_DrawMenuBase      Proc Near   Uses dx
    776797   ; PartSetup_HiddenX1
    777    mov     cx, 0D05h                     ; Lila on lila
     798
     799CLR_PART_HIDE_WINDOW_BASE_CLASSIC   = 0d05h
     800CLR_PART_HIDE_WINDOW_BASE_BM   = 0a02h
     801
     802   mov     cx, CLR_PART_HIDE_WINDOW_BASE_BM                    ; Lila on lila
    778803   call    VideoIO_Color
    779804   mov     bh, 05h
     
    792817   mov     al, 'µ'
    793818   call    VideoIO_PrintSingleChar
    794    mov     cx, 0E05h                     ; Yellow on Lila
     819
     820CLR_PART_HIDE_WINDOW_LABEL_CLASSIC = 0e05h
     821CLR_PART_HIDE_WINDOW_LABEL_BM = 0e02h
     822
     823   mov     cx, CLR_PART_HIDE_WINDOW_LABEL_BM                     ; Yellow on Lila
    795824   call    VideoIO_Color
    796825   mov     si, offset TXT_SETUP_HideFeature
    797826   call    VideoIO_Print
    798    mov     cx, 0D05h                     ; Lila on lila
     827
     828CLR_PART_HIDE_WINDOW_BORDER_CLASSIC = 0d05h
     829CLR_PART_HIDE_WINDOW_BORDER_BM = 0d02h
     830
     831
     832   mov     cx, CLR_PART_HIDE_WINDOW_BORDER_BM                     ; Lila on lila
    799833   call    VideoIO_Color
    800834   mov     al, 'Æ'
     
    851885
    852886   ; --- Make ':' Line down
    853    mov     cx, 0F05h                     ; Yellow on Lila
     887
     888CLR_PART_HIDE_MENU_BASE_CLASSIC  = 0f05h
     889CLR_PART_HIDE_MENU_BASE_BM  = 0f02h
     890
     891   mov     cx, CLR_PART_HIDE_MENU_BASE_BM                     ; Yellow on Lila
    854892   call    VideoIO_Color
    855893   mov     ch, 07h
     
    873911   dec     dh
    874912   jnz     PHSRP_Loop
     913
     914CLR_PART_HIDE_MENU_MARKERS_CLASSIC = 0d05h
     915CLR_PART_HIDE_MENU_MARKERS_BM = 0a02h
     916
    875917   ; At last calculate Scroll-Markers
    876    mov     cx, 0D05h                     ; Lila on lila
     918   mov     cx, CLR_PART_HIDE_MENU_MARKERS_BM                     ; Lila on lila                          ; Hide Feature Markers
    877919   call    VideoIO_Color
    878920   mov     cx, 0603h                     ; 6, +3
     
    919961   push    cx
    920962      ; Display "Label" field aka "OS2" without ending NULs/Spaces
    921       mov     cx, 0F05h
     963
     964CLR_PART_HIDE_LABEL_CLASSIC   = 0f05h
     965CLR_PART_HIDE_LABEL_BM = 0f02h
     966
     967      mov     cx, CLR_PART_HIDE_LABEL_BM
    922968      call    VideoIO_Color              ; Bright White on Lila
    923969      push    si
     
    927973         call    VideoIO_FixedPrint
    928974      pop     si
    929       mov     cx, 0D05h
     975
     976CLR_PART_HIDE_WINDOW_FS_CLASSIC   = 0d05h
     977CLR_PART_HIDE_WINDOW_FS_BM = 0a02h
     978
     979      mov     cx, CLR_PART_HIDE_WINDOW_FS_BM
    930980      call    VideoIO_Color              ; Bright Lila on Lila
    931981      mov     al, ' '
     
    948998   call    VideoIO_Locate
    949999   push    cx
    950       mov     cx, 0E05h
     1000
     1001CLR_PART_HIDE_WINDOW_CHOISES_CLASSIC   = 0e05h
     1002CLR_PART_HIDE_WINDOW_CHOISES_BM   = 0e02h
     1003
     1004      mov     cx, CLR_PART_HIDE_WINDOW_CHOISES_BM
    9511005      call    VideoIO_Color              ; Yellow on Lila
    9521006      mov     al, ' '
     
    9801034  PHSBCB_SkipRetrace:
    9811035
     1036CLR_PART_HIDE_WINDOW_MENU_BAR_CLASSIC  = 5eh
     1037CLR_PART_HIDE_WINDOW_MENU_BAR_BM = 2eh
     1038
    9821039   ; Deactivate current active bar
    983    mov     cl, 5Eh                       ; Yellow on Lila
     1040   mov     cl, CLR_PART_HIDE_WINDOW_MENU_BAR_BM                       ; Yellow on Lila
    9841041   call    PARTHIDESETUP_ReColorPart
    9851042
    986    ; Running Fixing 
     1043   ; Running Fixing
    9871044   cmp     dh, 0FFh
    9881045   jne     PHSBCB_NoUnderflow
     
    10151072
    10161073   ; Activate fresh active bar
    1017    mov     cl, 1Fh                       ; Bright White on Blue
     1074
     1075CLR_PART_HIDE_WINDOW_MENU_ACTIVE_BAR_CLASSIC = 1fh
     1076CLR_PART_HIDE_WINDOW_MENU_ACTIVE_BAR_BM   = 1fh
     1077
     1078   mov     cl, CLR_PART_HIDE_WINDOW_MENU_ACTIVE_BAR_BM                       ; Bright White on Blue
    10181079   call    PARTHIDESETUP_ReColorPart
    10191080   ; Now DL==DH
     
    11781239
    11791240   ; Now get the Logical-Drive-Letter for that partition...
    1180    movzx   bx, dl
     1241   ;movzx   bx, dl
     1242   mov   bl,dl
     1243   mov   bh,0
     1244
    11811245   mov     dl, bptr [DriveLetters+bx]
    11821246
     
    12641328
    12651329   ; Draw base-window
    1266    mov     cx, 0D05h                     ; Lila on lila
     1330
     1331CLR_PART_DL_XX_CLASSIC = 0d05h
     1332CLR_PART_DL_XX_BM = 0a02h
     1333
     1334   mov     cx, CLR_PART_DL_XX_BM                     ; Lila on lila
    12671335   call    VideoIO_Color
    12681336   mov     bh, 06h
     
    12811349      mov     al, 'µ'
    12821350      call    VideoIO_PrintSingleChar
    1283       mov     cx, 0E05h                  ; Yellow on Lila
     1351
     1352CLR_PART_DL_WINDOW_TITLE_CLASSIC  = 0e05h
     1353CLR_PART_DL_WINDOW_TITLE_BM  = 0e02h
     1354
     1355      mov     cx, CLR_PART_DL_WINDOW_TITLE_BM                  ; Yellow on Lila
    12841356      call    VideoIO_Color
    12851357      mov     si, offset TXT_SETUP_DriveLetter
    12861358      call    VideoIO_Print
    1287       mov     cx, 0D05h                  ; Lila on lila
     1359
     1360CLR_PART_DL_WINDOW_BORDER2_CLASSIC  = 0d05h
     1361CLR_PART_DL_WINDOW_BORDER2_BM  = 0a02h
     1362
     1363      mov     cx, CLR_PART_DL_WINDOW_BORDER2_BM                 ; Lila on lila
    12881364      call    VideoIO_Color
    12891365      mov     al, 'Æ'
     
    12921368   ; Display help-information
    12931369   mov     si, offset TXT_SETUPHELP_DriveLetter
    1294    mov     cx, 0D05h                     ; Lila on lila
     1370
     1371CLR_PART_DL_SETUP_HELP_CLASSIC = 0d05h
     1372CLR_PART_DL_SETUP_HELP_BM = 0a02h
     1373
     1374
     1375   mov     cx, CLR_PART_DL_SETUP_HELP_BM                     ; Lila on lila
    12951376   call    VideoIO_Color
    12961377
     
    13061387   mov     al, '>'
    13071388   call    VideoIO_PrintSingleChar
    1308    ; 
     1389   ;
    13091390   mov     cx, 0F01h                     ; Bright White on Blue
    13101391   call    VideoIO_Color
  • tags/v1.07r/BOOTCODE/SPECIAL/APM.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'APM',0
     24ENDIF
     25
    2226; Here is APM Code to turn off the computer
    2327
  • tags/v1.07r/BOOTCODE/SPECIAL/F00K/BILLSUXX.ASM

    r29 r30  
    2727; Here is code to change Extended Partition to Type 05h or 0Fh depending
    2828;  on the partition's P-flag including the overall M$hack-Enable Flag.
     29
     30IFDEF ModuleNames
     31DB 'BILLSUXX',0
     32ENDIF
     33
    2934MSHACK_ProcessPartTables        Proc Near  Uses ax dx di
    3035   ; Check Overall M$-Hack Enable
  • tags/v1.07r/BOOTCODE/SPECIAL/FAT16.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'FAT16',0
     24ENDIF
     25
    2226; Here is access code for accessing FAT-16 partitions. It's not a complete
    2327;  File-API and only for simple readonly-access.
     
    2731;        I did not want to code silly cylinder stuff here. I have also used
    2832;        i386 code in here, because Linux requires so as well. Please note that
    29 ;        I don't use i386 code anywhere (!) else in AiR-BOOT.
    30 ;
     33;        I don't use i386 code anywhere (!) else in AiR-BOOT.                    ; Rousseau: yes you did, movezx is 386-only :-)
     34;                                                                                ; Replaced by 286 instructions.
    3135; Initialize FAT-16 access on specified partition (required for following xs)
    3236;        In: DS:SI - IPT-Entry that contains a FAT-16 partition
     
    131135      mov    ax, dx
    132136      sub    ax, 2                       ; Everything starts at Cluster 2
    133       movzx  bx, FAT16_SecsPerCluster
     137      ;movzx  bx, FAT16_SecsPerCluster
     138      mov   bl,FAT16_SecsPerCluster
     139      mov   bh,0
     140
    134141      mul    bx
    135142      shl    edx, 16
     
    145152   add    di, ax
    146153   ; Finally, look for next Cluster following to this one...
    147    movzx  bx, dl
     154   ;movzx  bx, dl
     155   mov   bl,dl
     156   mov   bh,0
     157
    148158   shl    bx, 1                          ; BX - Offset within FAT-Table
    149159   shr    dx, 8                          ; DX - FAT-Sector
     
    259269         pop       ax
    260270         mov    dx, si
    261          movzx  cx, ah
     271         ;movzx  cx, ah
     272         mov   cl,ah
     273         mov   ch,0
     274
    262275         rep    movsb
    263276         mov    si, dx                   ; Restore SI
  • tags/v1.07r/BOOTCODE/SPECIAL/FX.ASM

    r29 r30  
    1919;                                                            AiR-BOOT / F/X
    2020;---------------------------------------------------------------------------
     21
     22IFDEF ModuleNames
     23DB 'FX',0
     24ENDIF
    2125
    2226; There you go. Some nice old-school demo coder effects :)
     
    268272      cmp     di, FX_MaxScanLine
    269273      jb      FX_MCS_VerticalLoop
    270  
     274
    271275      mov     ax, FX_CooperBarsTimer
    272276      dec     ax
     
    386390     FX_CC_ActiveState:
    387391      ; increment SinusPos by 1
    388       movzx   bx, bptr ds:[FX_SinusPos+si]
     392      ;movzx   bx, bptr ds:[FX_SinusPos+si]
     393      mov   bl,bptr ds:[FX_SinusPos+si]
     394      mov   bh,0
     395
    389396      inc     bx
    390397      mov     bptr ds:[FX_SinusPos+si], bl
     
    409416FX_CalculateWideScroller        Proc Near   Uses
    410417   mov     bx, FX_WideScrollerCurPos
    411    movzx   cx, FX_WideScrollerSpeed
     418   ;movzx   cx, FX_WideScrollerSpeed
     419   mov   cl,FX_WideScrollerSpeed
     420   mov   ch,0
     421
    412422   test    FX_WideScrollerAbsDirection, 1
    413423   jnz     FXCWS_RIGHT
  • tags/v1.07r/BOOTCODE/SPECIAL/FXTABLES.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'FXTABLES',0
     24ENDIF
     25
    2226; Sinus-Table - 128xWORD = 256 Bytes
    2327FX_SinusTab dw 00101h, 00102h, 00103h, 00105h, 00107h, 0010Ah, 0010Dh, 00111h
  • tags/v1.07r/BOOTCODE/SPECIAL/LINUX.ASM

    r29 r30  
    4040;  some nice menus, setup, text, cyrillic support, demo-coder effects, easy
    4141;  handling, help, auto-detection and plenty of other stuff INTO AROUND 25k.
    42 ; 
     42;
    4343; Oh, why is this code here? Because of 2 friends of mine. Otherwise I wouldnt
    4444;  have done it as well as fat16.asm.
     45
     46IFDEF ModuleNames
     47DB 'LINUX',0
     48ENDIF
    4549
    4650Linux_TranslateBase     db '/dev/hd'
     
    217221   mov     dx, ds:[si+LocIPT_LocationBegin]
    218222   ; from now on, we don't need si anymore
    219    
     223
    220224   ; Linux has 1 'BR' (which is crap) and some setup sectors
    221225   ; we load them at 9000:0, what a luck, we are at 8000:0 :-))
     
    342346   jz      LLL_LoadNormalKernel
    343347   jmp     LLL_LoadBigKernel
    344          
     348
    345349  LLL_LoadNormalKernel:
    346350   ; NORMAL KERNEL
     
    458462                        dw          0
    459463                        dw          0FFFFh
    460 MBR_Linux_GDT_Dst       db          0, 0, 10h    ; Dest is "10000:0" 
     464MBR_Linux_GDT_Dst       db          0, 0, 10h    ; Dest is "10000:0"
    461465                        db          093h
    462466                        dw          0
  • tags/v1.07r/BOOTCODE/SPECIAL/LVM.ASM

    r29 r30  
    1919;                                                            AiR-BOOT / LVM
    2020;---------------------------------------------------------------------------
     21
     22IFDEF ModuleNames
     23DB 'LVM',0
     24ENDIF
    2125
    2226LVM_InitCRCTable                Proc Near   Uses
     
    2529   mov    di, offset LVM_CRCTable
    2630  LVM_ICRCT_Loop:
    27       movzx  ax, cl
     31      ;movzx  ax, cl
     32      mov   al,cl
     33      mov   ah,0
     34
    2835      xor    dx, dx                      ; DX:AX - CRC-Value
    2936      mov    ch, 8
     
    8693   test    [CFG_IgnoreLVM], 1            ; We are supposed to ignore LVM, so
    8794   jnz     LVMCSS_InvalidSignature       ;  any sector is bad!
    88    cmp     wptr [si+LocLVM_SignatureStart], 5202h
     95   cmp     wptr [si+LocLVM_SignatureStart], 5202h                                ; Rousseau: identify LVM sector
    8996   jne     LVMCSS_InvalidSignature
    9097   cmp     wptr [si+LocLVM_SignatureStart+2], 'BM'
  • tags/v1.07r/BOOTCODE/SPECIAL/SOUND.ASM

    r29 r30  
    1919;                                                  AiR-BOOT / SOUND SUPPORT
    2020;---------------------------------------------------------------------------
     21
     22IFDEF ModuleNames
     23DB 'SOUND',0
     24ENDIF
    2125
    2226; Here is some sound code. Requested by Hex1753.
     
    108112   ret
    109113SOUND_WaitToSilence            EndP
     114
     115
     116
     117; Rousseau: added
     118SOUND_Beep                     PROC Near
     119   pushf
     120   pusha
     121
     122   mov      al, 7
     123   mov      bh, 0
     124   mov      bl, 7
     125   mov      ah, 0eh
     126   int      10h
     127
     128   popa
     129   popf
     130   ret
     131SOUND_Beep                     ENDP
  • tags/v1.07r/BOOTCODE/SPECIAL/VIRUS.ASM

    r29 r30  
    2323; system will get halted. On Non-Real-Mode this will only save Interrupt Vectors.
    2424; Segment Registers preserved
     25
     26IFDEF ModuleNames
     27DB 'VIRUS',0
     28ENDIF
     29
    2530VIRUS_CheckForStealth      Proc Near  Uses ds si es di
    2631   xor     al, al
     
    154159   mov     bx, BootBasePtr
    155160   mov     dx, 0080h
    156    mov     cx, 003Ch                     ; First Harddrive, Sector 60
     161   ;mov     cx, 003Ch                     ; First Harddrive, Sector 60
     162   mov     cx, image_size / sector_size  ; Harddisc 0, Sector 60 (or 62 for extended version)
    157163   mov     ax, 0301h                     ; Write 1 Sector
    158164   int     13h
     
    166172   mov     bx, offset TmpSector
    167173   mov     dx, 0080h
    168    mov     cx, 003Ch                     ; Harddisc 0, Sector 60
     174   ;mov     cx, 003Ch                     ; Harddisc 0, Sector 60
     175   mov     cx, image_size / sector_size  ; Harddisc 0, Sector 60 (or 62 for extended version)
    169176   mov     ax, 0201h                     ; Load 1 Sector
    170177   pushf
  • tags/v1.07r/BOOTCODE/TEXT/EN/OTHER.ASM

    r29 r30  
    5252;----------------------------------|----------------------------|
    5353TXT_BootMenuEnterSetup         db 'F10 to enter Setup', 0
     54;TXT_BootMenuEnterBootLog       db 'TAB to enter Boot Log', 0
    5455
    5556; Dynamic Length (till 80 chars)
     
    6162                               db 13, 10, '   Press any key to continue...', 0
    6263
    63 TXT_VirusFoundMain:            db 13, 10, ' - !ATTENTION! -> A VIRUS WAS FOUND <- !ATTENTION!', 13, 10, 0
     64TXT_VirusFoundMain:            db 13, 10, ' - !ATTENTION! -> A V1RU5 WAS FOUND <- !ATTENTION!', 13, 10, 0
    6465TXT_VirusFound1ok:             db '    It got squashed, but the system may not reboot correctly. If this happens,', 13, 10
    6566                               db '    use your AiR-BOOT system disc.', 13, 10, 0
  • tags/v1.07r/ENV/DOS.BAT

    r29 r30  
    11rem This file sets Assembler, Linker and EXE2BIN for DOS environment
    2 set assembler=tasm.exe /m9 /dReal /t
     2set assembler=tasm.exe /m9 /dReal /l
     3rem set assembler=tasm.exe /m9 /dReal /t
    34set linker=tlink.exe /3 /x
    45set exe2bin=exe2bin.exe
  • tags/v1.07r/INCLUDE/ASM.INC

    r29 r30  
    3636
    3737; Shortcuts for pointer-types
    38 bptr                            equ   byte ptr
    39 wptr                            equ   word ptr
    40 dptr                            equ  dword ptr
    41 qptr                            equ  qword ptr
    42 tptr                            equ  tbyte ptr
     38bptr                             equ   byte ptr
     39wptr                             equ   word ptr
     40dptr                             equ  dword ptr
     41qptr                             equ  qword ptr
     42tptr                             equ  tbyte ptr
     43
     44
     45sector_size                      equ   512
     46image_size_60secs                equ   7800h
     47image_size_62secs                equ   7c00h
     48
     49;image_size                       equ   image_size_60secs
     50image_size                       equ   image_size_62secs
     51
     52sector_count                     equ   image_size / sector_size                  ; Image size in sectors
     53
     54IF image_size EQ image_size_60secs
     55   partition_count               equ   30                                        ; Maximum number of partitions supported
     56ELSE
     57   partition_count               equ   45                                        ; Maximum number of partitions supported
     58ENDIF
  • tags/v1.07r/INSTALL/C/INST-OS2.TGT

    r29 r30  
    22225
    2323MCommand
    24 67
    25 copy inst-os2.exe ..\..\RELEASE\OS2\airboot2.exe
     24131
     25@ren INST-OS2.EXE INST-OS2.XEX
     26@ren INST-OS2.XEX INST-OS2.EXE
     27copy INST-OS2.EXE ..\..\RELEASE\OS2\AIRBOOT2.EXE
    2628del install.obj
    2729
     
    2931MItem
    303212
    31 inst-os2.exe
     33INST-OS2.EXE
    32347
    3335WString
     
    36388
    3739WVList
    38 2
     404
    39419
    40 MCState
     42MVState
    414310
    4244WString
     
    454711
    4648WString
     4922
     50?????Other options(,):
     510
     5212
     53WString
     5419
     55op map=INST-OS2.MAP
     560
     5713
     58MVState
     5914
     60WString
     617
     62OS2LINK
     6315
     64WString
     6522
     66?????Other options(,):
     671
     6816
     69WString
     7019
     71op map=INST-OS2.MAP
     720
     7317
     74MCState
     7518
     76WString
     777
     78OS2LINK
     7919
     80WString
    478113
    4882?????Map file
    49831
    50840
    51 12
     8520
    5286MCState
    53 13
     8721
    5488WString
    55897
    5690OS2LINK
    57 14
     9122
    5892WString
    599324
     
    61951
    62960
    63 15
     9723
     98WVList
     991
     10024
     101ActionStates
     10225
     103WString
     1045
     105&Make
     10626
    64107WVList
    651080
     
    681111
    691120
    70 16
     11327
    71114WPickList
    721152
    73 17
     11628
    74117MItem
    751183
    76119*.c
    77 18
     12029
    78121WString
    791224
    80123COBJ
    81 19
     12430
    82125WVList
    831260
    84 20
     12731
    85128WVList
    861290
     
    891321
    901330
    91 21
     13432
    92135MItem
    931369
    94 install.c
    95 22
     137INSTALL.C
     13833
    96139WString
    971404
    98141COBJ
    99 23
     14234
    100143WVList
    1011440
    102 24
     14535
    103146WVList
    1041470
    105 17
     14828
    1061491
    1071501
  • tags/v1.07r/INSTALL/C/INST-WIN.TGT

    r29 r30  
    22225
    2323MCommand
    24 69
    25 copy inst-win.exe ..\..\RELEASE\WINNT\airbootw.exe
     24133
     25@ren INST-WIN.EXE INST-WIN.XEX
     26@ren INST-WIN.XEX INST-WIN.EXE
     27copy INST-WIN.EXE ..\..\RELEASE\WINNT\AIRBOOTW.EXE
    2628del install.obj
    2729
     
    2931MItem
    303212
    31 inst-win.exe
     33INST-WIN.EXE
    32347
    3335WString
     
    36388
    3739WVList
    38 2
     404
    39419
    40 MCState
     42MVState
    414310
    4244WString
     
    454711
    4648WString
     4922
     50?????Other options(,):
     510
     5212
     53WString
     5419
     55op map=INST-WIN.MAP
     560
     5713
     58MVState
     5914
     60WString
     617
     62WINLINK
     6315
     64WString
     6522
     66?????Other options(,):
     671
     6816
     69WString
     7019
     71op map=INST-WIN.MAP
     720
     7317
     74MCState
     7518
     76WString
     777
     78WINLINK
     7919
     80WString
    478113
    4882?????Map file
    49831
    50840
    51 12
     8520
    5286MCState
    53 13
     8721
    5488WString
    55897
    5690WINLINK
    57 14
     9122
    5892WString
    599324
     
    61951
    62960
    63 15
     9723
    6498WVList
    65 1
    66 16
     992
     10024
    67101ActionStates
    68 17
     10225
    69103WString
    701045
    71105&Make
    72 18
     10626
     107WVList
     1080
     10927
     110ActionStates
     11128
     112WString
     1134
     114&Run
     11529
    73116WVList
    741170
     
    771201
    781210
    79 19
     12230
    80123WPickList
    811242
    82 20
     12531
    83126MItem
    841273
    85128*.c
    86 21
     12932
    87130WString
    881314
    89132COBJ
    90 22
     13333
    91134WVList
    921350
    93 23
     13634
    94137WVList
    951380
     
    981411
    991420
    100 24
     14335
    101144MItem
    1021459
    103 install.c
    104 25
     146INSTALL.C
     14736
    105148WString
    1061494
    107150COBJ
    108 26
     15137
    109152WVList
    1101530
    111 27
     15438
    112155WVList
    1131560
    114 20
     15731
    1151581
    1161591
  • tags/v1.07r/INSTALL/C/INSTALL.C

    r29 r30  
    2525   #include <os2.h>
    2626   #include <malloc.h>
     27   #include <stdlib.h>                                                           // Rousseau: added to use getenv()
    2728   #define PLATFORM_OS2
    2829#elif defined(__NT__)
     
    3940
    4041
    41 #define STATUS_NOTINSTALLED 0 // No ID found
    42 #define STATUS_CORRUPT      1 // ID found, Checksum failure
    43 #define STATUS_INSTALLED    2 // ID found, Checksum valid
    44 #define STATUS_INSTALLEDMGU 3 // ID found, Checksum valid, may get updated
    45 #define STATUS_IMPOSSIBLE   4 // Unable/Not willing to install
     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
     58
     59
    4660
    4761// ============================================================================
    4862//  Variables
    4963// ============================================================================
    50 CHAR   Track0[60*512];   // current track 0 from harddrive
    51 CHAR   Bootcode[60*512]; // bootcode image from airboot.bin
     64CHAR   Track0[SECTOR_COUNT * BYTES_PER_SECTOR];                                  // current track 0 from harddrive
     65CHAR   Bootcode[SECTOR_COUNT * BYTES_PER_SECTOR];                                // bootcode image from airboot.bin
    5266
    5367UCHAR  Bootcode_LanguageID    = ' ';
     
    6478BOOL   Option_ForceConfig      = FALSE;
    6579BOOL   Option_Silent           = FALSE;
     80
     81BOOL   Option_CID              = FALSE;                                          // Rousseau: added
    6682
    6783BOOL   Install_Code            = FALSE;
     
    86102   USHORT OS2_GetIOCTLHandle () {
    87103      USHORT IOCTLHandle = 0;
    88  
     104
    89105      if (DosPhysicalDisk(INFO_GETIOCTLHANDLE, &IOCTLHandle, sizeof(IOCTLHandle),"1:" , 3) != 0)
    90106         return 0;
     
    114130         AutoDriveLetter       = BootDrive+0x7D;
    115131         AutoDriveLetterSerial = InfoLevel2.ulVSN;
    116 printf("%X\n", InfoLevel2.ulVSN);
     132         if (!Option_CID) {
     133            printf("%X\n", InfoLevel2.ulVSN);
     134         }
    117135       }
    118136    }
     
    122140      USHORT               SectorsPerTrack = 0;
    123141      DEVICEPARAMETERBLOCK DeviceParmBlock;
    124       ULONG                ulDataLength; 
     142      ULONG                ulDataLength;
    125143
    126144      IOCTLHandle = OS2_GetIOCTLHandle();
     
    129147         SectorsPerTrack = DeviceParmBlock.cSectorsPerTrack;
    130148      OS2_FreeIOCTLHandle (IOCTLHandle);
    131       if (SectorsPerTrack>61) return TRUE;
     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 !!
    132151      // OS/2 is only able to support 512-byte/sector media, so we dont need to check this
    133152      return FALSE;
     
    136155   BOOL Track0Load (void) {
    137156      USHORT      IOCTLHandle;
    138       ULONG       TrackLayoutLen  = sizeof(TRACKLAYOUT)+sizeof(ULONG)*(60-1);
     157      ULONG       TrackLayoutLen  = sizeof(TRACKLAYOUT)+sizeof(ULONG)*(SECTOR_COUNT-1);
    139158      TRACKLAYOUT *TrackLayoutPtr = malloc(TrackLayoutLen);
    140159      ULONG       cbParms = sizeof(TrackLayoutPtr);
    141       ULONG       cbData  = 512;
     160      ULONG       cbData  = BYTES_PER_SECTOR;
    142161      int         i;
    143162      BOOL        Success = FALSE;
     
    149168      TrackLayoutPtr->usCylinder    = 0;
    150169      TrackLayoutPtr->usFirstSector = 0;
    151       TrackLayoutPtr->cSectors      = 60;
    152 
    153       for (i=0; i<60; i++) {
     170      TrackLayoutPtr->cSectors      = SECTOR_COUNT;
     171
     172      for (i=0; i<SECTOR_COUNT; i++) {
    154173         TrackLayoutPtr->TrackTable[i].usSectorNumber = i+1;
    155          TrackLayoutPtr->TrackTable[i].usSectorSize   = 512;
     174         TrackLayoutPtr->TrackTable[i].usSectorSize   = BYTES_PER_SECTOR;
    156175       }
    157176
     
    166185   BOOL Track0Write (void) {
    167186      USHORT      IOCTLHandle;
    168       ULONG       TrackLayoutLen  = sizeof(TRACKLAYOUT)+sizeof(ULONG)*(60-1);
     187      ULONG       TrackLayoutLen  = sizeof(TRACKLAYOUT)+sizeof(ULONG)*(SECTOR_COUNT-1);
    169188      TRACKLAYOUT *TrackLayoutPtr = malloc(TrackLayoutLen);
    170189      ULONG       cbParms = sizeof(TrackLayoutPtr);
    171       ULONG       cbData  = 512;
     190      ULONG       cbData  = BYTES_PER_SECTOR;
    172191      INT         i;
    173192      BOOL        Success = FALSE;
     
    180199      TrackLayoutPtr->usCylinder    = 0;
    181200      TrackLayoutPtr->usFirstSector = 0;
    182       TrackLayoutPtr->cSectors      = 60;
    183 
    184       for (i=0; i<60; i++) {
     201      TrackLayoutPtr->cSectors      = SECTOR_COUNT;
     202
     203      for (i=0; i<SECTOR_COUNT; i++) {
    185204         TrackLayoutPtr->TrackTable[i].usSectorNumber = i+1;
    186          TrackLayoutPtr->TrackTable[i].usSectorSize   = 512;
     205         TrackLayoutPtr->TrackTable[i].usSectorSize   = BYTES_PER_SECTOR;
    187206       }
    188207
     
    218237      GetVersionEx(&Version);
    219238      if (Version.dwPlatformId == VER_PLATFORM_WIN32_NT) return TRUE;
    220       printf(" - This installer is for WindowsNT family only.\n");
    221       printf("    Please use DOS installer for Windows9x.\n");
     239      if (!Option_CID) {
     240         printf(" - This installer is for WindowsNT family only.\n");
     241         printf("    Please use DOS installer for Windows9x.\n");
     242      }
    222243      return FALSE;
    223244    }
     
    231252      CloseHandle(IOCTLHandle);
    232253    }
    233  
     254
    234255   USHORT CountHarddrives (void) {
    235256      return 1;
     
    246267         SectorsPerTrack = Geometry.SectorsPerTrack;
    247268      WINNT_FreeIOCTLHandle(IOCTLHandle);
    248       if (SectorsPerTrack>61) return TRUE;
     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 !!
    249271      return FALSE;
    250272    }
     
    257279      IOCTLHandle = WINNT_GetIOCTLHandle();
    258280      SetFilePointer(IOCTLHandle, 0, 0, FILE_BEGIN);
    259       if (ReadFile(IOCTLHandle, &Track0, 60*512, &BytesRead, NULL))
     281      if (ReadFile(IOCTLHandle, &Track0, SECTOR_COUNT * BYTES_PER_SECTOR, &BytesRead, NULL))
    260282         Success = TRUE;
    261283      WINNT_FreeIOCTLHandle(IOCTLHandle);
     
    270292      IOCTLHandle = WINNT_GetIOCTLHandle();
    271293      SetFilePointer(IOCTLHandle, 0, 0, FILE_BEGIN);
    272       if (WriteFile(IOCTLHandle, &Track0, 60*512, &BytesWritten, NULL))
     294      if (WriteFile(IOCTLHandle, &Track0, SECTOR_COUNT * BYTES_PER_SECTOR, &BytesWritten, NULL))
    273295         Success = TRUE;
    274296      WINNT_FreeIOCTLHandle(IOCTLHandle);
     
    307329   FileHandle = fopen("airboot.bin", "rb");
    308330   if (!FileHandle) {
    309       printf("airboot.bin not found\n");
     331      if (!Option_CID) {
     332         printf("airboot.bin not found\n");
     333      }
    310334      return FALSE;
    311335    }
     
    313337   fseek (FileHandle, 0, SEEK_END);
    314338   BootcodeSize = ftell(FileHandle);
    315    if (BootcodeSize!=30720) {
     339   if (BootcodeSize!=IMAGE_SIZE) {
    316340      fclose (FileHandle);
    317       printf("Invalid airboot.bin\n");
     341      if (!Option_CID) {
     342         printf("Invalid airboot.bin\n");
     343      }
    318344      return FALSE;
    319345    }
    320346   fseek (FileHandle, 0, SEEK_SET);
    321    fread (&Bootcode, 1, 30720, FileHandle);
     347   fread (&Bootcode, 1, IMAGE_SIZE, FileHandle);
    322348   fclose (FileHandle);
    323349
     
    330356 }
    331357
     358/**
     359 * Check MBR and AB signatures.
     360 * Also check code sectors if AB is installed.
     361 * Set global status accordingly.
     362 */
    332363void Status_CheckCode (void) {
    333364   USHORT TotalCodeSectorsUsed = 0;
     
    338369   // EZ-Setup check!
    339370   Status_Code = STATUS_NOTINSTALLED;
    340    if ((Track0[0x1FE]!=0x55) || (Track0[0x1FF]!=0xAA)) return;
    341    if (strncmp(&Track0[2], "AiRBOOT", 7)!=0) return;
     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
    342373   // MBR and AiR-BOOT signature found...
    343    TotalCodeSectorsUsed = Track0[0x10];
    344    SectorPtr = &Track0[1*512]; // Start at sector 2
     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
    345377   while (TotalCodeSectorsUsed>0) {
    346378      Checksum = GetChecksumOfSector(Checksum, SectorPtr);
    347       SectorPtr += 512;
     379      SectorPtr += BYTES_PER_SECTOR;
    348380      TotalCodeSectorsUsed--;
    349381    }
    350382   if (Checksum!=*(PUSHORT)&Track0[0x11]) {
    351       Status_Code = STATUS_CORRUPT; return;
     383      Status_Code = STATUS_CORRUPT; return;                                      // Bad checksum for code
    352384    }
    353385   // Checksum fine...
     
    355387   Installed_CodeVersion = (Track0[0x0D] << 8) | Track0[0x0E];
    356388   if (Installed_CodeVersion<Bootcode_Version)
    357       Status_Code = STATUS_INSTALLEDMGU;
     389      Status_Code = STATUS_INSTALLEDMGU;                                         // Do upgrade
    358390     else
    359       Status_Code = STATUS_INSTALLED;
    360  }
     391      Status_Code = STATUS_INSTALLED;                                            // Same version installed
     392 }
     393
    361394
    362395void Status_CheckConfig (void) {
    363    PCHAR  ConfigSectorPtr = &Track0[0x6C00];
     396   PCHAR  ConfigSectorPtr = &Track0[CONFIG_OFFSET];                              // Config sector offset hard-coded !
    364397   PCHAR  SectorPtr = NULL;
    365398   USHORT Checksum = 0;
     
    369402   if (strncmp(ConfigSectorPtr, "AiRCFG-TABLE­", 13)==0) {
    370403      // AiR-BOOT signature found...
    371       SectorPtr = &Track0[54*512]; // Start at sector 55
    372       ConfigChecksum = *(PUSHORT)&Track0[54*512+20];
     404      SectorPtr = &Track0[54 * BYTES_PER_SECTOR];                                // Start at sector 55
     405      ConfigChecksum = *(PUSHORT)&Track0[54 * BYTES_PER_SECTOR + 20];
    373406      // Remove checksum
    374       *(PUSHORT)&Track0[54*512+20] = 0;
     407      *(PUSHORT)&Track0[54 * BYTES_PER_SECTOR + 20] = 0;                         // Config sector secnum hard-coded !
     408
     409      /*
     410      // Rousseau:
     411      // Calculate chechsum over 5 sectors starting at the config-sector at 55.
     412      // 55,56,57,58,59 (60 is MBR backup in normal version)
     413      // SHOULD ADJUST THIS FOR EXTENDED VERSION !                               // !!!!!!!!!!!
     414      */
    375415      SectorCount = 5;
    376416      while (SectorCount>0) {
    377417         Checksum = GetChecksumOfSector(Checksum, SectorPtr);
    378          SectorPtr += 512;
     418         SectorPtr += BYTES_PER_SECTOR;
    379419         SectorCount--;
    380420       }
    381421      // Restore checksum
    382       *(PUSHORT)&Track0[54*512+20] = ConfigChecksum;
     422      *(PUSHORT)&Track0[54 * BYTES_PER_SECTOR + 20] = ConfigChecksum;            // Config sector secnum hard-coded !
    383423      if (Checksum!=ConfigChecksum) {
    384424        Status_Config = STATUS_CORRUPT; return;
     
    386426       }
    387427      // Checksum fine
    388       Installed_ConfigVersion = (Track0[54*512+0x0D] << 8) | Track0[54*512+0x0E];
     428      Installed_ConfigVersion = (Track0[54 * BYTES_PER_SECTOR + 0x0D] << 8) | Track0[54 * BYTES_PER_SECTOR + 0x0E];
    389429      if (Installed_ConfigVersion>=Bootcode_ConfigVersion) {
    390430         Status_Config = STATUS_INSTALLED; return;
     
    394434      //  If new configuration data was added, those spaces are not overwritten
    395435      // Sector 60 (MBR-BackUp) *MUST BE* copied, otherwise it would be lost.
     436      // Rousseau: Upgrade from v0.27
    396437      if (Installed_ConfigVersion<=0x27) {
    397438         // UPGRADE v0.27 and prior versions
     
    407448         //           -> Total-length 101
    408449         //          Offset 432 Length 34 - New IPT entry (BIOS continued)
    409          memcpy(&Bootcode[54*512+16], &Track0[54*512+16], 69-16);
    410          memcpy(&Bootcode[54*512+466], &Track0[54*512+466], 46);
     450         memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], 69 - 16);    // CHECKEN !!
     451         memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 466], &Track0[54 * BYTES_PER_SECTOR + 466], 46);       // CHECKEN !!
    411452         // Sector 56-57 no changes
    412          memcpy(&Bootcode[55*512], &Track0[55*512], 1024);
     453         memcpy(&Bootcode[55*512], &Track0[55 * BYTES_PER_SECTOR], 1024);
    413454         // Sector 58-59
    414455         // Changes: Offset 900 Length 30 - Logical driveletter table
    415          memcpy(&Bootcode[57*512], &Track0[57*512], 900);
     456         memcpy(&Bootcode[57 * BYTES_PER_SECTOR], &Track0[57 * BYTES_PER_SECTOR], 900);               // AANPASSEN 900 !!
    416457         // Sector 60 copy unmodified
    417          memcpy(&Bootcode[59*512], &Track0[59*512], 512);
     458         memcpy(&Bootcode[59 * BYTES_PER_SECTOR], &Track0[59 * BYTES_PER_SECTOR], BYTES_PER_SECTOR);  // CHECKEN !!
    418459         return;
    419460       }
     461      // Rousseau: Upgrade from v0.91
    420462      if (Installed_ConfigVersion<=0x91) {
    421463         // UPGRADE v0.91 and prior versions
    422464         // Sector 55-57 no changes
    423          memcpy(&Bootcode[54*512+16], &Track0[54*512+16], 512+1024-16);
     465         memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], BYTES_PER_SECTOR + 1024 - 16);   // CHACKEN !!
    424466         // Sector 58-59
    425467         // Changes: Offset 900 Length 30 - Logical driveletter table
    426          memcpy(&Bootcode[57*512], &Track0[57*512], 900);
     468         memcpy(&Bootcode[57 * BYTES_PER_SECTOR], &Track0[57 * BYTES_PER_SECTOR], 900);               // AANPASSEN 900 !!
    427469         // Sector 60 copy unmodified
    428          memcpy(&Bootcode[59*512], &Track0[59*512], 512);
     470         memcpy(&Bootcode[59 * BYTES_PER_SECTOR], &Track0[59 * BYTES_PER_SECTOR], BYTES_PER_SECTOR);
    429471         return;
    430472       }
     
    432474      //  We don't need to "upgrade" the configuration, we simply copy it over.
    433475      //   From Sector 55, 6 sectors in total but never header/version
    434       memcpy(&Bootcode[54*512+16], &Track0[54*512+16], 512*6-16);
     476      // Rousseau: We copy two more sectors (8 in total) in the extended (45 partition) version.
     477      switch (IMAGE_SIZE) {
     478         case IMAGE_SIZE_60SECS: {
     479            memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], BYTES_PER_SECTOR * 6 - 16);
     480            break;
     481         }
     482         case IMAGE_SIZE_62SECS: {
     483            memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], BYTES_PER_SECTOR * 8 - 16);
     484            break;
     485         }
     486      }
     487
    435488      return;
    436489    }
     
    442495
    443496// Checks partition table for valid data
    444 BOOL Virus_CheckThisMBR (PCHAR MBRptr) {
     497BOOL Virus_CheckThisMBR (PCHAR MBRptr) {                                         // Rousseau: adjusted this function
    445498   USHORT PartitionNo;
    446499   ULONG  CHSStart, CHSEnd;
    447500
    448    if (*(PUSHORT)(MBRptr + 510)!=0x0AA55) return FALSE;
     501   //printf("DEBUG: Virus_CheckThisMBR\n");
     502
     503   if (*(PUSHORT)(MBRptr + BYTES_PER_SECTOR - 2)!=0x0AA55) return FALSE;
     504
     505   //printf("DEBUG: Virus_CheckThisMBR - Checking Partitions\n");
     506
    449507   MBRptr += 446;
    450508   for (PartitionNo=0; PartitionNo<4; PartitionNo++) {
    451       if (*(MBRptr+4)!=0) {
     509      if (*(MBRptr+4) != 0) {
     510         /*
     511         // Rousseau 2011-02-04: ## Check for GPT ##
     512         */
     513         if (*(MBRptr+4) == GPT) {
     514            if (!Option_CID) {
     515               printf("ERROR: This drive is partitioned with the modern GPT layout.\n");
     516               printf("       AiR-BOOT is currently unable to handle GPT partitioned drives.\n");
     517               printf("       Installation aborted, no changes made.\n");
     518            }
     519            exit(2);
     520         }
     521
     522         /*
     523         // Rousseau: 2011-05-05
     524         //           Last minute change to have AB install a disk with nopartitions
     525         //           on the bootdisk.
     526         //           It still checks for GPT but will skip the check below.
     527         */
     528         continue;
     529
     530         //printf("DEBUG: Virus_CheckThisMBR - Partition: %d\n", PartitionNo);
    452531         // Partition-type defined, analyse partition data
    453          CHSStart = (*(MBRptr+3) | ((*(MBRptr+2) >> 6) << 8)) << 16; // Cylinder
    454          CHSStart |= (*(MBRptr+2) & 0x3F) | ((*(MBRptr+1) << 8)); // Sector / Head
    455 
    456          CHSEnd = (*(MBRptr+7) | ((*(MBRptr+6) >> 6) << 8)) << 16; // Cylinder
    457          CHSEnd |= (*(MBRptr+6) & 0x3F) | ((*(MBRptr+5) << 8)); // Sector / Head
    458 
    459          if (CHSStart<CHSEnd) {
     532         CHSStart = (*(MBRptr+3) | ((*(MBRptr+2) >> 6) << 8)) << 16;             // Cylinder
     533         CHSStart |= (*(MBRptr+2) & 0x3F) | ((*(MBRptr+1) << 8));                // Sector / Head
     534         //printf("DEBUG: Virus_CheckThisMBR - CHSStart: %d\n", CHSStart);                               // 3F MASK CHECKEN !!
     535
     536         CHSEnd = (*(MBRptr+7) | ((*(MBRptr+6) >> 6) << 8)) << 16;               // Cylinder
     537         CHSEnd |= (*(MBRptr+6) & 0x3F) | ((*(MBRptr+5) << 8));                  // Sector / Head
     538         //printf("DEBUG: Virus_CheckThisMBR - CHSEnd: %d\n", CHSEnd);
     539
     540
     541         /*
     542         // Rousseau 2011-02-03: ## Changed below from < to <= ##
     543         // When a partition is above 1024x255x63 (8GiB) the start and end of the partition
     544         // in the MBR is the same (1024/255/63) to indicate extended CHS-values.
     545         // This made the installer see this as a non-valid entry.
     546         // Fixme: This could use some further optimazation like checking if CHS is really 1024/255/63
     547         //        to exclude truly faulty partition-entries.
     548         */
     549         /*if (CHSStart<CHSEnd) {*/
     550         if (CHSStart<=CHSEnd) {
    460551            if (*(PULONG)(MBRptr+12)!=0) // Absolute length > 0?
    461552               return TRUE;
     
    466557    }
    467558   // No partitions defined/no valid partitions found
    468    return FALSE;
     559   // Rousseau: Still return TRUE (OK)
     560   //return FALSE;
     561   return TRUE;
    469562 }
    470563
     
    474567
    475568BOOL Virus_CheckForBackUpMBR (void) {
    476    return Virus_CheckThisMBR(&Track0[59*512]);
     569   return Virus_CheckThisMBR(&Track0[59 * BYTES_PER_SECTOR]);
    477570 }
    478571
     
    481574   USHORT i;
    482575
    483    for (i=0; i<511; i++) {
     576   for (i=0; i<511; i++) {                                                       // BYTES_PER_SECTOR RELATED ??
    484577      if (*(PUSHORT)CurPtr==0x13CD) return FALSE;
    485578      CurPtr++;
     
    490583
    491584// Copies backup MBR into current MBR on current memory copy of track 0
     585// Rousseau: Two sectors higher in the extended version.
    492586void Virus_CopyBackUpMBR (void) {
    493    memcpy(&Track0, &Track0[59*512], 512);
     587   switch (IMAGE_SIZE) {
     588      case IMAGE_SIZE_60SECS: {
     589         memcpy(&Track0, &Track0[59 * BYTES_PER_SECTOR], BYTES_PER_SECTOR);      // sector 60
     590         break;
     591      }
     592      case IMAGE_SIZE_62SECS: {
     593         memcpy(&Track0, &Track0[61 * BYTES_PER_SECTOR], BYTES_PER_SECTOR);      // sector 62
     594         break;
     595      }
     596   }
    494597 }
    495598
     
    497600   switch (Status) {
    498601    case STATUS_NOTINSTALLED: {
    499        printf("not installed\n");
     602       if (!Option_CID) {
     603         printf("not installed\n");
     604      }
    500605       break;
    501606     }
    502607    case STATUS_CORRUPT: {
    503        printf("not intact\n");
     608       if (!Option_CID) {
     609         printf("not intact\n");
     610      }
    504611       break;
    505612     }
    506613    case STATUS_INSTALLED:
    507614    case STATUS_INSTALLEDMGU:
    508        printf("intact (v%x.%02x)", Version>>8, Version & 0x0FF);
    509        if (Status==STATUS_INSTALLEDMGU) printf(", but may be updated");
    510        printf("\n");
     615       if (!Option_CID) {
     616         printf("intact (v%x.%02x)", Version>>8, Version & 0x0FF);
     617       }
     618       if (Status==STATUS_INSTALLEDMGU)
     619         if (!Option_CID) {
     620            printf(", but may be updated");
     621            printf("\n");
     622         }
    511623       break;
    512624    case STATUS_IMPOSSIBLE:
    513        printf(ImpossibleCause);
     625      if (!Option_CID) {
     626         printf(ImpossibleCause);
     627      }
    514628       break;
    515629    }
     
    517631
    518632void Language_PrintF(UCHAR LanguageID) {
     633   if (Option_CID)
     634      return;
    519635   switch (LanguageID) {
    520636     case 'E': printf("english"); break;
     
    537653
    538654   // Calculate checksum for code...
    539    TotalCodeSectorsUsed = Bootcode[0x10];
    540    SectorPtr = &Bootcode[1*512]; // Start at sector 2
     655   TotalCodeSectorsUsed = Bootcode[0x10];                                        // SECTORS USED CHECKEN !! (34h / 52d in v1.06)
     656   SectorPtr = &Bootcode[1 * BYTES_PER_SECTOR]; // Start at sector 2
    541657   SectorCount = TotalCodeSectorsUsed;
    542658   while (SectorCount>0) {
    543659      Checksum = GetChecksumOfSector(Checksum, SectorPtr);
    544       SectorPtr += 512;
     660      SectorPtr += BYTES_PER_SECTOR;
    545661      SectorCount--;
    546662    }
     
    551667
    552668   // Copy over code sectors...
    553    memcpy(&Track0[512], &Bootcode[512], TotalCodeSectorsUsed*512);
     669   memcpy(&Track0[BYTES_PER_SECTOR], &Bootcode[BYTES_PER_SECTOR], TotalCodeSectorsUsed * BYTES_PER_SECTOR);
    554670 }
    555671
     
    562678      if (AutoDriveLetter!=0) {
    563679         // Add DriveLetter Automatic veriables, if set
    564          Bootcode[54*512+0x1AB] = AutoDriveLetter;
    565          *(PULONG)&Bootcode[54*512+0x1AC] = AutoDriveLetterSerial;
     680         Bootcode[54 * BYTES_PER_SECTOR + 0x1AB] = AutoDriveLetter;                       // CHECKEN !
     681         *(PULONG)&Bootcode[54 * BYTES_PER_SECTOR + 0x1AC] = AutoDriveLetterSerial;
    566682       }
    567683   #endif
    568684
    569685   // Delete current checksum
    570    *(PUSHORT)&Bootcode[54*512+20] = 0;
    571 
    572    SectorPtr = &Bootcode[54*512]; // Start at sector 55
     686   *(PUSHORT)&Bootcode[54 * BYTES_PER_SECTOR + 20] = 0;
     687
     688   SectorPtr = &Bootcode[54 * BYTES_PER_SECTOR];                                // Start at sector 55
    573689   SectorCount = 5;
    574690   while (SectorCount>0) {
    575691      Checksum = GetChecksumOfSector(Checksum, SectorPtr);
    576       SectorPtr += 512;
     692      SectorPtr += BYTES_PER_SECTOR;
    577693      SectorCount--;
    578694    }
    579    *(PUSHORT)&Bootcode[54*512+20] = Checksum;
     695   *(PUSHORT)&Bootcode[54 * BYTES_PER_SECTOR + 20] = Checksum;
    580696
    581697   // Copy configuration sectors
    582    memcpy(&Track0[54*512], &Bootcode[54*512], 6*512);
     698   // Rousseau: Two more sectors for extended version.
     699   switch (IMAGE_SIZE) {
     700      case IMAGE_SIZE_60SECS: {
     701         memcpy(&Track0[54 * BYTES_PER_SECTOR], &Bootcode[54 * BYTES_PER_SECTOR], 6 * BYTES_PER_SECTOR);
     702         break;
     703      }
     704      case IMAGE_SIZE_62SECS: {
     705         memcpy(&Track0[54 * BYTES_PER_SECTOR], &Bootcode[54 * BYTES_PER_SECTOR], 8 * BYTES_PER_SECTOR);
     706         break;
     707      }
     708   }
    583709 }
    584710
     
    593719   BOOL   ExitOnly    = FALSE;
    594720
    595    printf("AiR-BOOT Installer v1.00\n");
    596    printf(" - (c) Copyright 1998-2009 by Martin Kiewitz.\n");
    597    printf("\n-> ...Please wait... <-\n");
     721//   printf("AiR-BOOT Installer v1.07\n");
     722//   printf(" - (c) Copyright 1998-2011 by Martin Kiewitz.\n");
     723//   printf("\n-> ...Please wait... <-\n");
    598724
    599725   // Check commandline parameters
     
    615741         if (strcmp(&TempSpace, "forceconfig")==0) Option_ForceConfig = TRUE;
    616742         if (strcmp(&TempSpace, "silent")==0) Option_Silent = TRUE;
     743         if (strcmp(&TempSpace, "cid")==0) Option_CID = TRUE;
    617744       }
    618745      CurArgument++;
    619746    }
     747
     748   if (Option_CID) {
     749      Option_Silent = TRUE;
     750   }
    620751
    621752   #ifdef PLATFORM_WINNT
     
    624755
    625756   if (CountHarddrives()==0) {
    626       printf(" - No physical drives found on this system. Install impossible.\n");
    627       return 1;
    628     }
    629 
    630    printf(" - Loading bootcode from file...");
     757      if (!Option_CID) {
     758         printf(" - No physical drives found on this system. Install impossible.\n");
     759      }
     760      return 3;   // Rouseau: changed from 1 to 3
     761    }
     762
     763   if (!Option_CID) {
     764      printf(" - Loading bootcode from file...");
     765   }
    631766   if (LoadBootcodeFromFile()==FALSE) return 1;
    632    printf("ok\n");
    633 
    634    printf(" - Loading MBR from harddisc...");
     767   if (!Option_CID) {
     768      printf("ok\n");
     769   }
     770
     771   if (!Option_CID) {
     772      printf(" - Loading MBR from harddisc...");
     773   }
    635774   if (HarddriveCheckGeometry()) {
    636775      // No EZ-SETUP check here, because we are under 32-bit OS and this
    637776      //  wouldn't make any sense
    638777      if (!Track0Load()) {
    639          printf("LOAD ERROR!\n");
     778         if (!Option_CID) {
     779            printf("LOAD ERROR!\n");
     780         }
    640781         return 1;
    641782       }
    642783    } else {
    643784      StatusCode = STATUS_IMPOSSIBLE;
    644       ImpossibleCause = "unable to install\n   Your harddisc does not have at least 62 sectors per track.";
    645     }
    646    printf("ok\n");
    647 
    648 
    649    printf("\n-> ...Current Status... <-\n");
     785      if (!Option_CID) {
     786         ImpossibleCause = "unable to install\n   Your harddisc does not have at least 62 sectors per track.";
     787      }
     788    }
     789   if (!Option_CID) {
     790      printf("ok\n");
     791   }
     792
     793
     794   if (!Option_CID) {
     795      printf("\n-> ...Current Status... <-\n");
     796   }
    650797   Status_CheckCode();
    651    printf(" - AiR-BOOT is ");
     798   if (!Option_CID) {
     799      printf(" - AiR-BOOT is ");
     800   }
    652801   Status_PrintF(Status_Code, Installed_CodeVersion);
    653802   if (StatusCode==STATUS_IMPOSSIBLE) return 1;
    654803   Status_CheckConfig();
    655    printf(" - Configuration is ");
     804   if (!Option_CID) {
     805      printf(" - Configuration is ");
     806   }
    656807   Status_PrintF(Status_Config, Installed_ConfigVersion);
    657808   // Display language as well, if code installed
    658809   if ((Status_Code==STATUS_INSTALLED) || (Status_Code==STATUS_INSTALLEDMGU)) {
    659       printf(" - Language is ");
     810      if (!Option_CID) {
     811         printf(" - Language is ");
     812      }
    660813      Language_PrintF(Installed_LanguageID);
    661       printf("\n");
     814      if (!Option_CID) {
     815         printf("\n");
     816      }
    662817    }
    663818
     
    682837   //  Code==not installed, config==installed -> (-> Virus?)
    683838   //  Code==installed, config==not installed -> Check MBR (-> Virus?)
     839
     840   //printf("DEBUG: Status_Code: %d, Status_Config: %d\n", Status_Code, Status_Config);  // Rousseau: DEBUG
     841
    684842   if ((Status_Code==STATUS_NOTINSTALLED) & (Status_Config==STATUS_NOTINSTALLED)) {
    685843      // Nothing installed, so check MBR, if squashed...
    686844      if (!Virus_CheckCurrentMBR()) {
    687          printf("\n\n");
    688          printf("AiR-BOOT detected that the data on your harddisc got damaged.\n");
    689          printf("If you had AiR-BOOT installed before: the corruption killed AiR-BOOT completly!\n");
    690          printf("Installation halted.\n");
    691          return 1;
    692        }
     845         if (!Option_CID) {
     846            printf("\n\n");
     847            printf("AiR-BOOT detected that the data on your harddisc got damaged.\n");
     848            printf("If you had AiR-BOOT installed before: the corruption killed AiR-BOOT completly!\n");
     849            printf("Installation halted.\n");
     850         }
     851         return 255; // Rousseau: changed from 1 to 255
     852       }
     853       //printf("DEBUG: Installing...\n");                                               // Rousseau: DEBUG
    693854    } else {
    694855      if ((Status_Code==STATUS_NOTINSTALLED) | (!Virus_CheckCurrentMBR())) {
    695856         // Code not installed, but Config or MBR squashed...
    696857         //  -> Virus proposed, check for backup (if available)
    697          printf("\n\n");
    698          printf("-> ...!ATTENTION!... <-\n");
     858         if (!Option_CID) {
     859            printf("\n\n");
     860            printf("-> ...!ATTENTION!... <-\n");
     861         }
    699862         if (Virus_CheckForStealth())
    700             printf("Your system GOT infected by a stealth-virus (or your MBR got trashed).\n");
     863            if (!Option_CID) {
     864               printf("Your system GOT infected by a stealth-virus (or your MBR got trashed).\n");
     865            }
    701866           else
    702             printf("Probably your system was infected by a virus.\n");
    703          printf("Repairing AiR-BOOT will normally squash the virus.\n");
    704          printf("But to be sure it's gone, you should check your harddisc using a virus-scanner.\n");
     867            if (!Option_CID) {
     868               printf("Probably your system was infected by a virus.\n");
     869               printf("Repairing AiR-BOOT will normally squash the virus.\n");
     870               printf("But to be sure it's gone, you should check your harddisc using a virus-scanner.\n");
     871            }
    705872         if (!Virus_CheckCurrentMBR()) {
    706873            // MBR squashed, so check backup and display message
    707             printf("\n");
    708             printf("AiR-BOOT detected that the virus has broken your partition-table.\n");
     874            if (!Option_CID) {
     875               printf("\n");
     876               printf("AiR-BOOT detected that the virus has broken your partition-table.\n");
     877            }
    709878            if (Virus_CheckForBackUpMBR()) {
    710                printf("Good news: AiR-BOOT has found a (hopefully) functional backup.\n");
    711                printf("Shall I use this backup, instead of the current active one? (Y/N)\n");
     879               if (!Option_CID) {
     880                  printf("Good news: AiR-BOOT has found a (hopefully) functional backup.\n");
     881                  printf("Shall I use this backup, instead of the current active one? (Y/N)\n");
     882               }
    712883               // User selection, Y/N, if he wants to restore MBR
    713884               //  *NOT* CID (silent) able
     
    718889                  Virus_CopyBackUpMBR();
    719890             } else {
    720                printf("Sadly the virus also broke AiR-BOOT's backup. You will have to help yourself.\n");
     891                if (!Option_CID) {
     892                  printf("Sadly the virus also broke AiR-BOOT's backup. You will have to help yourself.\n");
     893               }
    721894             }
    722895          }
     
    727900   //  MAIN-MENU
    728901   // =============================================================
    729    printf("\n-> ...Please press... <-\n");
    730 
    731    if (Install_IsCorrupt) printf(" <R> - Repair AiR-BOOT ");
    732     else if (Status_Code==STATUS_NOTINSTALLED) printf(" <A> - Add AiR-BOOT ");
    733     else printf(" <U> - Update/Change AiR-BOOT to ");
    734    printf("'v%x.%02x/", Bootcode_Version>>8, Bootcode_Version & 0x0FF);
    735    Language_PrintF(Bootcode_LanguageID);
    736    printf("' on current system\n");
    737 
    738    printf(" <D> - Delete AiR-BOOT from current system\n");
    739    printf(" <Q> - Quit without any change\n");
    740 
    741    if (Option_Silent) {
     902   if (!Option_CID) {
     903      printf("\n-> ...Please press... <-\n");
     904   }
     905
     906   if (!Option_CID) {
     907      if (Install_IsCorrupt) printf(" <R> - Repair AiR-BOOT ");
     908       else if (Status_Code==STATUS_NOTINSTALLED) printf(" <A> - Add AiR-BOOT ");
     909       else printf(" <U> - Update/Change AiR-BOOT to ");
     910      printf("'v%x.%02x/", Bootcode_Version>>8, Bootcode_Version & 0x0FF);
     911      Language_PrintF(Bootcode_LanguageID);
     912      printf("' on current system\n");
     913
     914      printf(" <D> - Delete AiR-BOOT from current system\n");
     915      printf(" <Q> - Quit without any change\n");
     916   }
     917
     918   if (Option_Silent || Option_CID) {
    742919      // Silent operation? Always add AiR-BOOT then
    743920      UserKey = 'a';
     
    748925    }
    749926
    750    printf("\n\n\n-------------------------------------------------------------------------------\n");
     927   if (!Option_CID) {
     928      printf("\n\n\n-------------------------------------------------------------------------------\n");
     929   }
    751930   switch (UserKey) {
    752931    case 'a':
     
    754933    case 'u': {
    755934      if (Install_Code || Install_Config) {
    756          printf("Add/Repair/Update AiR-BOOT in progress...\n");
     935         if (!Option_CID) {
     936            printf("Add/Repair/Update AiR-BOOT in progress...\n");
     937         }
    757938         #ifdef PLATFORM_OS2
    758939            OS2_GetBootAutoDriveLetter();
    759940         #endif
    760941         if (Install_Code) {
    761             printf(" þ Writing AiR-BOOT code...");
     942            if (!Option_CID) {
     943               printf(" þ Writing AiR-BOOT code...");
     944            }
    762945            Install_WriteCode();
    763             printf("ok\n");
     946            if (!Option_CID) {
     947               printf("ok\n");
     948            }
    764949          }
    765950         if (Install_Config) {
    766             printf(" þ Writing AiR-BOOT configuration...");
     951            if (!Option_CID) {
     952               printf(" þ Writing AiR-BOOT configuration...");
     953            }
    767954            Install_WriteConfig();
    768             printf("ok\n");
     955            if (!Option_CID) {
     956               printf("ok\n");
     957            }
    769958          }
    770959
    771960         if (!Track0Write()) {
    772             printf("SAVE ERROR!\n");
     961            if (!Option_CID) {
     962               printf("SAVE ERROR!\n");
     963            }
    773964            return 1;
    774965          }
    775          printf("\n");
    776          printf("Your copy of AiR-BOOT is now fully functional.\n");
    777          printf("Please hit ESC to exit AiR-BOOT installer or ENTER to reboot your system...\n");
    778          if (Option_Silent) {
     966         if (!Option_CID) {
     967            printf("\n");
     968            printf("Your copy of AiR-BOOT is now fully functional.\n");
     969            printf("Please hit ESC to exit AiR-BOOT installer or ENTER to reboot your system...\n");
     970         }
     971         if (Option_Silent || Option_CID) {
    779972            // Silent operation? Always reboot system (shall we do this really?)
    780973            UserKey = 0x0D;
     
    784977             } while (!((UserKey==0x0D) || (UserKey==0x1B)));
    785978          }
    786          if (UserKey==0x0D) {              // ENTER reboots system...
    787             printf("Now rebooting system...\n");
    788             RebootSystem();
     979         if (UserKey==0x0D) {              // ENTER reboots system... (if not in eCS install mode)
     980
     981            /*
     982            // Rousseau: ## Disable Reboot when installing eComStation ##
     983            // In the install-environment, the MEMDRIVE env-var is defined.
     984            // So, only reboot if this env-var is not defined.
     985            */
     986            if (!getenv("MEMDRIVE")) {
     987               if (!Option_CID) {
     988                  printf("Now rebooting system...\n");
     989               }
     990               //RebootSystem();
     991            }
     992            ExitOnly = TRUE;
    789993          }
    790994       } else {
    791          printf(" þ All components of AiR-BOOT are intact and up-to-date. Nothing to do.\n");
     995         if (!Option_CID) {
     996            printf(" þ All components of AiR-BOOT are intact and up-to-date. Nothing to do.\n");
     997         }
    792998         ExitOnly = TRUE;
    793999        }
     
    7951001     }
    7961002    case 'd': {
    797       printf(" þ Removing AiR-BOOT automatically is not possible at this time.\n");
     1003      if (!Option_CID) {
     1004         printf(" þ Removing AiR-BOOT automatically is not possible at this time.\n");
     1005      }
    7981006      #ifdef PLATFORM_OS2
    799          printf("    You may remove AiR-BOOT manually by entering \"FDISK /MBR\" or \"LVM /NEWMBR:1\"\n");
    800          printf("    in commandline.\n");
     1007         if (!Option_CID) {
     1008            printf("    You may remove AiR-BOOT manually by entering \"FDISK /MBR\" or \"LVM /NEWMBR:1\"\n");
     1009            printf("    in commandline.\n");
     1010         }
    8011011      #endif
    8021012      #ifdef PLATFORM_WINNT
    803          printf("    You may remove AiR-BOOT manually by entering \"FDISK /MBR\" in commandline.\n");
     1013         if (!Option_CID) {
     1014            printf("    You may remove AiR-BOOT manually by entering \"FDISK /MBR\" in commandline.\n");
     1015         }
    8041016      #endif
    8051017      ExitOnly = TRUE;
     
    8111023
    8121024   if (ExitOnly) {
    813       printf("\n");
    814       printf("Please hit ENTER to exit AiR-BOOT installer...\n");
    815       if (!Option_Silent) {
     1025      if (!Option_CID) {
     1026         printf("\n");
     1027         printf("Please hit ENTER to exit AiR-BOOT installer...\n");
     1028      }
     1029      if (!Option_Silent || !Option_CID) {
    8161030         while (getch()!=0x0D);
    8171031       }
  • tags/v1.07r/INSTALL/C/OS2.WPJ

    r29 r30  
    551
    66WRect
    7 0
    8 0
     7840
     8620
    997680
    10 9216
     109210
    11112
    1212MProject
     
    2121WFileName
    222212
    23 inst-os2.tgt
     23INST-OS2.TGT
    24246
    2525WVList
     
    3838WFileName
    393912
    40 inst-os2.tgt
     40INST-OS2.TGT
    41410
    42421
  • tags/v1.07r/INSTALL/C/WIN32.WPJ

    r29 r30  
    551
    66WRect
    7 0
    8 0
     7840
     8620
    997680
    10 9216
     109210
    11112
    1212MProject
     
    2121WFileName
    222212
    23 inst-win.tgt
     23INST-WIN.TGT
    24246
    2525WVList
     
    3030WRect
    3131576
    32 529
     32520
    33335632
    34 4147
     344140
    35350
    36360
     
    3838WFileName
    393912
    40 inst-win.tgt
     40INST-WIN.TGT
    41410
    42421
  • tags/v1.07r/INSTALL/DOS/AIRBOOT.ASM

    r29 r30  
    2929COM_StartUp:    jmp     COM_Init
    3030
    31 COM_Copyright   db 'AiR-BOOT Installer for DOS v1.00', 13, 10
     31COM_Copyright   db 'AiR-BOOT Installer for DOS v1.07', 13, 10
    3232                db ' - (c) Copyright 2008-2009 by M. Kiewitz.', 13, 10
    3333                db 13, 10
     
    134134
    135135                mov     ah, 3Fh
    136                 mov     cx, 30720        ; Image size
     136                mov     cx, image_size        ; Image size
    137137                mov     dx, offset BootImage
    138138                int     21h              ; DOS: READ FILE
     
    141141                call    APIShowError
    142142
    143 COM_DoneRead:   cmp     ax, 30720
     143COM_DoneRead:   cmp     ax, image_size
    144144                je      COM_DoneRead2
    145145COM_InvalidFile:mov     si, offset COM_FailedRead2
  • tags/v1.07r/INSTALL/DOS/MAKE.BAT

    r29 r30  
    1919echo Errorlevel not 0, make failed
    2020:ExitMe
    21 pause
     21rem pause
  • tags/v1.07r/INSTALL/INST_X86/INSTALL.INC

    r29 r30  
    158158                   je      VirusRestoreNo
    159159                   jmp     VirusKeyLoop
    160              
     160
    161161VirusRestoreYes:call    Init_CopyBackupMBR
    162162VirusRestoreNo: jmp     VirusSkip
     
    191191                mov     si, offset TXT_MENU_OnCurSystem
    192192                call    APIShowMessage
    193              
     193
    194194                mov     si, offset TXT_MENU_Delete
    195195                call    APIShowMessage
     
    347347   call    SaveImageSector           ; Hide-Partition Table 2
    348348   call    SaveImageSector           ; MBR BackUp (just to be sure, no valid is there)
     349
     350   ;call     SaveImageSector
     351   ;call     SaveImageSector
    349352   ret
    350353InstallConfig                  EndP
    351354
    352355
    353              
     356
    354357;       Out: Carry Flag SET if Harddisc failed 62-sectors test
    355358Init_CheckHarddisc             Proc Near  Uses
  • tags/v1.07r/TOOLS/DOS/INITHDD/INITHDD.ASM

    r29 r30  
    2020
    2121Include ..\..\..\include\asm.inc
    22 include ..\..\..\include\dos\airboot.inc
     22;include ..\..\..\include\dos\airboot.inc
    2323
    2424                .386p
     
    3636TXT_ERROR_NotNeeded     db 'INITHDD: Initialization not needed.', 13, 10, 0
    3737TXT_Done                db 'INITHDD: HDD was successfully initialized.', 13, 10, 0
     38TXT_Cleared             db 'INITHDD: Reserved Sectors successfully cleared.', 13, 10, 0      ; Rousseau: added
    3839
    3940StandardMBR:
     
    6869   dw 00000h, 00000h, 00000h, 0AA55h
    6970
    70    Include ..\..\..\include\DOS\Const.asm
     71;   Include ..\..\..\include\DOS\Const.asm
    7172
    7273INITHDD_Start:  mov     ax, cs
     
    8485                mov     ax, 0201h          ; Read 1 sector
    8586                int     13h
     87                jnc     Clear                                                    ; Rousseau: added (only clear)
    8688                jnc     LoadMBR_NoError
    8789                mov     si, offset TXT_ERROR_IO
     
    9193                ; Check Master-Boot-Record Signature
    9294                cmp     wptr ds:[CurMBR+01FEh], 0AA55h
    93                 je      AlreadyInitialized
     95                ;;je      AlreadyInitialized                                     ; Rousseau: always initialize
    9496
    9597                mov     ax, cs
     
    107109                mov     si, offset TXT_Done
    108110                call    MBR_Teletype
     111
     112                ; Rousseau: added
     113               Clear:
     114                call    MBR_ClearReservedSectors
     115                mov     si, offset TXT_Cleared
     116                call    MBR_Teletype
     117                ; Rousseau: end added
     118
    109119                jmp     GoByeBye
    110120
     
    132142MBR_Teletype                    EndP
    133143
     144
     145; Rousseau: added
     146MBR_ClearReservedSectors        Proc Near
     147   mov   ax, cs
     148   mov   es, ax                           ; Make sure that ES is right
     149   mov   cx, 2                            ; Index of first reserved sector to clear
     150  MBR_ClearReservedSectors_loop:
     151   push  cx                               ; Put on stack for later use
     152   mov   bx, offset ZeroSEC               ; Block of 0's
     153   mov   dx, 0080h                        ; First harddrive, Sector in cx
     154   ;mov   cx, 0001h
     155   mov   ax, 0301h                        ; Function 03, 1 sector to write
     156   int   13h
     157   pop   cx                               ; Pop sector-index
     158   inc   cx                               ; Next sector
     159   cmp   cx, 62                           ; If below 63 (Possible LVM) then...
     160   jbe   MBR_ClearReservedSectors_loop    ; Repeat
     161   ret
     162MBR_ClearReservedSectors        EndP
     163
     164
     165
    134166CurMBR                  db      512 dup (?)
     167ZeroSEC                 db      512 dup (0)                                      ; Rousseau: added
    135168
    136169code_seg        ends
  • tags/v1.07r/TOOLS/DOS/INITHDD/MAKE.BAT

    r29 r30  
    1919echo Errorlevel not 0, make failed
    2020:ExitMe
    21 pause
     21rem pause
  • tags/v1.07r/TOOLS/INTERNAL/FIXCODE.ASM

    r29 r30  
    9191
    9292                mov     ah, 3Fh
    93                 mov     cx, 30720        ; Image size
     93                mov     cx, image_size   ; Image size
    9494                mov     dx, offset BootCode
    9595                int     21h              ; DOS: READ FILE
     
    9898                call    ShowError
    9999
    100 DoneReadCode:   cmp     ax, 30720
     100DoneReadCode:   cmp     ax, image_size
    101101                je      DoneReadCode2
    102102InvalidCode:    mov     dx, offset COM_FailedInvalidCode
     
    232232
    233233                mov     ah, 40h
    234                 mov     cx, 30720        ; Image size
     234                mov     cx, image_size   ; Image size
    235235                mov     dx, offset BootCode
    236236                int     21h              ; DOS: WRITE FILE
     
    239239                call    ShowError
    240240
    241 DoneWriteCode:  cmp     ax, 30720
     241DoneWriteCode:  cmp     ax, image_size
    242242                jne     FailedWriteCode
    243243
     
    250250
    251251; Buffers for files
    252 BootCode        db 30720 dup (?)
     252BootCode        db  image_size dup (?)
    253253MBRProtection   db  1024 dup (?)
    254254
  • tags/v1.07r/TOOLS/INTERNAL/MAKE.BAT

    r29 r30  
    66%linker% fixcode.obj >nul
    77if errorlevel 1 goto Failed
    8 %exe2bin% fixcode.exe fixcode.com >nul
     8%exe2bin% FIXCODE.EXE FIXCODE.COM >nul
    99if errorlevel 1 goto Failed
    1010
     
    1717echo Errorlevel not 0, make failed
    1818:ExitMe
    19 pause
     19rem pause
  • tags/v1.07r/TOOLS/OS2/SETABOOT/SETABOOT.C

    r29 r30  
    1717//
    1818
     19/*
     20// Rousseau: 2011-02-05
     21// - Made volumes compare case insensitive so fs-label matches volume-name on command-line.  (around line 510)
     22//   This means bootable volumes cannot not have the same and only differ in case.
     23*/
     24
     25
    1926#define INCL_BASE
    2027#define INCL_WINSHELLDATA
     
    6269
    6370typedef struct _AiRBOOTCONFIG {
    64    CHAR   Identifier[13];
     71   CHAR   Identifier[13];                                                        // Rousseau: INVISIBLE CHAR AT END !
    6572   UCHAR  MajorVersion;
    6673   UCHAR  MinorVersion;
     
    110117   UCHAR  AutomaticPartition;
    111118   UCHAR  ForceLBAUsage;
     119   UCHAR  IgnoreLVM;
     120   UCHAR  Reserved[82];
     121   CHAR   InstallVolume[12];
    112122 } AiRBOOTCONFIG;
    113123typedef AiRBOOTCONFIG *PAiRBOOTCONFIG;
     124
     125
    114126
    115127typedef struct _AiRBOOTIPENTRY {
     
    139151
    140152
     153/* Executables to search for */
     154PCHAR   classic_setboots[] = {
     155   "SETBM.EXE",
     156   NULL
     157};
     158
     159
     160/*
     161// ProtoTypes.
     162*/
     163BOOL Track0DetectAirBoot (BOOL* ab_bad);
     164BOOL Track0WriteAiRBOOTConfig (void);
     165
     166
     167
    141168   USHORT CountHarddrives (void) {
    142169      USHORT NumDrives = 0;
     
    149176   USHORT OS2_GetIOCTLHandle () {
    150177      USHORT IOCTLHandle = 0;
    151  
     178
    152179      if (DosPhysicalDisk(INFO_GETIOCTLHANDLE, &IOCTLHandle, sizeof(IOCTLHandle),"1:" , 3) != 0)
    153180         return 0;
     
    236263    }
    237264
     265
     266APIRET QueryBootDrive(char *bootdrv)
     267{
     268        ULONG   aulSysInfo[QSV_MAX]     = {0};                                             // System Information Data Buffer
     269        APIRET  rc                              = NO_ERROR;                                                                                                    // Return code
     270
     271        if(bootdrv==0) return 1;
     272
     273        rc = DosQuerySysInfo(1L,                                                                                                                            // Request all available system
     274                                                        QSV_MAX ,                                                                                                              // information
     275                                                        (PVOID)aulSysInfo,                                                                                          // Pointer to buffer
     276                                                        sizeof(ULONG)*QSV_MAX);                                                                             // Size of the buffer
     277
     278        if (rc != NO_ERROR) {
     279                return 1;
     280        }
     281        else {
     282                //printf("Bootable drive: %c:\n",
     283                //              aulSysInfo[QSV_BOOT_DRIVE-1]+'A'-1);  /* Max length of path name */
     284                bootdrv[0]=aulSysInfo[QSV_BOOT_DRIVE-1]+'A'-1;
     285
     286                /*
     287                printf("Total physical memory is %u bytes.\n",
     288                                aulSysInfo[QSV_TOTPHYSMEM-1]);
     289                */
     290
     291                return 0;
     292        }
     293
     294
     295}
     296
    238297USHORT GetChecksumOfSector (USHORT BaseCheck, USHORT SectorNo) {
    239298   PUSHORT CurPos     = (PUSHORT)((ULONG)&Track0+(SectorNo-1)*512);
     
    246305 }
    247306
    248 BOOL Track0DetectAirBoot (void) {
    249    USHORT ResultCheck;
    250    USHORT CurSectorNo = 0;
    251 
    252    AiRBOOT_CodeSig = (PAiRBOOTCODESIG)&Track0[2];
    253    AiRBOOT_Config  = (PAiRBOOTCONFIG)&Track0[(55-1)*512];
    254    AiRBOOT_IPT     = (PAiRBOOTIPENTRY)&Track0[(56-1)*512];
    255 
    256    if (strncmp(AiRBOOT_CodeSig->Identifier, "AiRBOOT", 7)!=0) {
    257       return FALSE;
    258     }
    259 
    260    if ((AiRBOOT_CodeSig->TotalCodeSectors)>53) {
    261       puts ("SETABOOT: AiR-BOOT Code damaged!");
    262       return FALSE;
    263     }
    264 
    265    ResultCheck = 0; CurSectorNo = 0;
    266    while (CurSectorNo<AiRBOOT_CodeSig->TotalCodeSectors) {
    267       ResultCheck = GetChecksumOfSector(ResultCheck, CurSectorNo+2);
    268       CurSectorNo++;
    269     }
    270    if (ResultCheck!=AiRBOOT_CodeSig->CheckSumOfCode) {
    271       puts ("SETABOOT: AiR-BOOT Code damaged!");
    272       return FALSE;
    273     }
    274 
    275    if (strncmp(AiRBOOT_Config->Identifier, "AiRCFG-TABLE­", 13)!=0) {
    276       puts ("SETABOOT: AiR-BOOT Config damaged!");
    277       return FALSE;
    278     }
    279 
    280    // Set Config-CheckSum to 0
    281    AiRBOOT_ConfigCheckSum = AiRBOOT_Config->CheckSumOfConfig;
    282    AiRBOOT_Config->CheckSumOfConfig = 0;
    283 
    284    // Calculate CheckSum...
    285    ResultCheck = 0; CurSectorNo = 55;
    286    while (CurSectorNo<60) {
    287       ResultCheck = GetChecksumOfSector(ResultCheck, CurSectorNo);
    288       CurSectorNo++;
    289     }
    290    if (ResultCheck!=AiRBOOT_ConfigCheckSum) {
    291       puts ("SETABOOT: AiR-BOOT Config damaged!");
    292       return FALSE;
    293     }
    294    return TRUE;
    295  }
    296 
    297 BOOL Track0WriteAiRBOOTConfig (void) {
    298    USHORT ResultCheck;
    299    USHORT CurSectorNo = 0;
    300 
    301    // Update Edit-Counter...
    302    AiRBOOT_Config->EditCounter++;
    303    AiRBOOT_Config->CheckSumOfConfig = 0;
    304 
    305    // Calculate CheckSum...
    306    ResultCheck = 0; CurSectorNo = 55;
    307    while (CurSectorNo<60) {
    308       ResultCheck = GetChecksumOfSector(ResultCheck, CurSectorNo);
    309       CurSectorNo++;
    310     }
    311    AiRBOOT_Config->CheckSumOfConfig = ResultCheck;
    312 
    313    if (!Track0Write())
    314       return FALSE;
    315    return TRUE;
    316  }
    317 
    318 int main (int argc, char **argv) {
     307
     308
     309
     310/*
     311// If AiR-BOOT is not installed, the user probably meant to control OS/2 BM with this utility.
     312// Since the functionality of this utility is for AiR-BOOT only, we will pass the request to
     313// the OS/2 BM SETBOOT utility which is called SETBM.EXE as of eCS 2.01.
     314// Since the objective here is to supply OS/2 BM SETBOOT compatibility, if SETBM.EXE is not found,
     315// some other system locations are searched for the OS/2 version of SETBOOT.EXE.
     316// Any SETBOOT.EXE that is found and that does not have a module-name of "setaboot" is invoked,
     317// and passed along the command-line the user issued.
     318// In this case also the return-value of the OS/2 version of SETBOOT.EXE is returned.
     319*/
     320int   DoClassicActions(int argc, char **argv) {
     321   APIRET      rc             = -1;
     322   RESULTCODES  crc                        = {-1,-1};
     323   PTIB        ptib           = NULL;
     324   PPIB        ppib           = NULL;
     325   char        buffer[256]    = "\0";
     326   char        cmdline[256]   = "\0";
     327   PSZ         path           = NULL;
     328   char        sresult[256]   = "\0";
     329   char        bootdrive      = '?';
     330   char*       p              = NULL;
     331   int         i              = 0;
     332
     333   //printf("\nCLASSIC ACTIONS !! (%d)\n", argc);
     334
     335   rc = QueryBootDrive(&bootdrive);
     336
     337   rc = DosScanEnv("PATH", &path);
     338   rc = DosSearchPath(SEARCH_CUR_DIRECTORY | SEARCH_IGNORENETERRS,
     339                        path,
     340                        classic_setboots[0],
     341                        sresult,
     342                        sizeof(sresult));
     343
     344   //printf("SRESULT: rc=%d, %s\n", rc, sresult);
     345
     346   if (rc) {
     347      printf("\n");
     348      printf("ERROR: SETBOOT (AiR-BOOT version)\n");
     349      printf("Since the AiR-BOOT Boot Manager is not installed, this program (SETBOOT.EXE), funcions as a wrapper\n");
     350      printf("to %s that should be used to control IBM Boot Manager.\n", classic_setboots[0]);
     351      printf("However, %s could not be found in the PATH, the error-code is: %d\n", classic_setboots[0], rc);
     352      printf("You can resolve this situation by renaming a valid SETBOOT.EXE to %s\n", classic_setboots[0]);
     353      printf("and put it in your %c:\\OS2 directory.", bootdrive);
     354      printf("\n");
     355      exit(rc);
     356   }
     357
     358
     359
     360
     361   memset(cmdline, 0, sizeof(cmdline));                                          // Clear the command-line buffer.
     362   p = cmdline;                                                                  // Temporary pointer to insert arguments.
     363   strcpy(p, sresult);                                                           // Copy the program-name.
     364   p += strlen(sresult)+1;                                                       // Advance to point for space separated parameters.
     365
     366   /*
     367   // Process all the arguments,
     368   // inserting the separated by a space.
     369   */
     370   for (i=1; i<argc; i++) {
     371      strcpy(p, argv[i]);                                                        // Copy the argument.
     372      p += strlen(argv[i]);                                                      // Advance pointer past argument.
     373      *p++ = ' ';                                                                // Space separation.
     374   }
     375
     376   /*
     377   for (i=0; i<100; i++) {
     378      printf("%c", cmdline[i] ? cmdline[i] : '#');
     379   }
     380   printf("\n");
     381   */
     382
     383   //printf("CMDLINE: %s\n", cmdline);
     384   //printf("CMDLINE+: %s\n", cmdline+strlen(sresult)+1);
     385
     386   rc = DosExecPgm(buffer,
     387            sizeof(buffer),
     388            EXEC_SYNC,
     389            cmdline,
     390            NULL,
     391            &crc,
     392            sresult);
     393
     394   //rc = 3;
     395   if (rc) {
     396      printf("\n");
     397      printf("ERROR: SETBOOT (AiR-BOOT version)\n");
     398      printf("Since the AiR-BOOT Boot Manager is not installed, this program (SETBOOT.EXE), funcions as a wrapper\n");
     399      printf("to %s that should be used to control IBM Boot Manager.\n", classic_setboots[0]);
     400      printf("However, something went wrong when executing %s.\n", classic_setboots[0]);
     401      printf("The error-code is: %d and the termination-code is: %d\n", rc, crc.codeTerminate);
     402      printf("\n");
     403      exit(rc);
     404   }
     405
     406
     407   //printf("DosExecPgm: rc=%08X, codeterminate=%08X, coderesult=%08X\n", rc, crc.codeTerminate, crc.codeResult);
     408
     409   /*
     410   rc = DosGetInfoBlocks(&ptib, &ppib);
     411
     412   rc = DosQueryModuleName(ppib->pib_hmte, sizeof(buffer), buffer);
     413   printf("MODULE: %s\n", buffer);
     414   printf("CMDLINE: %s\n", ppib->pib_pchcmd);
     415   */
     416
     417   return crc.codeResult;
     418}
     419
     420
     421int   DoAirBootActions(int argc, char **argv, BOOL ab_detected, BOOL ab_bad) {
    319422   ULONG           CurArgument      = 0;
    320423   ULONG           ArgumentLen      = 0;
     
    347450   ULONG           XWPBootCount     = 0;
    348451   CHAR            XWPBootName[30][12];
    349    CHAR            XWPBootCommand[30][28]; // 'setaboot /IBA:""' (16 chars)
     452   CHAR            XWPBootCommand[30][28];                                       // 'setaboot /IBA:""' (16 chars)
    350453   BOOL            XWPEntryFound    = FALSE;
     454   BOOL            CDBoot           = FALSE;                                     // TRUE if booted from CD; New System will be added when using /4:"LABEL"
     455   BOOL            Track0Loaded     = FALSE;                                     // Assume track0 did not load correctly.
     456   BOOL            AiRBOOTBad       = FALSE;
     457
     458   //printf("\nAiR-BOOT ACTIONS !!\n");
     459
     460   AiRBOOTDetected = ab_detected;
     461   AiRBOOTBad = ab_bad;
     462
     463   if (AiRBOOTBad)
     464      return 1;
    351465
    352466   // Use OSO001.MSG, so we safe us the trouble of translating :)
     
    354468      return 1;
    355469
    356    puts ("SETABOOT - AiR-BOOT Configuration Utility (OS/2) - (c) 2004-2009 by M. Kiewitz");
     470   /*
     471   // Rousseau: changed version to be the same as the AiR-BOOT is accompanies.
     472   */
     473   //puts ("SETABOOT - AiR-BOOT Configuration Utility (OS/2) - (c) 2004-2009 by M. Kiewitz");
     474   puts ("SETABOOT v1.07 - AiR-BOOT Configuration Utility - (c) 2004-2011 by M. Kiewitz");
     475
     476
     477   //return 0;
     478
     479   /*
     480   // Rousseau:
     481   // Log some debug stuff to (virtual) flop.
     482   */
     483   /*
     484   {
     485      char        buf[512]="\0";
     486      FILE*       fp = NULL;
     487      int         i = 0;
     488
     489      fp = fopen("A:\\SETBOOT.TXT", "a");
     490      sprintf(buf, "Bliep");
     491      fprintf(fp,"Program: %s\n", argv[0]);
     492      fprintf(fp,"Arguments: %d\n", argc);
     493      for (i=0; i<argc-1; i++) {
     494         fprintf(fp, "Arg %d: %s\n", i+1, argv[i+1]);
     495      }
     496      fprintf(fp, "\n");
     497      fclose(fp);
     498   }
     499   */
     500
     501
     502
     503   /*
     504   // Rousseau: ## Enable boot-through when installing new system ##
     505   // In the install-environment, the MEMDRIVE env-var is defined.
     506   // This modifies the behavior after phase 1.
     507   */
     508   if (getenv("MEMDRIVE")) {
     509      printf("CDBoot Environment.\n");
     510      CDBoot = TRUE;
     511   }
     512
    357513
    358514   if (argc==1) {
     
    361517    }
    362518
     519
     520
     521
    363522   // Now we check for AiR-BOOT existance...
     523   /*
    364524   if (CountHarddrives()>0) {
    365525      if (Track0Load()) {
    366          if (Track0DetectAirBoot()) AiRBOOTDetected = TRUE;
    367        } else {
     526         // Rousseau: Track0DetectAirBoot() will init globals.
     527         if (Track0DetectAirBoot()) // REPLACE WITH BOOL
     528            AiRBOOTDetected = TRUE;
     529       }
     530       else {
    368531         MSG_Print (TXT_ERROR_DuringAccessHDD);
    369532       }
    370     } else {
     533    }
     534    else {
    371535      MSG_Print (TXT_ERROR_DuringAccessHDD);
    372     }
     536   }
     537   */
    373538
    374539   CurArgument = 1;
     
    460625
    461626            *StartPos = 0; StartPos++;
     627
    462628            // Search that partition in IPT of AiR-BOOT...
    463629            if ((CurChar=='4') && (ArgumentLen==0)) {
     
    475641             }
    476642
     643
     644            /*
     645            // Rousseau:
     646            // Insert label of newly installed system in AiR-BOOT configuration.
     647            // Note that it is changed to uppercase because AiR-BOOT uses the FS-label when
     648            // scanning partitions and LVM-info is not found. (Otherwise PART-label)
     649            // The auto-boot flag is not set in this case as this is handled by the AiR-BOOT loader.
     650            */
     651            if (CDBoot) {
     652               strncpy(AiRBOOT_Config->InstallVolume, _strupr(StartPos), ArgumentLen);
     653               AiRBOOT_Config->InstallVolume[ArgumentLen] = '\0';
     654               printf("Writing Install Volume: %s to AiR-BOOT configuration.\n", AiRBOOT_Config->InstallVolume);
     655               Track0WriteAiRBOOTConfig();
     656               return 0;
     657            }
     658
     659
     660
     661
    477662            BadValue = TRUE;
    478663            CurPartitionNo = 0; CurIPTEntry = AiRBOOT_IPT;
    479664            while (CurPartitionNo<AiRBOOT_Config->Partitions) {
    480                if (strncmp(CurIPTEntry->PartitionName, StartPos, ArgumentLen)==0) {
     665               /*
     666               // Rousseau: Changed below to case-insensitive compare.
     667               // This solves the part/vol-label (mixed-case) v.s. fs-label (upper-case) issue.
     668               */
     669               /*if (strncmp(CurIPTEntry->PartitionName, StartPos, ArgumentLen)==0) {*/
     670               if (strnicmp(CurIPTEntry->PartitionName, StartPos, ArgumentLen)==0) {
    481671                  if (ArgumentLen==11) {
    482672                     BadValue = FALSE;
     
    495685               CurPartitionNo++; CurIPTEntry++;
    496686             }
     687
    497688
    498689            if (BadValue) {
     
    602793      PrfWriteProfileData (HINI_USERPROFILE, "XWorkplace", "RebootTo", XWPOrgStringPtr, XWPStringSize);
    603794      free(XWPOrgStringPtr);
    604        
     795
    605796      puts ("SETABOOT: XWorkPlace updated.");
    606797      return 0;
     
    611802         return 1;
    612803       }
    613       printf ("SETABOOT: AiR-BOOT %X.%02X detected.\n\n", AiRBOOT_CodeSig->MajorVersion, AiRBOOT_CodeSig->MinorVersion);
     804      printf("SETABOOT: AiR-BOOT %X.%02X detected.\n\n", AiRBOOT_CodeSig->MajorVersion, AiRBOOT_CodeSig->MinorVersion);
     805      //printf("DEBUG: InstallVolume: %s\n", AiRBOOT_Config->InstallVolume);
    614806      if (AiRBOOT_Config->BootMenuActive) {
    615807         if (AiRBOOT_Config->TimedBoot) {
     
    697889    }
    698890   return 0;
     891
     892
     893
     894}
     895
     896
     897/*
     898// Rousseau:
     899// Global pointers will be initialized here !
     900*/
     901BOOL Track0DetectAirBoot (BOOL* ab_bad) {
     902   USHORT ResultCheck;
     903   USHORT CurSectorNo = 0;
     904
     905   /* Globals that get initialized */
     906   AiRBOOT_CodeSig = (PAiRBOOTCODESIG)&Track0[2];
     907   AiRBOOT_Config  = (PAiRBOOTCONFIG)&Track0[(55-1)*512];
     908   AiRBOOT_IPT     = (PAiRBOOTIPENTRY)&Track0[(56-1)*512];
     909
     910   if (strncmp(AiRBOOT_CodeSig->Identifier, "AiRBOOT", 7)!=0) {
     911      *ab_bad = FALSE;
     912      return FALSE;
     913    }
     914
     915   if ((AiRBOOT_CodeSig->TotalCodeSectors)>53) {
     916      puts ("SETABOOT: AiR-BOOT Code damaged!");
     917      *ab_bad = TRUE;
     918      return TRUE;
     919    }
     920
     921   ResultCheck = 0; CurSectorNo = 0;
     922   while (CurSectorNo<AiRBOOT_CodeSig->TotalCodeSectors) {
     923      ResultCheck = GetChecksumOfSector(ResultCheck, CurSectorNo+2);
     924      CurSectorNo++;
     925    }
     926   if (ResultCheck!=AiRBOOT_CodeSig->CheckSumOfCode) {
     927      puts ("SETABOOT: AiR-BOOT Code damaged!");
     928      *ab_bad = TRUE;
     929      return TRUE;
     930    }
     931
     932   if (strncmp(AiRBOOT_Config->Identifier, "AiRCFG-TABLE­", 13)!=0) {            // Rousseau: INVISIBLE CHAR HERE !
     933      puts ("SETABOOT: AiR-BOOT Config damaged!");
     934      *ab_bad = TRUE;
     935      return TRUE;
     936    }
     937
     938   // Set Config-CheckSum to 0
     939   AiRBOOT_ConfigCheckSum = AiRBOOT_Config->CheckSumOfConfig;
     940   AiRBOOT_Config->CheckSumOfConfig = 0;
     941
     942   // Calculate CheckSum...
     943   ResultCheck = 0; CurSectorNo = 55;
     944   while (CurSectorNo<60) {
     945      ResultCheck = GetChecksumOfSector(ResultCheck, CurSectorNo);
     946      CurSectorNo++;
     947    }
     948   if (ResultCheck!=AiRBOOT_ConfigCheckSum) {
     949      puts ("SETABOOT: AiR-BOOT Config damaged!");
     950      *ab_bad = TRUE;
     951      return TRUE;
     952    }
     953   *ab_bad = FALSE;
     954   return TRUE;
    699955 }
     956
     957BOOL Track0WriteAiRBOOTConfig (void) {
     958   USHORT ResultCheck;
     959   USHORT CurSectorNo = 0;
     960
     961   // Update Edit-Counter...
     962   AiRBOOT_Config->EditCounter++;
     963   AiRBOOT_Config->CheckSumOfConfig = 0;
     964
     965   // Calculate CheckSum...
     966   ResultCheck = 0; CurSectorNo = 55;
     967   while (CurSectorNo<60) {
     968      ResultCheck = GetChecksumOfSector(ResultCheck, CurSectorNo);
     969      CurSectorNo++;
     970    }
     971   AiRBOOT_Config->CheckSumOfConfig = ResultCheck;
     972
     973   if (!Track0Write())
     974      return FALSE;
     975   return TRUE;
     976 }
     977
     978
     979/*
     980// Rousseau: # This is the main entry-point #
     981// Special behavior if eCS is booted from CDROM and phase 1 called this program.
     982// In that case, the name of the newly installed system is put in the AiR-BOOT configuration.
     983// This will cause AiR-BOOT to boot through after phase 1.
     984*/
     985int main (int argc, char **argv) {
     986   BOOL  AiRBOOTDetected   = FALSE;
     987   BOOL  Track0Loaded      = FALSE;                                              // Assume track0 did not load correctly.
     988   BOOL  AiRBOOTBad        = FALSE;
     989   int   rc                = -1;
     990
     991
     992   /*
     993   // Rousseau: ## Changed order to first check for AiR-BOOT existance ##
     994   // If AiR-BOOT is not installed, all action is passed-thru to IBM SETBOOT (SETBM.EXE).
     995   */
     996
     997
     998   /*
     999   // Try to load track zero.
     1000   // We don't care if no harddisk is present, since we first want to know if AiR-BOOT is
     1001   // installed to adjust our behaviour.
     1002   // If it's not installed, or a loading error occurs, all actions will be deferred to
     1003   // IBM SETBOOT (SETBM.EXE).
     1004   // This means we also let IBM SETBOOT handle the situation in which no HD's are present.
     1005   */
     1006   Track0Loaded = Track0Load();
     1007
     1008   /*
     1009   // Now see if AiR-BOOT is present.
     1010   // If there was a loading error, no AiR-BOOT signature will be present, so
     1011   // we pass-thru to IBM SETBOOT.
     1012   */
     1013   AiRBOOTDetected = Track0DetectAirBoot(&AiRBOOTBad);
     1014
     1015   if (AiRBOOTDetected) {
     1016      rc = DoAirBootActions(argc, argv, AiRBOOTDetected, AiRBOOTBad);
     1017   }
     1018   else {
     1019      rc = DoClassicActions(argc, argv);
     1020   }
     1021
     1022
     1023   return rc;
     1024 }
  • tags/v1.07r/TOOLS/OS2/SETABOOT/SETABOOT.TGT

    r29 r30  
    22225
    2323MCommand
    24 0
     24117
     25@ren SETABOOT.EXE SETABOOT.XEX
     26@ren SETABOOT.XEX SETABOOT.EXE
     27copy SETABOOT.EXE ..\..\..\RELEASE\OS2\SETABOOT.EXE
     28
    25296
    2630MItem
    273112
    28 setaboot.exe
     32SETABOOT.EXE
    29337
    3034WString
     
    33378
    3438WVList
    35 2
     394
    36409
    37 MCState
     41MVState
    384210
    3943WString
     
    424611
    4347WString
     4822
     49?????Other options(,):
     501
     5112
     52WString
     5319
     54op map=SETABOOT.MAP
     550
     5613
     57MCState
     5814
     59WString
     607
     61OS2LINK
     6215
     63WString
    446413
    4565?????Map file
    46661
    47670
    48 12
     6816
    4969MCState
    50 13
     7017
    5171WString
    52727
    5373OS2LINK
    54 14
     7418
    5575WString
    567624
     
    58781
    59790
    60 15
     8019
     81MVState
     8220
     83WString
     847
     85OS2LINK
     8621
     87WString
     8822
     89?????Other options(,):
     900
     9122
     92WString
     9319
     94op map=SETABOOT.MAP
     950
     9623
     97WVList
     981
     9924
     100ActionStates
     10125
     102WString
     1035
     104&Make
     10526
    61106WVList
    621070
     
    651101
    661110
    67 16
     11227
    68113WPickList
    691142
    70 17
     11528
    71116MItem
    721173
    73118*.C
    74 18
     11929
    75120WString
    761214
    77122COBJ
    78 19
     12330
    79124WVList
    801250
    81 20
     12631
    82127WVList
    831280
     
    861311
    871320
    88 21
     13332
    89134MItem
    9013510
    91136SETABOOT.C
    92 22
     13733
    93138WString
    941394
    95140COBJ
    96 23
     14134
    97142WVList
    981430
    99 24
     14435
    100145WVList
    1011460
    102 17
     14728
    1031481
    1041491
  • tags/v1.07r/TOOLS/OS2/SETABOOT/SETABOOT.WPJ

    r29 r30  
    551
    66WRect
    7 0
    8 0
     7840
     8620
    997680
    10 9216
     109210
    11112
    1212MProject
     
    2121WFileName
    222212
    23 setaboot.tgt
     23SETABOOT.TGT
    24246
    2525WVList
     
    31310
    32320
    33 5670
    34 4215
     335664
     344210
    35350
    36360
     
    3838WFileName
    393912
    40 setaboot.tgt
     40SETABOOT.TGT
    41410
    42420
  • trunk/BOOTCODE/AIR-BOOT.ASM

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

    r29 r30  
    33if "%1"=="EN"  goto Valid
    44if "%1"=="DE"  goto Valid
    5 if "%1"=="DT"  goto Valid
     5if "%1"=="NL"  goto Valid
    66if "%1"=="FR"  goto Valid
    77if "%1"=="IT"  goto Valid
     
    1313
    1414:BuildAll
    15 call make.bat EN
    1615call make.bat DE
    17 call make.bat DT
     16call make.bat NL
    1817call make.bat FR
    1918call make.bat IT
    2019call make.bat RU
    2120call make.bat SW
     21call make.bat EN
    2222goto ExitMe
    2323
    2424:Valid
     25echo.
     26echo.
    2527echo Making %1 language version of AiR-BOOT bootcode...
    2628echo Include TEXT\%1\MBR.asm >TEXT\TXTMBR.asm
     
    3739if errorlevel 1 goto Failed
    3840..\tools\internal\fixcode.com
    39 copy AIR-BOOT.com ..\RELEASE\BOOTCODE\%1.bin
     41copy AIR-BOOT.com ..\RELEASE\BOOTCODE\AIRBT-%1.bin
     42
     43copy AIR-BOOT.COM AIRBOOT.BIN
    4044
    4145rem Cleanup
    42 rem del AiR-BOOT.com
     46del AiR-BOOT.com
    4347del AiR-BOOT.exe
    4448del AiR-BOOT.obj
     
    4852echo Errorlevel not 0, make failed
    4953:ExitMe
     54rem @pause
  • trunk/BOOTCODE/MBR-PROT/MAKE.BAT

    r29 r30  
    66%linker% mbr_prot.obj >nul
    77if errorlevel 1 goto Failed
    8 %exe2bin% mbr_prot.exe fixcode.com >nul
     8%exe2bin% mbr_prot.exe mbr_prot.com
     9if errorlevel 1 goto Failed
     10copy mbr_prot.com fixcode.com
    911if errorlevel 1 goto Failed
    1012
    1113rem Cleanup
    12 del mbr_prot.exe
    13 del mbr_prot.obj
     14::del mbr_prot.exe
     15::del mbr_prot.obj
    1416goto ExitMe
    1517
     
    1719echo Errorlevel not 0, make failed
    1820:ExitMe
    19 pause
     21rem pause
  • trunk/BOOTCODE/MBR-PROT/MBR_PROT.ASM

    r29 r30  
    2727                org 0000h
    2828
    29 OldInterrupt10  dd      'kcuf'              ; we are nice aren't we ;-)
    30 OldInterrupt13  dd      'kcuf'
     29; Yes you are :-)
     30;OldInterrupt10  dd      'kcuf'              ; we are nice aren't we ;-)
     31;OldInterrupt13  dd      'kcuf'
     32
     33OldInterrupt10  dd      0
     34OldInterrupt13  dd      0
     35
    3136MBR_IgnoreWrite db      0
    3237
     
    143148MBRProt_WriteBorderLine        EndP
    144149
    145 MBRP_Line1:     db      'ÕÍÍŽ!ATTENTION! -> A VIRUS WAS FOUND <- !ATTENTION!ÃÍÍž'
     150MBRP_Line1:     db      'ÕÍÍŽ!ATTENTION! -> A V1RU5 WAS FOUND <- !ATTENTION!ÃÍÍž'
    146151MBRP_EmptyLine: db      '³                                                     ³'
    147152                db      '³ A program tried to write to your Master Boot Record ³'
     
    151156                db      '³  you have to deactivate MBR PROTECTION in AiR-BOOT  ³'
    152157                db      '³             or contact your supervisor.             ³'
    153 MBRP_Line3:     db      'ÔÍÍÍŽAiR-BOOT (c) Copyright by M. Kiewitz 1999-2009ÃÍÍŸ'
     158;MBRP_Line3:     db      'ÔÍÍÍŽAiR-BOOT (c) Copyright by M. Kiewitz 1999-2009ÃÍÍŸ'
     159MBRP_Line3:     db      'ÔÍÍÍŽAiR-BOOT (c) Copyright by M. Kiewitz 1999-2011ÃÍÍŸ'
    154160
    155161org             1023
  • trunk/BOOTCODE/REGULAR/BOOTMENU.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'BOOTMENU',0
     24ENDIF
     25
    2226BOOTMENU_BuildBackground        Proc Near   Uses es di
    2327   call    VideoIO_CursorOff
     
    3236BOOTMENU_BuildBackground        EndP
    3337
     38CLR_COPYRIGHT_CLASSIC   = 0f00h
     39CLR_COPYRIGHT_BM  = 0700h
     40
    3441BOOTMENU_BuildMain              Proc Near   Uses es di
    3542   ; 1st line with Copyright information...
    3643   mov     cx, 0101h
    3744   call    VideoIO_Locate
    38    mov     cx, 0F00h
     45   mov     cx, CLR_COPYRIGHT_BM
    3946   call    VideoIO_Color
    4047   mov     si, offset Copyright
     
    4249
    4350   ; Boot-Window...
    44    mov     cx, 0901h
     51CLR_BOOT_WINDOW_CLASSIC    = 0901h
     52CLR_BOOT_WINDOW_BM         = 0701h
     53
     54   mov     cx, CLR_BOOT_WINDOW_BM
    4555   call    VideoIO_Color
    4656   mov     bx, 0201h
     
    5363   mov     al, TextChar_WinLineRight
    5464   mov     cl, 78
    55    call    VideoIO_Internal_MakeWinRight 
     65   call    VideoIO_Internal_MakeWinRight
    5666
    5767   mov     dl, 18h
     
    6373
    6474   ; Display Top-Infos in Boot-Window
    65    mov     cx, 0B01h
     75
     76CLR_TOP_INFOS_CLASSIC    = 0b01h
     77CLR_TOP_INFOS_BM  = 0301h
     78
     79   mov     cx, CLR_TOP_INFOS_BM
    6680   call    VideoIO_Color
    6781   mov     ch, 03h
     
    91105
    92106   ; Now make the separating vertical lines...
    93    mov     cx, 0901h
     107CLR_SEP_VERT_LINES_CLASSIC    = 0901h
     108CLR_SEP_VERT_LINES_BM   = 0701h
     109
     110   mov     cx, CLR_SEP_VERT_LINES_BM
    94111   call    VideoIO_Color
    95112   mov     ch, 03h
     
    157174   ; Boot-Window is DONE
    158175
    159    mov     cx, 0C04h
    160    call    VideoIO_Color
     176; Rousseau: = Colors =
     177; FG
     178; BG
     179; 7 = grey
     180; 6 = brown
     181; 5 = magenta
     182; 4 = red
     183; 3 = cyan
     184; 2 = green
     185; 1 = blue
     186
     187CLR_INFO_WINDOW_CLASSIC    = 0c04h
     188CLR_INFO_WINDOW_BM   = 0701h
     189
     190   mov     cx, CLR_INFO_WINDOW_BM
     191   ;mov     cx, 0C06h ; brown, main background
     192   call    VideoIO_Color                                                         ; Rousseau: color info window
     193
    161194   mov     bx, 1401h
    162195   mov     dx, 1950h
     
    173206   mov     cx, 1703h
    174207   call    VideoIO_Locate
    175    mov     cx, 0F04h
    176    call    VideoIO_Color
     208
     209CLR_INFO_TEXT_CLASSIC   = 0f04h
     210CLR_INFO_TEXT_BM   = 0701h
     211
     212   mov     cx, CLR_INFO_TEXT_BM                   ; Info text
     213   call    VideoIO_Color                                                         ; Rousseau: color info text
     214
    177215   mov     si, offset TXT_BootMenuHelpText1
    178216   call    VideoIO_Print
     
    182220   call    VideoIO_Print
    183221
    184    mov     cx, 0C04h
     222
     223CLR_F10_SETUP_CLASSIC   = 0c04h
     224CLR_F10_SETUP_BM        = 0901h
     225
     226   mov     cx, CLR_F10_SETUP_BM                            ; background F10 enter Setup
    185227   call    VideoIO_Color
    186228
     
    198240   call    VideoIO_PrintSingleChar
    199241   ; HelpWindow done...
     242
     243
     244   ; Rousseau: Debug Stuff, put here after building Main Menu
     245   ;call    VideoIO_DBG_WriteString
     246   ;call    VideoIO_DBG_WriteString2
     247
    200248   ret
    201249BOOTMENU_BuildMain              EndP
     250
     251
    202252
    203253BOOTMENU_BuildGoodBye           Proc Near   Uses es di
     
    209259   rep     stosw
    210260   ; -------------------------------------------
    211    mov     cx, 0D05h
     261
     262CLR_GOODBYE_WINDOW_CLASSIC = 0d05h
     263CLR_GOODBYE_WINDOW_BM   = 0f01h
     264
     265   mov     cx, CLR_GOODBYE_WINDOW_BM
    212266   call    VideoIO_Color
    213267   mov     bx, 0101h
     
    221275   mov     cx, 9
    222276   mov     al, WinCharRight
    223    mov     ah, 05Dh
     277
     278   ; Little part before version in goodbye-window
     279   ; Does not use color-function
     280   ;mov     ah, 05Dh
     281   mov     ah, 01fh
    224282   rep     stosw
     283
    225284   mov     cx, 010Bh
    226285   call    VideoIO_Locate
     
    240299   mov     al, TextChar_WinRep4
    241300   call    VideoIO_PrintSingleChar
    242    mov     cx, 0E01h
     301
     302CLR_GOODBYE_AB_VERSION_CLASSIC   = 0e01h
     303CLR_GOODBYE_AB_VERSION_BM  = 0e03h
     304
     305   mov     cx, CLR_GOODBYE_AB_VERSION_BM
    243306   call    VideoIO_Color
    244307   mov     si, offset Copyright
    245308   mov     cl, 11+CopyrightVersionLen
    246309   call    VideoIO_FixedPrint
    247    mov     cx, 0D05h
     310
     311   mov     cx, CLR_GOODBYE_WINDOW_BM
     312
    248313   call    VideoIO_Color
    249314   mov     al, TextChar_WinRep5
     
    251316   mov     cx, 020Dh
    252317   call    VideoIO_Locate
    253    mov     cx, 0F05h
     318
     319   CLR_GOODBYE_WINDOW_CLASSIC_2    = 0f05h
     320   CLR_GOODBYE_WINDOW_BM_2   = 0701h
     321
     322   mov     cx,  CLR_GOODBYE_WINDOW_BM_2
    254323   call    VideoIO_Color
    255324   inc     si
     
    272341BOOTMENU_BuildGoodBye           EndP
    273342
     343
     344
    274345; Must preserve AX!
    275346BOOTMENU_BuildTimedBootText     Proc Near   Uses ax cx si es di
    276    mov     cx, 1503h
    277    call    VideoIO_Locate
    278    mov     cx, 0E04h
     347   mov     cx, 1503h ;
     348   call    VideoIO_Locate
     349
     350CLR_NON_TIMED_BAR_CLASSIC  = 0e04h
     351CLR_NON_TIMED_BAR_BM = 0701h
     352
     353   mov     cx, CLR_NON_TIMED_BAR_BM                      ; non-timed time bar
    279354   call    VideoIO_Color
    280355   call    VideoIO_Internal_SetRegs
     
    294369   mov     cx, 1503h
    295370   call    VideoIO_Locate
    296    mov     cx, 0E04h
     371
     372CLR_TIMED_BAR_CLASSIC   = 0e04h
     373CLR_TIMED_BAR_BM  = 0e04h
     374
     375   mov     cx, CLR_TIMED_BAR_BM ; timed time bar, yellow on red
    297376   call    VideoIO_Color
    298377   mov     si, offset TXT_TimedBootLine  ; will print TimedBootEntryName too
     
    325404BOOTMENU_RefreshPartitionText   EndP
    326405
     406
     407CLR_VOLUME_INDEX_CLASSIC   = 0f01h
     408CLR_VOLUME_INDEX_BM  = 0f01h
     409
    327410; Writes Partition-Information to Screen (Boot-Menu)
    328411;        In: CH - Line to print info
     
    339422   mov     dh, cl
    340423   call    VideoIO_Locate
    341    mov     cx, 0F01h                     ; Bwhite, blue
     424   mov     cx, CLR_VOLUME_INDEX_BM                     ; Bwhite, blue
    342425   call    VideoIO_Color
    343426   mov     al, dl
     
    347430   ; === Display Drive-Number and Size (Size only in detailed view) ===
    348431   add     dh, 5
    349    movzx   cx, dh
    350    call    VideoIO_Locate
    351    mov     cx, 0D01h
     432   ;movzx   cx, dh
     433   mov   cl,dh
     434   mov   ch,0
     435
     436   call    VideoIO_Locate
     437
     438CLR_HD_INDEX_CLASSIC    = 0d01h
     439CLR_HD_INDEX_BM   = 0701h
     440
     441   mov     cx, CLR_HD_INDEX_BM
    352442   call    VideoIO_Color                 ; Violet, blue
    353443   mov     si, PartPointer
     
    367457     BMBPT_IsHarddrive:
    368458      ; Now display Size-Element...
    369       mov     cx, 0501h
     459
     460CLR_HD_SIZE_CLASSIC  = 0501h
     461CLR_HD_SIZE_BM = 0701h
     462
     463      mov     cx, CLR_HD_SIZE_BM
    370464      call    VideoIO_Color              ; Dark-Violet, Blue
    371465      mov     al, '/'
    372466      call    VideoIO_PrintSingleChar
    373       mov     cx, 0D01h
     467      mov     cx, CLR_HD_SIZE_BM
    374468      call    VideoIO_Color              ; Violet, Blue
    375469      mov     ax, PartPointer            ; Get Size-Element from PartPtr (AX)
     
    383477
    384478   ; === Display Label ===
    385    movzx   cx, dh
    386    call    VideoIO_Locate
    387    mov     cx, 0E01h
     479   ;movzx   cx, dh
     480   mov   cl,dh
     481   mov   ch,0
     482
     483   call    VideoIO_Locate
     484
     485CLR_LABEL_CLASSIC    = 0e01h
     486CLR_LABEL_BM   = 0f01h
     487
     488   mov     cx, CLR_LABEL_BM
    388489   call    VideoIO_Color                 ; Yellow, blue
    389490   mov     si, PartPointer
     
    394495   ; === Display Type ===
    395496   add     dh, 14
    396    movzx   cx, dh
     497   ;movzx   cx, dh
     498   mov   cl,dh
     499   mov   ch,0
     500
    397501   call    VideoIO_Locate
    398502   mov     si, PartPointer
    399503   mov     al, [si+LocIPT_SystemID]
    400504   call    PART_SearchFileSysName
    401    mov     cx, 0C01h
     505
     506CLR_FS_NAME_CLASSIC  =  0c01h
     507CLR_FS_NAME_BM =  0701h
     508
     509   mov     cx, CLR_FS_NAME_BM
    402510   call    VideoIO_Color                 ; Hrot, Blau
    403511   mov     cl, 8
     
    410518;       Out: DX - will get returned (fixed, if needed)
    411519BOOTMENU_BuildChoiceBar         Proc near   Uses ax es di
     520
     521   ;call  SOUND_Beep
     522
    412523   call    VideoIO_WaitRetrace
     524
     525
     526   ;call  SOUND_Beep
     527
    413528   mov     cl, 10h    ; Color BLUE, Partition DL
    414529   call    BOOTMENU_ReColorPart
     530
     531   ;call  SOUND_Beep
    415532
    416533   ; Check, if clipping needed...
     
    448565   call    BOOTMENU_RefreshPartitionText
    449566
     567
     568; Keuze bar
     569; 00h black
     570; 10h blue
     571; 20h green (also nice)
     572; 30h cyan (also nice)
     573; 40h red
     574; 50h magenta
     575; 60h brown (nice)
     576; 70h white
     577; 80h grey
     578; 90h light blue (nice)
     579; 0a0h bright green
     580; 0b0h bright cyan
     581; 0c0h bright red
     582; 0d0h bright magenta
     583; 0e0h bright yellow
     584; 0f0h bright white
     585
     586
     587CLR_SELECTION_BAR_CLASSIC  = 50h
     588CLR_SELECTION_BAR_BM = 090h
     589
     590
     591
    450592  BMBCB_AfterScrolling:
    451    mov     cl, 50h    ; Color PINK, Partition DL
     593   mov     cl, CLR_SELECTION_BAR_BM    ; Color PINK, Partition DL
    452594   call    BOOTMENU_ReColorPart
    453595   ret
     
    457599; Destroyed: None, but Locate-Pointer gets set
    458600BOOTMENU_ReColorPart            Proc Near   Uses bx cx es di
     601
     602  ; call  SOUND_Beep
     603
    459604   mov     bh, cl     ; Color to BH
    460605   ; First calculate location of bar
     
    475620      and     al, 0Fh
    476621      or      al, bh                     ; Adds background color (from BH)
     622
     623      ;mov      al,97h
     624
    477625      mov     es:[di], al
    478626      add     di, 2
     
    615763   ; Got it, so display bar...
    616764   mov     dh, dl
     765
     766   ;call  SOUND_Beep
     767
    617768   call    BOOTMENU_BuildChoiceBar       ; DH - Active, DL - Last Active
     769
     770   ;call  SOUND_Beep
     771
    618772   call    SOUND_PreBootMenu
    619773
     774
    620775  BME_MainLoop:
     776
     777     ;call    VideoIO_DBG_WriteString2    ; Rousseau
     778
    621779   test    TimedBootEnable, 1
    622780   jz      BME_NoTimedBoot
  • trunk/BOOTCODE/REGULAR/DRIVEIO.ASM

    r29 r30  
    1919;                                                      AiR-BOOT / DRIVE I/O
    2020;---------------------------------------------------------------------------
     21
     22
     23
     24IFDEF ModuleNames
     25DB 'DRIVEIO',0
     26ENDIF
    2127
    2228; Note: Some routines set DS/ES to CS or even address via CS, even if its not
     
    141147;  This is calculated by Sector*Heads. Comparing will get done with Bit 25-10
    142148;  on LBA sectors, so we actually divide sector number by 1024.
    143 DriveIO_InitLBASwitchTable      Proc Near   Uses es di
     149DriveIO_InitLBASwitchTable      Proc Near   Uses es di                           ; Rousseau: LBA !
    144150   mov     di, offset LBASwitchTable
    145151   mov     dh, TotalHarddiscs
     
    152158         jc      DIOILUT_Error
    153159         and     cl, 111111b    ; Isolate lower 6 bits of CL -> sector count
    154          movzx   ax, cl
    155          mov     bl, dh         ; DH -> head count
     160
     161         ; huge disk 127 sec/track on <1TB using DANI
     162;         mov     cl, 07Fh
     163
     164         ;movzx   ax, cl
     165         mov   al,cl
     166         mov   ah,0
     167
     168         mov     bl, dh         ; DH -> head count                               ; Rousseau: nope, it's max head number !
    156169         mul     bl             ; AX = Sectors*Heads
    157170         shl     ah, 1
     
    168181DriveIO_InitLBASwitchTable      EndP
    169182
     183
     184
     185
    170186; Adjusts BX:AX / CX:DX to meet LVM sector location
    171187;  Destroys SI
    172 DriveIO_LVMAdjustToInfoSector   Proc Near   Uses
    173    push    cx
    174       xor     ch, ch
    175       and     cl, 63                     ; Isolate lower bits, because upper
    176       mov     si, 63                     ;  ones may be used for cylinder
    177       sub     si, cx
    178    pop     cx
    179    add     ax, si
    180    adc     bx, 0                         ; Adjust LBA Sector (BX:AX)
    181    or      cl, 63                        ; Set Sector to 63
    182    ret
     188; Rousseau: Enhanced to handle sector-numbers 127 and 255 besides 63 for LVM-info sectors.
     189;           Ugly, need to cleanup.
     190DriveIO_LVMAdjustToInfoSector   Proc Near   Uses                                 ; Rousseau: LVM stuff !
     191
     192
     193
     194;      pusha
     195;      call     AuxIO_TeletypeNL
     196
     197      ; LBA
     198;      xchg     dx,bx
     199;      call     AuxIO_TeletypeHexDWord
     200;      call     AuxIO_TeletypeNL
     201;      xchg     bx,dx
     202
     203      ; CYL
     204;      mov      al,ch
     205;      call     AuxIO_TeletypeHexByte
     206;      call     AuxIO_TeletypeNL
     207
     208      ; HEAD
     209;      mov      al,dh
     210;      call     AuxIO_TeletypeHexByte
     211;      call     AuxIO_TeletypeNL
     212
     213      ; SEC
     214;      mov      al,cl
     215;      call     AuxIO_TeletypeHexByte
     216;      call     AuxIO_TeletypeNL
     217
     218      ; DRIVE
     219;      mov      al,dl
     220;      call     AuxIO_TeletypeHexByte
     221;      call     AuxIO_TeletypeNL
     222
     223;      popa
     224
     225
     226      ;local ts:word
     227      ;local ts2:word
     228
     229      pusha
     230
     231         ; Dump drive
     232         mov      si,offset drive
     233         call     AuxIO_Print
     234         xchg     al,dl
     235         call     AuxIO_TeletypeHexByte
     236         call     AuxIO_TeletypeNL
     237         xchg     dl,al
     238
     239         ; Dump SPT
     240         mov      si,offset spt_used
     241         call     AuxIO_Print
     242         push     dx
     243         push     bx
     244            xor      dh,dh
     245            and      dl,01111111b
     246            shl      dx,1
     247            shl      dx,1
     248            mov      bx, offset TrueSecs
     249            add      bx,dx
     250            mov      ax,word ptr [bx]
     251
     252            ;mov      [ts],ax
     253
     254            call     AuxIO_TeletypeHexWord
     255            call     AuxIO_TeletypeNL
     256         pop      bx
     257         pop      dx
     258
     259         pusha
     260            push     dx
     261               ; Location of extended position
     262               mov      dx,word ptr [ExtendedAbsPos+02]
     263               mov      ax,word ptr [ExtendedAbsPos+00]
     264               call     AuxIO_TeletypeHexDWord
     265               call     AuxIO_TeletypeNL
     266            pop      dx
     267
     268            xor      dh,dh
     269            and      dl,01111111b
     270            shl      dx,1
     271            shl      dx,1
     272            mov      bx, offset TrueSecs
     273            add      bx,dx
     274
     275            mov      ax, word ptr[bx]
     276            call     AuxIO_TeletypeHexWord
     277            call     AuxIO_TeletypeNL
     278            mov      al,[ExtendedAbsPosSet]           ; if true -> 1st sector of extpart (EBR), not logpart(BPB)
     279            call     AuxIO_TeletypeHexByte
     280            call     AuxIO_TeletypeNL
     281      ;      mov      si,offset PartitionSector
     282      ;      call     AuxIO_DumpSector
     283         popa
     284
     285         ; LBA
     286         mov      si,offset before_lvm_adjust
     287         call     AuxIO_Print
     288
     289         xchg     dx,bx
     290         call     AuxIO_TeletypeHexDWord
     291         call     AuxIO_TeletypeNL
     292         xchg     bx,dx
     293      popa
     294
     295
     296      ;or       bx,ax
     297      test     [ExtendedAbsPosSet],1
     298      jz       pri
     299
     300
     301
     302
     303      pusha
     304         mov      si,offset before_lvm_adjust_log
     305         call     AuxIO_Print
     306         ; LBA
     307         xchg     dx,bx
     308         call     AuxIO_TeletypeHexDWord
     309         call     AuxIO_TeletypeNL
     310         xchg     bx,dx
     311      popa
     312
     313
     314      push     dx
     315      push     bx
     316         xor      dh,dh
     317         and      dl,01111111b
     318         shl      dx,1
     319         shl      dx,1
     320         mov      bx,offset TrueSecs
     321         add      bx,dx
     322         mov      dx,[bx]
     323         dec      dx
     324         add      ax,dx
     325      pop      bx
     326      pop      dx
     327      adc      bx,0
     328
     329
     330      pusha
     331         mov      si,offset after_lvm_adjust_log
     332         call     AuxIO_Print
     333         ; LBA
     334         xchg     dx,bx
     335         call     AuxIO_TeletypeHexDWord
     336         call     AuxIO_TeletypeNL
     337         xchg     bx,dx
     338      popa
     339
     340      jmp      done
     341
     342
     343
     344
     345pri:
     346
     347
     348      push     ax
     349      push     cx
     350         xor      ch, ch                           ; Zero out upper-byte
     351
     352         push     dx
     353            xor      dh,dh
     354            and      dl,01111111b
     355            shl      dx,1
     356            shl      dx,1
     357            push     bx
     358               mov      bx,offset TrueSecs
     359               add      bx,dx
     360               mov      ax,[bx]
     361               ;mov      [ts2],ax
     362            pop      bx
     363         pop      dx
     364
     365
     366
     367         ;mov      al, 63
     368         ;call VideoIO_PrintByteDynamicNumber
     369         ;self: jmp self
     370
     371
     372
     373         ; DEZE WERKT SOMS NIET GOED
     374         ; ROMMELT MET CYLINDERS
     375         ; ALLEEN TOEPASSEN ALS INT13X NIET ACTIEF !
     376
     377         and      cl, al                           ; Isolate lower bits, because upper
     378         mov      ah, 0
     379         mov      si, ax                           ;  ones may be used for cylinder
     380         sub      si, cx
     381
     382      pop      cx
     383      pop      ax
     384
     385      or       cl, al                           ; Set sector to last sector
     386
     387      add      ax, si                           ; Adjust lower LBA
     388      adc      bx, 0                            ; Adjust LBA Sector (BX:AX)
     389
     390
     391
     392      ;push     ax
     393      ;call     AuxIO_TeletypeHexWord
     394      ;call     AuxIO_TeletypeNL
     395      ;mov      ax,[ts]
     396      ;call     AuxIO_TeletypeHexWord
     397      ;call     AuxIO_TeletypeNL
     398      ;mov      ax,[ts2]
     399      ;call     AuxIO_TeletypeHexWord
     400      ;call     AuxIO_TeletypeNL
     401      ;pop      ax
     402
     403      ;and      ax,[ts]
     404
     405      jmp done
     406
     407
     408
     409done:
     410
     411
     412
     413      pusha
     414         mov      si,offset after_lvm_adjust
     415         call     AuxIO_Print
     416         ; LBA
     417         xchg     dx,bx
     418         call     AuxIO_TeletypeHexDWord
     419         call     AuxIO_TeletypeNL
     420         xchg     bx,dx
     421      popa
     422
     423
     424
     425;      pusha
     426;      call     AuxIO_TeletypeNL
     427
     428      ; CYL
     429;      mov      al,ch
     430;      call     AuxIO_TeletypeHexByte
     431;      call     AuxIO_TeletypeNL
     432
     433      ; HEAD
     434;      mov      al,dh
     435;      call     AuxIO_TeletypeHexByte
     436;      call     AuxIO_TeletypeNL
     437
     438      ; SEC
     439;      mov      al,cl
     440;      call     AuxIO_TeletypeHexByte
     441;      call     AuxIO_TeletypeNL
     442
     443      ; DRIVE
     444;      mov      al,dl
     445;      call     AuxIO_TeletypeHexByte
     446;      call     AuxIO_TeletypeNL
     447
     448;      popa
     449
     450
     451
     452      ret
    183453DriveIO_LVMAdjustToInfoSector   EndP
    184454
    185 Comment *ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    186  Routine: Loads partition to ExecBase and checks for validity
    187  ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
    188  Calling : bx:ax - Absolute sector
    189            cx:dx - Cylinder/Sector, Side/Drive (hi/lo-byte)
    190  Returns : Carry Set if invalid partition encountered
    191  Preserve: all registers
    192  ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
     455drive:                  db 'drive                    : ',0
     456before_lvm_adjust:      db 'before lvm adjust        : ',0
     457after_lvm_adjust:       db 'after lvm adjust         : ',0
     458before_lvm_adjust_log:  db 'before lvm logical adjust: ',0
     459after_lvm_adjust_log:   db 'after lvm logical adjust : ',0
     460spt_used:               db 'spt used                 : ',0
     461
     462
     463
     464; #########################################################################
     465; Routine: Loads partition to ExecBase and checks for validity
     466; #########################################################################
     467; Calling : bx:ax - Absolute sector
     468;           cx:dx - Cylinder/Sector, Side/Drive (hi/lo-byte)
     469; Returns : Carry Set if invalid partition encountered
     470; Preserve: all registers
     471; #########################################################################
    193472DriveIO_LoadPartition           Proc Near  Uses si
    194473   mov     wptr cs:[CurPartition_Location+0], ax
     
    209488   stc                                   ; Set carry, so no partition table
    210489  DIOLP_Success:
     490
     491IFDEF AuxDebug
     492   ; show current partition location
     493   pushf
     494   pusha
     495      call     AuxIO_TeletypeNL
     496      mov      si,offset db_curpartloc
     497      call     AuxIO_Print
     498      mov      dx,word ptr [CurPartition_Location+02]
     499      mov      ax,word ptr [CurPartition_Location+00]
     500      call     AuxIO_TeletypeHexDWord
     501      call     AuxIO_TeletypeNL
     502      mov      si,offset PartitionSector
     503      call     AuxIO_DumpSector
     504      call     AuxIO_TeletypeNL
     505   popa
     506   popf
     507ENDIF
     508
    211509   ret
    212510  DIOLP_Failed:
     
    214512DriveIO_LoadPartition           EndP
    215513
    216 Comment *ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    217  Routine: Writes a partition from ExecBase to its original sector
    218  ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
    219  Calling : none
    220  Returns : none
    221  Preserve: all registers
    222  ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
     514; #########################################################################
     515; Routine: Writes a partition from ExecBase to its original sector
     516; #########################################################################
     517; Calling : none
     518; Returns : none
     519; Preserve: all registers
     520; #########################################################################
    223521DriveIO_SavePartition           Proc Near  Uses ax bx cx dx si
    224522   mov     ax, wptr cs:[CurPartition_Location+0]
     
    237535DriveIO_LoadTmpSector           Proc Near  Uses
    238536   mov     si, offset TmpSector
    239    call    DriveIO_LoadSector
     537   call    DriveIO_LoadSector                                                    ; Uses INT13X if needed
    240538   ret
    241539DriveIO_LoadTmpSector           EndP
     
    256554   mov     dx, wptr cs:[CurPartition_Location+4]
    257555   mov     cx, wptr cs:[CurPartition_Location+6] ; Gets cur. partition location
    258    call    DriveIO_LVMAdjustToInfoSector
     556
     557   call    DriveIO_LVMAdjustToInfoSector                                         ; Rousseau: LVM stuff !
     558
    259559   mov     si, offset LVMSector
    260560   call    DriveIO_LoadSector
    261    call    LVM_CheckSectorSignature
     561
     562IFDEF AuxDebug
     563   ; show current partition location
     564   pushf
     565   pusha
     566      call     AuxIO_TeletypeNL
     567      mov      si,offset db_curlvmsec
     568      call     AuxIO_Print
     569      mov      dx,bx
     570      call     AuxIO_TeletypeHexDWord
     571      call     AuxIO_TeletypeNL
     572      mov      si,offset LVMSector
     573      call     AuxIO_DumpSector
     574      call     AuxIO_TeletypeNL
     575   popa
     576   popf
     577ENDIF
     578
     579   ; Rousseau
     580   ;pushf
     581   ;pusha
     582   ;mov   si, offset MyText4
     583   ;call  VideoIO_Print
     584   ;mov   si, offset LVMSector
     585   ;mov   al, [si+LocLVM_VolumeLetter2]
     586   ;call  VideoIO_PrintByteDynamicNumber
     587   ;mov   al, [si+LocLVM_Startable]
     588   ;call  VideoIO_PrintByteDynamicNumber
     589   ;mov   al, [si+LocLVM_OnBootMenu]
     590   ;call  VideoIO_PrintByteDynamicNumber
     591   ;;self: jmp self
     592   ;popa
     593   ;popf
     594
     595   call    LVM_CheckSectorSignature                                              ; Rousseau: LVM stuff !
    262596   jnc     DIOLLVMS_NoLVMSector
    263    call    LVM_CheckSectorCRC
     597   call    LVM_CheckSectorCRC                                                    ; Rousseau: LVM stuff !
    264598   jnc     DIOLLVMS_NoLVMSector
    265599   ret
     
    303637   jnz     InScanMode
    304638   jmp     MBR_LoadError
    305   InScanMode:   
     639  InScanMode:
    306640   mov     si, offset TXT_BrokenPartitionTable
    307641   push    cs
     
    319653DriveIO_GotLoadError            EndP
    320654
    321 Comment *ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    322  Routine: Loads a specified sector to DS:DI
    323  ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
    324  Calling : bx:ax - Absolute sector
    325            cx:dx - Cylinder/Sector, Side/Drive (hi/lo-byte)
    326            ds:si - Destination-Adress
    327  Returns : none
    328  Preserve: all registers
    329  ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
    330 DriveIO_LoadSector              Proc Near  Uses ax bx ds si es di
     655; #########################################################################
     656; Routine: Loads a specified sector to DS:DI
     657; #########################################################################
     658; Calling : bx:ax - Absolute sector
     659;           cx:dx - Cylinder/Sector, Side/Drive (hi/lo-byte)
     660;           ds:si - Destination-Adress
     661; Returns : none
     662; Preserve: all registers
     663; #########################################################################
     664DriveIO_LoadSector              Proc Near  Uses ax bx ds si es di                ; Rousseau: Disk IO
    331665   test     cs:[CurIO_UseExtension], 1
    332666   jz       DIOLS_UseNormal
    333667   ; Are we forced do use LBA via Setting?
    334    test     cs:[CFG_ForceLBAUsage], 1
     668   test     cs:[CFG_ForceLBAUsage], 1                                            ; Rousseau: LBA
    335669   jnz      DIOLS_UseExtension
    336670   ; Is the drive not a harddrive?
     
    351685         pop      es
    352686         mov      bx, si                     ; ES:BX - Destination
    353          mov      ax, 0201h                  ; Function 2 - Load Sector
     687         mov      ax, 0201h                  ; Function 2 - Load Sector          ; Rousseau: Disk IO -- legacy BIOS call
    354688         int      13h
    355689         jnc      DIOLS_Success
     
    370704      pop     ds
    371705      mov     si, offset DriveIO_DAP
    372       mov     ah, 42h                        ; Extended Read
     706      mov     ah, 42h                        ; Extended Read                     ; Rousseau: Disk IO -- extended BIOS call
    373707      int     13h
    374708   pop     cx
     
    381715DriveIO_LoadSector              EndP
    382716
    383 Comment *ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    384  Routine: Writes DS:SI to a specified sector
    385  ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
    386  Calling : bx:ax - Absolute sector
    387            cx:dx - Cylinder/Sector, Side/Drive (hi/lo-byte)
    388            ds:si - Source-Adress
    389  Returns : none
    390  Preserve: all registers
    391  ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
     717; #########################################################################
     718; Routine: Writes DS:SI to a specified sector
     719; #########################################################################
     720; Calling : bx:ax - Absolute sector
     721;           cx:dx - Cylinder/Sector, Side/Drive (hi/lo-byte)
     722;           ds:si - Source-Adress
     723; Returns : none
     724; Preserve: all registers
     725; #########################################################################
    392726DriveIO_SaveSector              Proc Near  Uses ax bx cx ds si es di
    393727   test     cs:[CurIO_UseExtension], 1
    394728   jz       DIOSS_UseNormal
    395729   ; Are we forced do use LBA via Setting?
    396    test     cs:[CFG_ForceLBAUsage], 1
     730   test     cs:[CFG_ForceLBAUsage], 1                                            ; Rousseau: LBA
    397731   jnz      DIOSS_UseExtension
    398732   ; Is the drive not a harddrive?
     
    440774   ret
    441775DriveIO_SaveSector              EndP
     776
     777
     778; See if a LVM-sector is valid.
     779; In  : si, pointer to sector
     780; Out : ZF=true, not valid; ZF=false, valid
     781DriveIO_LVMSectorValid           Proc  Near
     782      pusha
     783
     784      call     LVM_CheckSectorSignature
     785      mov      al,0
     786      rcl      al,1                          ; Move CY to AL.0
     787      call     AuxIO_TeletypeHexByte
     788      call     AuxIO_TeletypeNL
     789      or       al,al                         ; Zero if not a valid sector
     790      jz       DriveIO_LVMSectorValid_End    ; Not a valid sector
     791
     792      call     LVM_CheckSectorCRC
     793      stc
     794      mov      al,0
     795      rcl      al,1                          ; Move CY to AL.0
     796      call     AuxIO_TeletypeHexByte
     797      call     AuxIO_TeletypeNL
     798      or       al,al                         ; Zero if not a valid sector
     799
     800   DriveIO_LVMSectorValid_End:
     801
     802      popa
     803      ret
     804DriveIO_LVMSectorValid           EndP
     805
     806; ------------------------------------------------------
     807; Rousseau: # Load the master LVM-sector is one exists #
     808; ------------------------------------------------------
     809; Load the master LVM-sector to get the number of sectors per track as eCS views the drive.
     810; If no master LVM-sector is found it is assumed eCS is not installed.
     811; The master LVM-sector can be located at three different places according to drive size
     812; and partitioning scheme and driver used.
     813; When DANIS506.ADD is used, the eCS extended geometry will be 255/127 for drives >502GiB but <1TiB.
     814; Then the location will be sector 127 which is LBA 126 (7Eh).
     815; IBM1S506.ADD will always use 255/255 for the extended eCS geometry.
     816; DANIS506.ADD will use 255/255 for drives >1TiB.
     817; Then the location of the master LVM-sector will be 255 which is LBA 254 (FEh).
     818; When eCS is installed on a huge drive that alread had a system on it, eCS will be confined to the
     819; lower 502GiB of the drive. In this case the normal geometry from Int13X will be used.
     820; This is also the case when no valid master LVM-sector can be found.
     821;
     822; Return ZF=true if not found, ZF=false when valid master LVM-sector found.
     823DriveIO_LoadMasterLVMSector      Proc  Near
     824      pusha
     825
     826      mov      si,offset db_lmlvm
     827      ;call     AuxIO_Print
     828
     829      mov      al,dl
     830      ;call     AuxIO_TeletypeHexByte
     831      ;call     AuxIO_TeletypeNL
     832
     833
     834      ; Loop over the sector-translation table,
     835      ; process the first three values from high (255) to low (bios spt, most likely 63)
     836      mov      cx,3
     837DriveIO_LoadMasterLVMSector_NextTry:
     838      mov      bx,offset secs_per_track_table         ; sector translation table that corresponds with IsHugeDrive
     839      mov      si, offset LVMSector                   ; space to load the master LVM-sector
     840      mov      [DriveIO_DAP_NumBlocks],1              ; number of sectors to read
     841      mov      wptr [DriveIO_DAP_Transfer+0],si       ; low part of transfer address
     842      mov      ax, ds
     843      mov      wptr [DriveIO_DAP_Transfer+2],ax       ; high part of transfer address
     844      mov      ax,cx                                  ; use the counter...
     845      dec      ax                                     ; as an index into the table
     846      xlatb                                           ; translate to number of sectors
     847      dec      al                                     ; LBA is zero-based, so adjust
     848
     849IFDEF AuxDebug
     850      ; Dump the value
     851      ;call     AuxIO_TeletypeHexByte
     852      ;call     AuxIO_TeletypeNL
     853ENDIF
     854
     855      mov      wptr [DriveIO_DAP_Absolute+0],ax       ; LBA low      ;
     856      mov      wptr [DriveIO_DAP_Absolute+2],00h      ; LBA high
     857      mov      si, offset DriveIO_DAP                 ; address request packet
     858      mov      ah, 42h
     859      int      13h                                    ; do the i/o
     860      jc       DriveIO_LoadMasterLVMSector_NotFound   ; oops, there was an error
     861
     862IFDEF AuxDebug
     863      ; Dump title
     864      mov      si,offset db_masterlvm
     865      ;call     AuxIO_Print
     866
     867      ; Dum sector
     868      mov      si, offset LVMSector
     869      ;call     AuxIO_DumpSector
     870      ;call     AuxIO_TeletypeNL
     871ENDIF
     872      ; See is this is a valid LVM-sector
     873      call     DriveIO_LVMSectorValid
     874
     875IFDEF AuxDebug
     876      pushf
     877      ;call     AuxIO_TeletypeNL
     878      popf
     879ENDIF
     880      ; Yep, we found the master LVM-sector
     881      jnz      DriveIO_LoadMasterLVMSector_Found
     882      ; Try next location
     883      loop     DriveIO_LoadMasterLVMSector_NextTry
     884
     885   ; No master LVM-sector found, set ZF=true
     886   DriveIO_LoadMasterLVMSector_NotFound:
     887      xor      ax,ax
     888
     889   ; Jump here with ZF=false if found
     890   DriveIO_LoadMasterLVMSector_Found:
     891
     892      popa
     893      ret
     894DriveIO_LoadMasterLVMSector     Endp
     895
     896
     897
     898
     899; ---------------------------------------------------
     900; Rousseau ## Large drives, (eCS) geometry and LBA ##
     901; ---------------------------------------------------
     902; A sector size of 512 bytes is assumed in the below calculations.
     903; Note that this scheme changes when the sector size will be 4096 or larger,
     904; like with modern drives that do not translate to 512 bytes per sector anymore.
     905; These drives will have a capacity above the 2TiB LBA32 boundary.
     906; For now, we assume drives <=2TiB with a sector size of 512 bytes.
     907
     908; There are a few boundaries that are of importance.
     909; Note that these are disk-boundaries and not partition boundaries.
     910; Even with a small partition, like <502GiB, OS/2 will use extended geometry on an
     911; empty huge disk.
     912; These boundaries are (from high to low):
     913
     914; (code 5)
     915; 2^32 = 4294967296 = 100000000 sectors = 2048 GiB
     916;   This is the LBA32 2TiB boundary.
     917;   Everything above it must be addressed using LBA48.
     918;   OS/2 can currently not address this space above.
     919
     920; (code4)
     921; 65536*255*255 = 4261478400 = FE010000 sectors ~ 2032 GiB
     922;   This is the max OS/2 boundary using 255/255 extended geometry.
     923;   OS/2 can currently not address this space above.
     924
     925; (code 3)
     926; 2^31 = 2147483648 = 80000000 sectors = 1024 GiB
     927;   This is the LBA32 1TiB boundary.
     928;   OS/2 can address this space and will use 255/255 extended geometry.
     929
     930; (code 2)
     931; 65536*255*127 = 2122383360 = 7E810000 sectors ~ 1012 GiB
     932;   This is the DANI 1TiB boundary.
     933;   OS/2 can address this space and will use 255/255 extended geometry.
     934;   Below this DANI will use 255/127 extended geometry.
     935;   This matters on where the LVM-sectors are located !
     936
     937; (code 1)
     938; 65536*255*63  = 1052835840 = 3EC10000 sectors ~ 502 GiB
     939;   This is the current OS/2 limit using this geometry because OS/2 can currently
     940;   not address more than 65536 cylinders.
     941;   DANI will address space above with 255/127 extended geometry up until the DANI 1TiB boundary (code 2)
     942
     943; (code 0)
     944; Everything below 65536*255*63 will be addressed using standard geometry.
     945
     946
     947;
     948; This function will return the following values:
     949;
     950
     951; 5 = This drive is above the 2^32 LBA32 (2TB) boundary and has more than 4294967296 sectors.
     952;     LBA48 addressing is needed to access the complete capacity of the drive.
     953;     OS/2 is currently unable to do so.
     954
     955; 4 = This drive is above the 65536*255*255 (4261478400) boundary but below 2^32.
     956;     This is an OS/2 boundary and OS/2 is not able to access the drive above this boundary.
     957
     958; 3 = This drive is above the 2^31 (1TB) boundary and has more than 2147483648 sectors.
     959;     OS/2 is able to access the drive using it's extended geometry.
     960;     Both DANIS506 and IBM1S506 will use the 255/255 scheme.
     961
     962; 2 = This drive is above the 65536*255*127 (2122383360) boundary but below 2^31.
     963;     OS/2 is able to access the drive using it's extended geometry.
     964;     Both DANIS506 and IBM1S506 will use the 255/255 scheme.
     965
     966; 1 = This drive is above the 65536*255*63 (1052835840) boundary but below 65536*255*127.
     967;     OS/2 is able to access the drive using it's extended geometry.
     968;     Note that DANIS506 will use 255/127 and IBM1S506 will use 255/255 geometry !
     969;     Using DANI or IBM influences the location of the LVM info-sectors !
     970
     971; 0 = This drive is below the 65536*255*63 (1052835840) boundary.
     972;     OS/2 is able to access this drive using the standard 255/63 geometry.
     973
     974; So, any return value >0 means OS/2 extended geometry will be used.
     975; Value 1 will use 255/127 with DANIS506 but 255/255 with IBM1S506.
     976; Values 2 and 3 will use 255/255 on both drivers.
     977; You can or with 0x01 and check for 3 in this case.
     978; Any value above 3 will be a drive who's capacity cannot be fully used by OS/2
     979; The upper limit of 65536*255*255 will be in effect here.
     980
     981; Note this function currently handles the boot-drive only !
     982; It should be extended and use dl for the drive-number as a parameter.
     983; Because we use this function to get this info in a number of places,
     984; all regs and flags except AX are saved and restored.
     985
     986; DL contains BIOS disk-number; 80h for first, 81h for second, etc.
     987DriveIO_GatherDiskInfo  Proc Near
     988      pushf
     989      push    bx
     990      push    cx
     991      push    dx
     992      push    si
     993      push    di
     994      push    es
     995
     996      ; Set ES to CS for buffer clearing
     997      push    cs
     998      pop     es
     999
     1000      ; Clear the buffer
     1001      ; Don't overwrite the word of the buffersize at index 0 !
     1002      ; Old Phoenix BIOSses require word (flags) at 02 to be zero,
     1003      ; so we clear the whole buffer to be sure.
     1004      mov     cx, i13xbuf_size
     1005      mov     di, offset i13xbuf
     1006      mov     [di],cx
     1007      inc     di
     1008      inc     di
     1009      xor     ah,ah
     1010      cld
     1011      rep stosb
     1012
     1013      ; Get the drive parameters
     1014      mov     ah, 48h                                 ; Get Drive Parameters (extended version)
     1015      ;mov     dl, 80h                                ; Drive number
     1016      mov     si, offset i13xbuf                      ; Buffer for result-info
     1017      push    dx
     1018      int     13h                                     ; Call the BIOS-function
     1019      pop     dx
     1020
     1021      ; Do some error-checking
     1022      or      ah,ah                                   ; AH is zero if no error (ZF=1 if no error)
     1023      mov     ax,0                                    ; Setup code for non-huge drive (does not influence ZF)
     1024      jz      DriveIO_GatherDiskInfo_ok               ; Return if error (AL<>0 thus ZF=0) but CY not set, assuming non-huge drive
     1025      jnc     DriveIO_GatherDiskInfo_ok               ; Return if error (CY=1), assuming non-huge drive
     1026      jmp     DriveIO_GatherDiskInfo_ret
     1027
     1028
     1029   DriveIO_GatherDiskInfo_ok:
     1030
     1031      ;
     1032      ; Store the drive geometry
     1033      ;
     1034
     1035      mov      si, offset i13xbuf
     1036
     1037      xor      dh,dh
     1038      and      dl,01111111b
     1039      shl      dx,1
     1040      shl      dx,1
     1041
     1042      ; Store number of cylinders on disk
     1043      mov      bx, offset BIOS_Cyls
     1044      add      bx,dx
     1045      mov      ax,[si+04h]
     1046
     1047      mov      word ptr [bx+00],ax
     1048      mov      ax,[si+06]
     1049      mov      word ptr [bx+02],ax
     1050
     1051      ; Store number of heads per cylinder
     1052      mov      bx, offset BIOS_Heads
     1053      add      bx,dx
     1054      mov      ax,[si+08h]
     1055      mov      word ptr [bx+00],ax
     1056      mov      ax,[si+0ah]
     1057      mov      word ptr [bx+02],ax
     1058
     1059      ; Store number of sectors per track
     1060      mov      bx, offset BIOS_Secs
     1061      add      bx,dx
     1062      mov      ax,[si+0ch]
     1063      mov      word ptr [bx+00],ax
     1064
     1065      ; Update first byte of translation-table to conform to BIOS SPT
     1066      mov      byte ptr [secs_per_track_table], al
     1067
     1068      mov      ax,[si+0eh]
     1069      mov      word ptr [bx+02],ax
     1070
     1071      ; Store total secs
     1072      mov      bx, offset BIOS_TotalSecs
     1073      add      bx,dx
     1074      add      bx,dx
     1075      mov      ax,[si+10h]
     1076
     1077      mov      word ptr [bx+00],ax
     1078      mov      ax,[si+12h]
     1079      mov      word ptr [bx+02],ax
     1080      mov      ax,[si+14h]
     1081      mov      word ptr [bx+04],ax
     1082      mov      ax,[si+18h]
     1083      mov      word ptr [bx+06],ax
     1084
     1085      ; Store number of bytes per sector
     1086      mov      bx, offset BIOS_Bytes
     1087      add      bx,dx
     1088      mov      ax,[si+18h]
     1089      mov      [bx],ax
     1090
     1091
     1092      ;
     1093      ; See of it's a huge drive of not
     1094      ;
     1095
     1096      ; Drive is larger than 2TiB
     1097      mov     ax,5                                    ; Drive code (5)
     1098      mov     bx, [si+14h]                            ; Low word of high dword of sector-count
     1099      or      bx, [si+16h]                            ; High word of high dword of sector-count
     1100      jnz     DriveIO_GatherDiskInfo_ret              ; If non-zero we have a drive with >2^32 sectors and thus LBA48 addressing
     1101
     1102      ; Drive is larger than max OS/2 capacity
     1103      dec     ax                                      ; Drive code (4)
     1104      mov     bx, [si+12h]                            ; High word of low dword of sector-count
     1105      cmp     bx, 0fe01h                              ; Boundary
     1106      jae     DriveIO_GatherDiskInfo_ret              ; If above or equal to boundary,
     1107                                                      ; we have a drive larger than to 65536*255*255 = FE010000 sectors
     1108
     1109      ; Drive can be completely utilized by OS/2
     1110      dec     ax                                      ; Drive code (3)
     1111      cmp     bx, 8000h                               ; Boundary
     1112      jae     DriveIO_GatherDiskInfo_ret              ; If above or equal to boundary,
     1113                                                      ; we have a drive larger than 2^31 sectors but smaller than 65536*255*255
     1114
     1115      ; This is the small area between DANI 1TiB and LBA 1TiB
     1116      dec     ax                                      ; Drive code (2)
     1117      cmp     bx, 7e81h                               ; Boundary
     1118      jae     DriveIO_GatherDiskInfo_ret              ; If above or equal to boundary,
     1119                                                      ; we have a drive larger than 65536*255*127 but <65536*255*255
     1120                                                      ; DANIS506.ADD will use 255/255 extended geometry
     1121
     1122      ; DANI will use 255/127 in this area, this could impact the location of LVM-sectors ! (last sec on track)
     1123      dec     ax                                      ; Drive code (1)
     1124      cmp     bx, 3ec1h                               ; Boundary
     1125      jae     DriveIO_GatherDiskInfo_ret              ; If above or equal to boundary,
     1126                                                      ; we have a drive larger than 65536*255*63 sectors (OS/2 502GiB Limit!)
     1127                                                      ; DANIS506.ADD will use 255/127 extended geometry !
     1128                                                      ; IBM1S506.ADD will use 255/255 extended geometry !
     1129
     1130      ; We have a drive that can be addressed using standard 255/63 geometry
     1131      dec     ax                                      ; Drive code (0)
     1132                                                      ; We have a drive smaller than 65536*255*63 = 3EC10000 sectors
     1133
     1134   DriveIO_GatherDiskInfo_ret:
     1135      pop     es
     1136      pop     di
     1137      pop     si
     1138      pop     dx
     1139      pop     cx
     1140      pop     bx
     1141
     1142      mov      [CurIO_UseExtension],1
     1143
     1144      popf
     1145      ret
     1146DriveIO_GatherDiskInfo  EndP
     1147
     1148
     1149
     1150; Values for sectors per track table corresponding to DriveIO_IsHugeDrive return value.
     1151secs_per_track_table:   db    63,127,255,255,255,255
     1152
     1153db_lmlvm:   db 'Load Master LVM -- disk: ',0
  • trunk/BOOTCODE/REGULAR/OTHER.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'OTHER',0
     24ENDIF
     25
    2226;        In: DS:SI - Pointer to begin of string
    2327;            CX - Len of string
     
    7276   dec     dh
    7377   jnz     GLOSS_StringsLoop
    74    movzx   cx, dl
     78   ;movzx   cx, dl
     79   mov   cl,dl
     80   mov   ch,0
     81
    7582   ret
    7683GetLenOfStrings                EndP
     
    8794   mov     VideoIO_Segment, VideoIO_Page0
    8895
     96   ; Don't use blinking attribute
     97   call     VideoIO_NoBlinking
     98
     99   ; Get HardDriveCount
     100   call    DriveIO_GetHardDriveCount
     101
     102
     103               ; Rousseau: added
     104               call    VideoIO_ClearScreen
     105
     106               ; Cursor to upper-left
     107               mov     TextPosX, 0
     108               mov     TextPosY, 0
     109               call    VideoIO_CursorSet
     110
     111               ;mov     ax, VideoIO_Page1
     112               ;call    VideoIO_BackUpTo   ; Copy BIOS POST to Second Page
     113
     114               ; Copyright
     115               mov     si, offset Copyright
     116               call    MBR_Teletype
     117               xor     si,si
     118               call    MBR_TeletypeNL
     119
     120
     121               ;call    SOUND_Beep
     122
     123               ; Build Date
     124               mov     si, offset BUILD_DATE
     125               call    MBR_TeletypeNL
     126
     127               ; Initialize the com-port for debugging
     128               call     AuxIO_Init
     129
     130               xor     si,si
     131               call    MBR_TeletypeNL
     132
     133               xor      cx,cx
     134            PRECRAP_Main_next_disk:
     135
     136               mov      dl,cl
     137               or       dl,80h
     138
     139               call     DriveIO_GatherDiskInfo              ; Also used to fill the geo, should be separate function
     140
     141               mov      bx,offset HugeDisk
     142               add      bx,cx
     143               mov      [bx], al
     144
     145               call     DriveIO_LoadMasterLVMSector         ; returns ZF=1 if no valid LVM record found
     146
     147               pushf
     148               mov      bx, offset TrueSecs
     149               add      bx,cx
     150               add      bx,cx
     151               add      bx,cx
     152               add      bx,cx
     153               popf
     154
     155               ; bx now contains pointer to truesecs for this drive
     156
     157               jz       NoValidMasterLVM
     158
     159               mov      si,offset LVMSector
     160               mov      ax,[si+LocLVM_Secs]
     161               mov      word ptr [bx],ax
     162               jmp      SkipUseBiosSecs
     163
     164
     165            NoValidMasterLVM:
     166               push     bx                   ; push truesecs pointer
     167               mov      bx, offset BIOS_Secs
     168               add      bx,cx
     169               add      bx,cx
     170               add      bx,cx
     171               add      bx,cx
     172
     173               mov      ax,[bx]              ; get biossecs
     174               pop      bx
     175               mov      word ptr [bx],ax     ; store bios secs in truesecs
     176
     177
     178            SkipUseBiosSecs:
     179               inc      cx
     180               cmp      cl,[TotalHarddiscs]
     181               jb       PRECRAP_Main_next_disk
     182
     183
     184
     185IFDEF AuxDebug
     186               ; Write some debug-info to the com-port
     187               call     DEBUG_Dump1
     188ENDIF
     189
     190              ; jz       NoValidMasterLVM
     191
     192
     193               ; A valid Master LVM has been found.
     194               ; We use the values in here to determine the number of sectors per track,
     195               ; since this could be OS/2 extended geometry.
     196
     197              ; jmp      Continue1
     198
     199
     200               ;mov      word ptr [LOG_Secs],63
     201
     202               mov      al,[HugeDisk]           ;; fout, moet nog index bij
     203               call     AuxIO_TeletypeHexByte
     204               call     AuxIO_TeletypeNL
     205
     206               mov      ax,word ptr [TrueSecs]  ;; fout, moet nog index bij
     207               call     AuxIO_TeletypeHexWord
     208               call     AuxIO_TeletypeNL
     209
     210
     211
     212                 ; Huge Disk indicator
     213                 mov     si, offset HugeBootDisk
     214                 call    MBR_Teletype
     215                 mov     al,[HugeDisk]
     216                 mov     si, offset No
     217                 test    al,al
     218                 jz      MBR_HugeDriveIndicator
     219                 mov     si, offset Yes
     220
     221               MBR_HugeDriveIndicator:
     222                 call    MBR_Teletype
     223                 xor     si,si
     224                 call    MBR_TeletypeNL
     225
     226
     227
     228
     229
     230                 ;
     231                 ; Phase 1 Indicator
     232                 ;
     233                 mov     si, offset Phase1
     234                 call    MBR_Teletype
     235
     236                 mov     si, offset eCS_InstallVolume
     237                 mov     al, [si]
     238                 test    al,al                                 ; See if phase 1 is active
     239                 jnz     MBR_Main_BootThrough
     240                 mov     si, offset NotActive
     241
     242               MBR_Main_BootThrough:
     243                 call    MBR_TeleType
     244                 xor     si,si
     245                 call    MBR_TeletypeNL                                          ; ALP barks undefined symbol; must use prototypes ?
     246
     247
    89248   ; Calculate Cooper-Bar Tables
    90249   call    FX_CalculateTables
     
    108267
    109268   call    PRECRAP_CheckFor13extensions
     269
    110270   IFNDEF ReleaseCode
    111271      ret
    112272   ENDIF
     273
    113274   call    PRECRAP_CheckConfiguration
     275
    114276   ; =======================================
    115277   ; Checks for MBR Virii :) I love that job
     
    123285      call    VIRUS_CheckForVirus
    124286  PCM_NoVirusDetection:
     287
     288
    125289   ; ============================================
    126290   ;  Delay for some time and get Strg/Alt State
     
    132296   jz      PCM_LongDelay
    133297  PCM_ShortDelay:
     298
    134299   mov     al, 13                        ; shorten delay,if floppy gets accessed
    135300  PCM_LongDelay:
     301
    136302   call    TIMER_WaitTicCount
     303
    137304   ; First check, if any normal key got pressed...
    138305   mov     ah, 1
     
    143310   call    MBR_Teletype
    144311   mov     al, 54                        ; about 3 seconds, delay again
     312
    145313   call    TIMER_WaitTicCount
     314
    146315  PCM_NoNormalKeyPressed:
    147316   ; Now get keyboard Strg/Alt State
     
    156325   ret
    157326PRECRAP_Main                    EndP
     327
     328
    158329
    159330AFTERCRAP_Main                  Proc Near  Uses
     
    209380   jmp     MBR_HaltSystem
    210381PRECRAP_CheckConfiguration      EndP
     382
     383
     384; Rousseau: added
     385;        In: SI - Pointer to begin of string (EOS is 0)
     386; Destroyed: SI
     387; Fixme: Uses double writes to use attribute with teletype-function.
     388MBR_TeletypeBold                Proc Near   Uses ax bx cx
     389  MBRT_LoopBold:
     390   lodsb
     391   or      al, al
     392   jz      MBRT_EndBold
     393   push    ax
     394   mov     ah,09h
     395   mov     bx,15
     396   mov     cx,1
     397   int     10h
     398   pop     ax
     399   mov     ah,0eh
     400   mov     bx,7            ; Does not do anything in text-modus
     401   mov     cx,1
     402   int     10h
     403   jmp     MBRT_LoopBold
     404  MBRT_EndBold:
     405   ret
     406MBR_TeletypeBold                EndP
     407
     408;        In: SI - Pointer to begin of string (EOS is 0)
     409; Destroyed: SI
     410; Fixme: Uses double writes to use attribute with teletype-function.
     411MBR_TeletypeVolName             Proc Near   Uses ax bx cx
     412   mov     cx, 11
     413  MBRT_LoopVolName:
     414   mov     dx,cx           ; Backup counter
     415   lodsb
     416   or      al, al
     417   jz      MBRT_EndVolName
     418   push    ax
     419   mov     ah,09h
     420   mov     bx,15
     421   mov     cx,1
     422   int     10h             ; DX is preserved
     423   pop     ax
     424   mov     ah,0eh
     425   mov     bx,7            ; Does not do anything in text-modus
     426   mov     cx,1
     427   int     10h             ; DX is preserved
     428   mov     cx,dx           ; Restore counter
     429   loop    MBRT_LoopVolName
     430  MBRT_EndVolName:
     431   ret
     432MBR_TeletypeVolName             EndP
     433
     434; Rousseau: added
     435; Move cursor to next line
     436; Just do a new-line if SI==0
     437MBR_TeletypeNL                  Proc Near   Uses ax bx cx
     438   test    si,si
     439   jz      MBR_TeletypeNL_NL
     440   call    MBR_Teletype
     441  MBR_TeletypeNL_NL:
     442   push    si
     443   mov     si, offset NL
     444   call    MBR_Teletype
     445   pop     si
     446   ret
     447MBR_TeletypeNL                  EndP
     448
     449; Sync teletype position to VideoIO
     450MBR_TeletypeSyncPos     Proc Near   Uses ax bx cx dx
     451   pushf
     452   mov   bh, 0
     453   mov   ah, 02h
     454   mov   dh,[TextPosY]
     455   mov   dl,[TextPosX]
     456   int   10h
     457   popf
     458   ret
     459MBR_TeletypeSyncPos     EndP
  • trunk/BOOTCODE/REGULAR/PARTMAIN.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'PARTMAIN',0
     24ENDIF
     25
    2226PART_FixUpDefaultPartitionValues Proc Near  Uses dx si di
    2327   ; Fix-Up Default and Last Partition - If lost, search for Bootable
     
    140144; Copies the device-name to the Resume-BIOS IPT entry
    141145PART_UpdateResumeBIOSName       Proc Near Uses ax bx cx si di
    142    movzx   bx, CFG_ResumeBIOSbootSeq
     146   ;movzx   bx, CFG_ResumeBIOSbootSeq
     147   mov   bl,CFG_ResumeBIOSbootSeq
     148   mov   bh,0
     149
    143150   dec     bx
    144151   shl     bx, 1
     
    213220;  PCMPP_NoLinuxKernels:
    214221
    215    movzx   cx, CFG_Partitions ; LocIPT_MaxPartitions
     222   ;movzx   cx, CFG_Partitions ; LocIPT_MaxPartitions
     223   mov   cl,CFG_Partitions ; LocIPT_MaxPartitions
     224   mov   ch,0
     225
    216226   or      cx, cx
    217227   jz      PCMPP_NoPartitions
     
    240250   je      PGPP_IsBIOSbootSeq            ; FEh -> Resume BIOS boot Sequence
    241251   ja      PGPP_IsFloppy                 ; FFh -> Floppy
    242    movzx   bx, dl
     252   ;movzx   bx, dl
     253   mov   bl,dl
     254   mov   bh,0
     255
    243256   shl     bx, 1
    244257   mov     si, wptr [PartitionPointers+bx]
     
    278291;       Out: DL - Number of partition in straight view
    279292PART_ConvertToStraight          Proc Near   Uses
    280    movzx   bx, dl
    281    shl     bx, 1
    282    mov     ax, wptr cs:[PartitionPointers+bx]
     293   ;movzx   bx, dl
     294   mov   bl,dl                                  ; partition number to bl
     295   mov   bh,0                                   ; zero extend to word
     296
     297   shl     bx, 1                                ; convert to word index
     298   mov     ax, wptr cs:[PartitionPointers+bx]   ; get the partition pointer
    283299   cmp     ax, offset FloppyIPTentry
    284300   jb      PCTS_IsBIOSbootSeq
     
    315331  PCFS_IsPartition:
    316332   ; First we get Partition-Offset in AX
    317    movzx   ax, dl
     333   ;movzx   ax, dl
     334   mov   al,dl
     335   mov   ah,0
     336
    318337   mov     bl, LocIPT_LenOfIPT
    319338   mul     bl
     
    354373   mov     bl, LocIPT_LenOfIPT
    355374   div     bl                            ; Divide with IPTlength
    356    movzx   bx, al
     375   ;movzx   bx, al
     376   mov   bl,al
     377   mov   bh,0
     378
    357379   shl     ax, 1
    358380   shl     bx, 2
     
    409431      dec     di                         ; Go to previous char
    410432      jmp     PFOSE_DigitLoop
    411      
     433
    412434  PFOSE_EndOfDigitLoop:
    413435   ret
    414436PART_FillOutSizeElement         EndP
     437
     438
     439
     440
     441; ###################
     442; # START PARTITION #
     443; ###################
    415444
    416445; Starts Partition DL from Internal Partition Table.
     
    454483         mov     di, offset TXT_BootingNowPartName
    455484         jz      PSP_NoName
    456          rep     movsb
     485         rep     movsb                                                           ; Copy label-name to boot
    457486        PSP_NoName:
    458487         xor     al, al
    459488         stosb              ; Ending Zero
    460       mov     si, offset TXT_BootingNow1
     489      mov     si, offset TXT_BootingNow1                                         ; "Booting the system using "
    461490      call    MBR_Teletype
    462491; [Linux support removed since v1.02]
     
    484513      IFDEF ReleaseCode
    485514         ; Save configuration on HDD boots (save CFG_PartLast)
    486          call    DriveIO_SaveConfiguration
     515         call    DriveIO_SaveConfiguration                                       ; Rouaaseu: SAVE CONFIGURATION !
    487516      ENDIF
    488517      call    MBR_Teletype     ; Prints out BootingNow2 including PartitionName
     
    496525   mov     dh, bptr [si+LocIPT_LocationPartTable+0]
    497526   mov     dl, [si+LocIPT_Drive]
    498    call    DriveIO_LoadPartition         ; Load Table...
     527   call    DriveIO_LoadPartition         ; Load Table...                         ; Rousseau: LOAD PARTITION !
    499528   ; --------------------------------------------------- MODIFY PARTITION TABLE
    500529   push    cs
     
    536565   or      byte ptr es:[di+LocBRPT_Flags], 80h ; set ACTIVE partition
    537566   IFDEF ReleaseCode
    538       call    DriveIO_SavePartition      ; Saves the Partition-Table
     567      call    DriveIO_SavePartition      ; Saves the Partition-Table             ; Rousseau: SAVE PARTITION !
    539568   ENDIF
    540569
     
    549578   ; BX:AX -> Absolute End-Position of Partition
    550579
    551    test    CFG_ForceLBAUsage, 1
     580   test    CFG_ForceLBAUsage, 1                                                  ; Rousseau: LBA
    552581   jnz     PSP_ForceI13X
    553    ; LBA-boundary at 16450560 (FB0400h)
     582   ; LBA-boundary at 16450560 (FB0400h) (16320x16x63)
    554583   cmp     bx, 00FBh
    555584   jb      PSP_NoI13X
    556585  PSP_ForceI13X:
    557    push    es di
     586   push    es di si
    558587      mov     ax, 3000h
    559588      mov     es, ax
    560589      xor     di, di
     590      ; Blokkeert starten van IBM BM !!
    561591      mov     wptr es:[di], '1I'
    562592      mov     wptr es:[di+2], 'X3'
    563    pop     di es
     593
     594      ;mov      si,3000h
     595      ;call     AuxIO_DumpSector
     596
     597   pop     si di es
    564598  PSP_NoI13X:
    565599
     
    607641      mov     cx, 0001h                  ; Cylinder 0, Sector 1
    608642      mov     dx, 0080h                  ; First HD, Head 0
    609       call    DriveIO_LoadPartition      ; Load Primary Partition Table
     643      call    DriveIO_LoadPartition      ; Load Primary Partition Table          ; Rousseau: LOAD MBR !
    610644      call    PART_MarkFirstGoodPrimary
    611645      IFDEF ReleaseCode
    612          call    DriveIO_SavePartition   ; Saves the Partition-Table
     646         call    DriveIO_SavePartition   ; Saves the Partition-Table             ; Rousseau: SAVE MBR !
    613647      ENDIF
    614648     PSP_NoHideAdjustPrimaryMark:
     
    622656      test    byte ptr [si+LocIPT_Flags], Flags_DriveLetter
    623657      jz      PSP_NoLVMReassignment
    624       movzx   bx, BootPartNo             ; EntryNumber is straight view
     658      ;movzx   bx, BootPartNo             ; EntryNumber is straight view
     659      mov   bl,BootPartNo             ; EntryNumber is straight view
     660      mov   bh,0
     661
    625662      mov     al, bptr [DriveLetters+bx]
    626663      sub     al, 3Dh                    ; Convert e.g. 80h -> 'C'
     
    679716   mov     dh, [si+LocIPT_LocationBegin+0]
    680717   mov     dl, [si+LocIPT_Drive]
    681    call    DriveIO_LoadPartition         ; Loads boot-sector...
     718   call    DriveIO_LoadPartition         ; Loads boot-sector...                  ; Rousseau: LOAD PART BOOT-SECTOR !!
    682719
    683720   test    CFG_DetectVIBR, 1
     
    734771      mov     si, 10h*4
    735772      xor     di, di                     ; INT 10h Vector to MBR Protection
    736       movsd
     773      ;movsd
     774      movsw
     775      movsw
     776
    737777      mov     si, 13h*4                  ; INT 13h Vector to MBR Protection
    738       movsd
     778      ;movsd
     779      movsw
     780      movsw
     781
    739782      mov     al, CFG_IgnoreWriteToMBR   ; Option to MBR Protection
    740783      stosb
     
    753796  PSP_NoMBRprotect:
    754797   cmp     bptr [si+LocIPT_SystemID], 08 ; I hate Microsuck NTFS check
    755    je      PSP_NoSpecialSupport
     798
     799   ;je      PSP_NoSpecialSupport
    756800
    757801      mov     di, offset PartitionSector ; ES:DI - Actual Boot-Record
     
    759803      mov     ax, wptr es:[di+24]
    760804      cmp     ax, 003Fh                  ; Physical Layout-Sectors... Safety check
    761       ja      PSP_NoSpecialSupport
     805
     806
     807      ; Rousseau: # Boot Logical Partitions)
     808      ; FreeDOS and eCS on extpart on non-huge needs special support. (old ja jump)
     809      ; PC-DOS7 on huge pri fat16 2G works with both (XP too) when at start of disk. (also when offset at 20MiB)
     810      ; PCD7 bonkt vast als in 2GiB log at start of space. "Starting PC DOS..." verschijnt. PCD Loader probleem.
     811      ; Offset van start-of-disk bij PCD7 niet meer dan 2GiB maken.
     812      ; Special is needed to boot ECS-CXXVAC (log-part) on Douwskie Box with 40G disk.
     813      ; FreeDOS 20G PRI SOD op 400G start niet met special.
     814      ; Heeft drive-id op 26h (36d) van 0dh !
     815      ; WinXP werkt met special en not-special op 400G normal geo.
     816      ; eCS op PRI op 2G met os2 ext geo werkt ook met beide.
     817      ; eCS LOG werkt niet zonder special op 400G.
     818      ; (hidden secs op 3F en moet 3F00 zijn; BM staat ervoor, 3F00=255*63+63)
     819      ; Laatste 63 is MBR.
     820      ;
     821      ; It seems PRI's already get special treatment in that they get their hidden secs updated.
     822      ; (100MB HD, moved 50MB PRI-DOS part UP, DFSee complains about wrong hidden, but AiR-BOOT corrects it before booting)
     823
     824      ; FreeDOS zet 63 in SPT in BPB op 255/255 geo !!!!
     825
     826      ; PC-DOS7 wil vaak niet starten als er meerdere pri's actief zijn.
     827      ; Logo verschijnt wel maar start niet door.
     828
     829
     830      ; Display volume-name
     831      pushf
     832      push     si
     833      add      si, LocIPT_Name
     834      call     MBR_TeletypeVolName
     835      xor      si,si
     836      call     MBR_TeletypeNL                                                    ; Rousseau: Just before booting the selected partition
     837      pop      si
     838      popf
     839
     840
     841
     842      jmp     special                                                            ; Rousseau: GOT IT !!! (LOG-BOOT) (alleen op huge disks !)
     843      ;jmp      PSP_NoSpecialSupport
     844      ;ja      PSP_NoSpecialSupport                                              ; Rousseau: original M. Kiewitz...
     845      ;jbe     PSP_NoSpecialSupport                                               ;   had to change to opposite !
     846
     847
    762848      mov     ax, wptr es:[di+26]
    763849      cmp     ax, 00FFh                  ; Physical Layout-Heads... Safety check
    764850      ja      PSP_NoSpecialSupport
    765851      mov     al, bptr es:[di+36]
    766       cmp     al, 80h                    ; Drive Letter
     852      cmp     al, 80h                    ; Drive Letter (ID)
    767853      jne     PSP_NoSpecialSupport
     854
    768855      ; Special Support needed
     856special:
     857      ; Write actual drive-letter to partition boot-record.
     858      ; This is according to BPB.
    769859      mov     al, bptr [si+LocIPT_Drive]
    770       mov     bptr es:[di+36], al        ; Write Actual Drive-Letter
     860      ; Also an influence with FreeDOS !
     861      ; Generates JFS ERROR when not set correctly !!!
     862      mov     bptr es:[di+36], al               ; Write Actual Drive-Letter (80h id first drive)        !!!!!!!!!!!!!!!!!!!!!!!
     863
     864      ; This could be incorrect when a partition is moved,
     865      ; or the system installer puts the wrong value here.
     866      ; FreeDOS (log-part) i.e. puts 03fH (63d) here, eventhough it is not a the start of the disk.
     867      ; This fixing is done by OS/2 BM as well, according to Martin.
    771868      mov     ax, [si+LocIPT_AbsoluteBegin]
    772       mov     wptr es:[di+28], ax        ; Fixing Hidden Sectors count
     869      mov     wptr es:[di+28], ax               ; low word of hidden sectors
    773870      mov     ax, [si+LocIPT_AbsoluteBegin+2]
    774       mov     wptr es:[di+30], ax        ; Done by OS/2 BootMan as well...
     871      mov     wptr es:[di+30], ax               ; high word of hidden sectors
    775872
    776873   ; ------------------------------------------------ LOGICAL PARTITION SUPPORT
    777874  PSP_NoSpecialSupport:
     875
     876;jmp   PSP_NoLogicalSupport
     877
    778878   test    byte ptr [si+LocIPT_Flags], Flags_DriveLetter
    779879   jz      PSP_NoLogicalSupport
    780880
    781       movzx   bx, BootPartNo             ; EntryNumber is straight view
     881      ;movzx   bx, BootPartNo             ; EntryNumber is straight view
     882      mov   bl,BootPartNo             ; EntryNumber is straight view
     883      mov   bh,0
     884
    782885      mov     al, bptr [DriveLetters+bx]
    783886      mov     bptr es:[di+37], al        ; Write Drive Letter (OS/2 only)
     
    793896      rep     movsw
    794897   pop     si
    795    ; ---------------------------------------------------- NOW START BOOT-RECORD
     898   ; ---------------------------------------------------- NOW START BOOT-RECORD  ; Rousseau: START PARTITION BOOT-RECORD !!
     899
     900
     901IFDEF AuxDebug
     902;   call     DEBUG_Dump2
     903ENDIF
     904
     905               ;
     906               ; ########################### WAIT FOR KEY ################################
     907               ;
     908
     909   ; Rousseau:
     910   ; Wait for key so we can see which volume is going to be started.
     911   ;xor     ax, ax
     912   ;int     16h
     913   ;cmp     al, 1bh                        ; is escape-key ?
     914   ;jne   skip_reenter
     915
     916   ;jmp      MBR_Main_ReEnterBootMenuPre   ; yep, re-enter boot-menu
     917
     918skip_reenter:
     919
     920
     921
     922
     923
     924
     925
     926
     927   ;
     928   ; BYE BYE
     929   ;
    796930   xor     ax, ax
    797931   xor     bx, bx
     
    801935   xor     dh, dh                        ; Drive supported by BIOS
    802936   mov     dl, cs:[si+LocIPT_Drive]      ; Drive Physical No
     937
    803938   IFDEF ReleaseCode
    804       db      0EAh                          ; JUMP TO Entry Point...Bye Bye
     939      db      0EAh                       ; JUMP TO Entry Point...Bye Bye
    805940      dw      StartBasePtr
    806941      dw      StartBaseSeg
    807942   ENDIF
    808943PART_StartPartition             EndP
     944
     945
     946
     947
     948
     949
     950
     951
     952
     953
    809954
    810955; This routine is called to hide a partition
     
    9231068; Destroyed: *none*
    9241069PART_SearchFileSysName          Proc Near  Uses bx dx
    925    movzx   bx, al
     1070   ;movzx   bx, al
     1071   mov   bl,al
     1072   mov   bh,0
     1073
    9261074   mov     si, offset FileSysIDs
    9271075  PSFSN_SearchLoop:
     
    9431091   mov     ah, dl
    9441092   ; AH is now the FileSystem-Flag
    945    movzx   bx, bh
     1093   ;movzx   bx, bh
     1094   mov   bl,bh
     1095   mov   bh,0
     1096
    9461097   shl     bx, 3   ; Offsets * 8
    9471098   mov     si, offset FileSysNames
    9481099   add     si, bx
    949    ret         
     1100   ret
    9501101PART_SearchFileSysName          EndP
    9511102
     
    9541105;       Out: AL - Hidden File-System-ID
    9551106PART_SearchFileSysHiddenID      Proc Near  Uses bx
    956    movzx   bx, al
     1107   ;movzx   bx, al
     1108   mov   bl,al
     1109   mov   bh,0
     1110
    9571111   mov     si, offset FileSysIDs
    9581112  PSFSHI_SearchLoop:
     
    10191173   ret
    10201174PART_CheckForValidPartName      EndP
     1175
     1176
     1177; Rousseau: added
     1178; Compare a volume-label in the IPT to the install-volume
     1179; SI holds pointer to entry in IPT
     1180; CY set if this entry is also the install-volume
     1181PART_IsInstallVolume            Proc Near   Uses ax cx dx si di
     1182      cld                                    ; Advance upwards with lodsb
     1183      mov   di, offset eCS_InstallVolume     ; Address of install-volume label (max. 11 chars)
     1184
     1185      mov   cx, 11                           ; Maximum length of label
     1186      xor   dl, dl                           ; Not found yet
     1187
     1188    ; Compare next character
     1189    PART_IsInstallVolumeNext:
     1190      lodsb                                  ; Load byte from SI (IPT-entry)
     1191      ;cmp      al,' '                        ; If space then use zero
     1192      ;jne      PART_IsInstallVolume_skip1
     1193      ;xor      al,al
     1194   PART_IsInstallVolume_skip1:
     1195      xchg     ah,al                         ; Save char to AH
     1196      xchg     si,di                         ; Exchange pointers
     1197      lodsb                                  ; Load byte from SI (install-volume label)
     1198      ;cmp      al,' '                        ; If space then use zero
     1199      ;jne      PART_IsInstallVolume_skip2
     1200      ;xor      al,al
     1201   PART_IsInstallVolume_skip2:
     1202      xchg     si,di                         ; Reexchange pointers
     1203      call     AuxIO_Teletype
     1204      call     CONV_ToUpper
     1205      call     AuxIO_Teletype
     1206      xchg     al,ah
     1207      call     AuxIO_Teletype
     1208      call     CONV_ToUpper
     1209      call     AuxIO_Teletype
     1210      call     AuxIO_TeletypeNL
     1211
     1212      ; Are both of them zero ?
     1213      ; Then the names could be the same, but cx must not equal 11
     1214      ; because that would indicate a null-string.
     1215      mov      dh,al
     1216      or       dh,ah
     1217      jz       PART_IsInstallVolumeFound
     1218
     1219      cmp      ah,al                         ; Are the the same ?
     1220      jnz      PART_IsInstallVolumeNotFound  ; Nope, compare ended
     1221      loop     PART_IsInstallVolumeNext      ; Yep, Compare next character
     1222
     1223   PART_IsInstallVolumeFound:
     1224      ; If CX is still 11 this was a zero string
     1225      ; and thus not a valid volume-name.
     1226      ; This should not occur as this function is only called when the first
     1227      ; byte is non-zero.
     1228      cmp      cx,11
     1229      je       PART_IsInstallVolumeNotFound
     1230      ; Found !
     1231      mov      dl,1                          ; Found
     1232      jmp      PART_IsInstallVolumeEnd
     1233
     1234
     1235   PART_IsInstallVolumeNotFound:
     1236      mov      dl,0
     1237      jmp      PART_IsInstallVolumeEnd
     1238
     1239
     1240   PART_IsInstallVolumeEnd:
     1241      ; Set the status in CY
     1242      mov      al,dl
     1243      add      al,'0'
     1244      call     AuxIO_TeletypeHexByte
     1245      call     AuxIO_TeletypeNL
     1246      rcr      dl,1                          ; Put found-flag in CY
     1247      ret
     1248PART_IsInstallVolume            EndP
  • trunk/BOOTCODE/REGULAR/PARTSCAN.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22
     23IFDEF ModuleNames
     24DB 'PARTSCAN',0
     25ENDIF
     26
    2227; Note: This is complex code. So make sure that you know what you are doing in
    2328;        here.
     
    4853   mov     si, offset NewPartTable
    4954   mov     di, offset PartitionTable
    50    movzx   ax, NewPartitions
     55   ;movzx   ax, NewPartitions
     56   mov   al,NewPartitions
     57   mov   ah,0
     58
    5159   mov     CFG_Partitions, al
    5260   mov     bl, LocIPT_LenOfIPT
     
    5866   mov     si, offset NewDriveLetters
    5967   mov     di, offset DriveLetters
    60    mov     cx, LocIPT_MaxPartitions/2
    61    rep     movsw
     68   mov     cx, LocIPT_MaxPartitions
     69   rep     movsb
    6270
    6371; [Linux support removed since v1.02]
     
    8290   or      dl, dl
    8391   jz      PSSFP_NoAutoDriveLetter
    84    movzx   cx, CFG_Partitions
     92   ;movzx   cx, CFG_Partitions
     93   mov   cl,CFG_Partitions
     94   mov   ch,0
     95
    8596   or      cx, cx
    8697   jz      PSSFP_NoAutoDriveLetter
     
    118129   mov     wptr [ExtendedAbsPos+2], ax
    119130  PSSDFP_LoadThisPartition:
    120    call    DriveIO_LoadPartition
     131
     132   call    DriveIO_LoadPartition                                                 ; Rousseau: load a partition record
     133
    121134   jc      PSSDFP_InvalidPartition
     135
    122136   ; LVM Support - Reads LVM Information Sector
    123    call    DriveIO_LoadLVMSector
     137   call    DriveIO_LoadLVMSector                                                 ; Rousseau: load LVM sector
     138
    124139   call    PARTSCAN_ScanPartition
    125140   IFDEF ReleaseCode
     
    223238   add     ax, wptr [CurPartition_Location+0] ; +Partition-Absolute
    224239   adc     bx, wptr [CurPartition_Location+2] ;  sectors
    225    call    DriveIO_LoadTmpSector         ; Loads Boot record
     240   call    DriveIO_LoadTmpSector         ; Loads Boot record                     ; Rousseau: LOAD PARTITION BOOT RECORD !!
    226241   ; Sets up DS:SI - TmpSector
    227242
     
    249264   cmp     PartSystemID, 07h          ; We got IFS here?
    250265   jne     PCCTP_IFSdone
    251    ; Check, if 'JFS ' is at DWORD offset 36h
     266   ; Check, if 'JFS ' is at DWORD offset 36h                                     ; Rousseau: JFS check (LVM / IPT?)
    252267   cmp     wptr [si+36h], 'FJ'
    253268   jne     PCCTP_IFSnoJFS
     
    284299     PCCTP_HasVolumeLetter:
    285300      ; Save VolumeLetter in separate table
    286       movzx   bx, NewPartitions          ; NewPartitions is one behind here, so
     301      ;movzx   bx, NewPartitions          ; NewPartitions is one behind here, so
     302      mov   bl,NewPartitions          ; NewPartitions is one behind here, so
     303      mov   bh,0
     304
    287305      mov     [PartitionVolumeLetters+bx], al ; it's already a zero-based offset
    288306      ; Now copy VolumeID and VolumeName to temporary space
     
    291309      stosw
    292310      mov     ax, [si+LocLVM_PartitionID+2]
    293       stosw                              ; Set Serial-Field to LVM-VolumeID
     311      stosw
     312                              ; Set Serial-Field to LVM-VolumeID
     313      push     di
    294314      add     si, LocLVM_PartitionName
     315
    295316      mov     cx, 5
    296317      rep     movsw                      ; Copy LVM-PartitionName to Temp Space
    297       movsb                              ;  (11 bytes in total)
     318      movsb                               ;  (11 bytes in total)
     319
     320      pop   di
     321      cmp   PartSystemID, 0ah
     322
     323      jne   PCCTP_NoIbmBm
     324      mov   si, offset ibm_bm_name
     325      mov   cx,5
     326      rep   movsw
     327      movsb
     328
     329
     330
     331   PCCTP_NoIbmBm:
     332
     333
    298334   pop     di si dx ax
    299335   mov     si, offset MBR_NoName_Patched
     
    304340   pop     di si dx ax
    305341   test    ah, FileSysFlags_NoName       ; No-Name-Flag ? -> No Partition Name
    306    jnz     PCCTP_ThereIsNoName           ;                    available
     342
     343   jz      PCCTP_ThereIsAName
     344   jmp     PCCTP_ThereIsNoName           ;                    available
     345
     346   PCCTP_ThereIsAName:
     347
    307348      ; We check for NTFS (got detected a little bit earlier in this routine)
    308349      cmp     PartSystemID, 08h          ; We got IFS/NTFS here?
     
    312353      add     si, 2Bh                    ; DS:SI - Partition-Name
    313354      test    ah, FileSysFlags_FAT32     ; FAT32 specific name getting ?
     355
    314356      jz      PCCTP_ResumeNormal
     357
    315358      add     si, 1Ch                    ; Fix for FAT 32, shiat
    316359     PCCTP_ResumeNormal:
    317360      mov     cx, 11                     ;         11 bytes length
    318361      call    PART_CheckForValidPartName
    319       jnc     PCCTP_ThereIsNoName
     362      jc    PCCTP_ThereIsAName2
     363
     364      jmp     PCCTP_ThereIsNoName
     365
     366   PCCTP_ThereIsAName2:
     367
    320368      sub     si, 4                      ; DS:SI -> Serial&Name (15-Bytes)
    321369      xor     ah, ah                     ; no Flags_NoPartName
     
    343391            repz    cmpsb
    344392         pop     di si
    345          je      PCCTP_Match
     393
     394         jne   PCCTP_NoMatchYet
     395
     396         jmp      PCCTP_Match
     397
     398      PCCTP_NoMatchYet:
     399
    346400        PCCTP_SerialNameAlreadyFound:
    347401         add     di, LocIPT_LenOfIPT
     
    477531     PCCTP_LocCompFailed:
    478532      jmp     PCCTP_CompareFailed
    479      
     533
    480534   ; ==================================
    481535   ; =MATCH=, found partition in IPT...
     
    557611   ; Calculate Pointer to IPT
    558612   mov     di, offset NewPartTable       ; ES:DI - NewPartTable
    559    movzx   ax, NewPartitions
     613   ;movzx   ax, NewPartitions
     614   mov   al,NewPartitions
     615   mov   ah,0
     616
    560617   mov     bl, LocIPT_LenOfIPT
    561618   mul     bl
     
    575632   stosb
    576633   mov     al, cl                        ; Partition-Flags from register...
    577    stosb 
     634   stosb
    578635   mov     ax, PartCRC                   ; BootRecordCRC...
    579636   stosw
     
    620677
    621678   ; Calculate Size of this partition and put it into separate table...
    622    movzx   ax, NewPartitions
     679   ;movzx   ax, NewPartitions
     680   mov   al,NewPartitions
     681   mov   ah,0
     682
    623683   dec     ax
    624684   mov     bx, ax
     
    658718; Destroyed: None
    659719PARTSCAN_DefXref                Proc Near   Uses ax bx cx dx si di
    660    movzx   bx, dl
     720   ;movzx   bx, dl
     721   mov   bl,dl
     722   mov   bh,0
     723
    661724   mov     bptr [PartitionXref+bx], dh      ; X-Reference
    662725   ; Copy Hide-Config of IPT partition to new location in new table
     
    673736   rep     movsb                            ; Copy Hide-Config to NewHideTable
    674737   ; Process Logical-Drive-Letter table as well...
    675    movzx   bx, dl
     738   ;movzx   bx, dl
     739   mov   bl,dl
     740   mov   bh,0
     741
    676742   mov     al, bptr [DriveLetters+bx]       ; Get Drv-Letter from org. pos
    677    movzx   bx, dh
     743   ;movzx   bx, dh
     744   mov   bl,dl
     745   mov   bh,0
     746
    678747   mov     bptr [NewDriveLetters+bx], al    ; Put Drv-Letter to new pos
    679748   ret
     
    684753; Destroyed: None
    685754PARTSCAN_GetXref                Proc Near   Uses bx
    686    movzx   bx, dl
     755   ;movzx   bx, dl
     756   mov   bl,dl
     757   mov   bh,0
     758
    687759   mov     dh, bptr [PartitionXref+bx]      ; X-Reference
    688760   ret
     
    702774         cmp     al, 0FFh
    703775         je      PSSHCWX_SyncEmpty
    704          movzx   bx, al
     776         ;movzx   bx, al
     777         mov   bl,al
     778         mov   bh,0
     779
    705780         mov     al, [PartitionXref+bx]     ; Translate it
    706781         cmp     al, 0FFh
     
    729804   ret
    730805PARTSCAN_SyncHideConfigWithXref EndP
     806
     807ibm_bm_name:   db 'IBM BootMan',0
  • trunk/BOOTCODE/REGULAR/PASSWORD.ASM

    r29 r30  
    1919;                                                       AiR-BOOT / PASSWORD
    2020;---------------------------------------------------------------------------
     21
     22IFDEF ModuleNames
     23DB 'PASSWORD',0
     24ENDIF
     25
    2126
    2227; Don't ask me, what I'm doing in here to encode the passwords. I don't even
     
    164169  PE_ContinueLoop:
    165170      mov     al, ds:[si]
    166       movzx   bx, ds:[si+8]
     171      ;movzx   bx, ds:[si+8]
     172      mov   bl,ds:[si+8]
     173      mov   bh,0
     174
    167175      add     bl, 16
    168176      mov     ah, ds:[si+bx]
  • trunk/BOOTCODE/REGULAR/STD_TEXT.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'STD_TEXT',0
     24ENDIF
     25
    2226; If you modify this Copyright and release this under your own name,
    2327;  I'm going to sue your cheap ass, rape your dog and blow up your house. =)
    2428
    25 CopyrightVersionLen   equ   5
    26 Copyright             db ' AiR-BOOT v1.06 - (c) 1998-2009 M. Kiewitz, Dedicated to Gerd Kiewitz', 0
    27 BootEndMsg            db 'Free usage allowed, as long as you dont or have not worked for US government', 0
    28 BootEndMsg2           db 'This is GPLv3+ software. Please visit http://AiR-BOOT.sourceforge.net', 0
     29CopyrightVersionLen   equ   6
     30;Copyright             db ' AiR-BOOT v1.06 - (c) 1998-2009 M. Kiewitz, Dedicated to Gerd Kiewitz', 0
     31Copyright             db ' AiR-BOOT v1.07 - (c) 1998-2011 M. Kiewitz, Dedicated to Gerd Kiewitz', 0
     32;Copyright             db ' AiR-BOOT v1.07 - (c) 2011 M. Kiewitz - Rousseau test-version >502G (build: #24)', 0
     33;Copyright             db ' AiR-BOOT v1.07 - (c) 2011 M. Kiewitz   -  Release Candidate 1  -  (build: #25)', 0
     34;Copyright             db ' AiR-BOOT v1.07 - (c) 1998-2011 M. Kiewitz, Dedicated to Gerd Kiewitz (rc2-b27)', 0
     35;Copyright             db ' AiR-BOOT v1.07 - (c) 1998-2011 M. Kiewitz, Dedicated to Gerd Kiewitz (rc3-b31)', 0
     36;Copyright             db ' AiR-BOOT v1.07 - (c) 1998-2011 M. Kiewitz, Dedicated to Gerd Kiewitz (rc4-b33)', 0
     37;Copyright             db ' AiR-BOOT v1.07 - (c) 1998-2011 M. Kiewitz, Dedicated to Gerd Kiewitz (rc5-b35)', 0
     38
     39;BootEndMsg            db 'Free usage allowed, as long as you dont or have not worked for US government', 0
     40
     41; Rousseau: switch around
     42BootEndMsg           db 'This is GPLv3+ software. Please visit http://AiR-BOOT.sourceforge.net', 0
     43BootEndMsg2            db 'http://www.gnu.org/licenses/gpl.txt', 0
     44
     45AuxInitMsg           db 'Initializing Serial Communications on COM',0
    2946
    3047CheckID_MBR           db 'AiRBOOT'
     
    3350; Colors for special words hard-coded. Keep all 0s.
    3451TXT_SETUP_LowerMessage      db 'This software is released under ', 0, 'GPLv3+.', 0
    35                             db 'It may not be used by US government', 0
     52;                            db 'It may not be used by US government', 0
     53                            db 'http://www.gnu.org/licenses/gpl.txt', 0
    3654                            db 'For more information and source, please visit', 0
    3755                            db 'http://AiR-BOOT.sourceforge.net', 0
    38                             db 'Contact via e-mail: ', 0, 'm_kiewitz [AT] users.sourceforge.net', 0
     56;                            db 'Contact via e-mail: ', 0, 'm_kiewitz [AT] users.sourceforge.net', 0
     57                            db 'Contact via e-mail: ', 0, 'airboot@ecomstation.com', 0
    3958
    4059ContinueBIOSbootTable dw offset TXT_SETUP_MAGIC_CDROM
  • trunk/BOOTCODE/REGULAR/TIMER.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'TIMER',0
     24ENDIF
     25
    2226; This here is one of the rare cases that I'm using DIV and MUL opcodes. I
    2327;  could have coded around them in here as well, but I was too lazy. Most of
     
    3943;       Out: Nothing
    4044TIMER_WaitTicCount              Proc Near   Uses ax bx dx
    41    movzx   bx, al
     45   ;movzx   bx, al
     46   mov   bl,al
     47   mov   bh,0
     48
    4249   call    TIMER_GetTicCount
    4350   add     bx, ax                        ; BX - Required lower Tic
     
    6269   mul     bl                            ; Result * 91
    6370   mov     dx, ax
    64    movzx   ax, bh
     71   ;movzx   ax, bh
     72   mov   al,bh
     73   mov   ah,0
     74
    6575   mov     bl, 18
    6676   mul     bl                            ; Remainder * 18
     
    8090   div     dl                            ; Tics : 91
    8191   mov     dh, al
    82    movzx   ax, ah
     92   ;movzx   ax, ah
     93   mov   al,ah
     94   mov   ah,0
     95
    8396   mov     dl, 18
    8497   div     dl                            ; Remainder : 18
     
    87100   mov     bl, 5
    88101   mul     bl                            ; Result * 5
    89    movzx   dx, dh
     102   ;movzx   dx, dh
     103   mov   dl,dh
     104   mov   dh,0
     105
    90106   add     ax, dx                        ; Add both together...
    91107   ret
  • trunk/BOOTCODE/REGULAR/VIDEOIO.ASM

    r29 r30  
    1919;                                                      AiR-BOOT / VIDEO I/O
    2020;---------------------------------------------------------------------------
     21
     22IFDEF ModuleNames
     23DB 'VIDEOIO',0
     24ENDIF
    2125
    2226VideoIO_WaitRetrace             Proc Near   Uses ax dx
     
    3236   ret
    3337VideoIO_WaitRetrace             EndP
     38
     39
    3440
    3541; Holds the current position. Yeah, I know this is in the code area, but who
     
    100106   mov     ax, VideoIO_Segment
    101107   mov     es, ax
    102    movzx   ax, TextPosY
     108   ;movzx   ax, TextPosY
     109   mov   al,TextPosY
     110   mov   ah,0
     111
    103112   mov     bl, 160
    104113   mul     bl
     
    169178VideoIO_FixedPrint              EndP
    170179
     180; Rousseau:
     181; Turn off blinking
     182; http://www.ctyme.com/intr/rb-0088.htm does not mention this
     183VideoIO_NoBlinking              Proc Near   Uses ax bx
     184      mov      bx,0
     185      mov      ax,1003h
     186      int      10h
     187   ret
     188VideoIO_NoBlinking              EndP
     189
    171190;        In: AL - Single Char to Print
    172191; Destroyed: None
     
    179198   ret
    180199VideoIO_PrintSingleChar         EndP
     200
     201
     202
     203; Print hex-byte to screen
     204; This outputs two characters
     205; In:          AL - byte to send
     206; Out:         AL - byte sent
     207; Destroyed:   None
     208VideoIO_PrintHexByte    Proc     Near  Uses  ax
     209      call     CONV_BinToAsc              ; Returns high hex-nibble in AH, low hex-nibble in AL
     210      xchg     al,ah                      ; High hex-nibble first
     211      call     VideoIO_PrintSingleChar    ; Output to screen
     212      xchg     al,ah                      ; Low hex-nibble next
     213      call     VideoIO_PrintSingleChar    ; Output to screen
     214      ret
     215VideoIO_PrintHexByte    EndP
     216
     217
     218; Print hex-word to screen
     219; This outputs four characters
     220; In:          AX - word to send
     221; Out:         AX - word sent
     222; Destroyed:   None
     223VideoIO_PrintHexWord    Proc     Near
     224      xchg     al,ah                      ; High byte first
     225      call     VideoIO_PrintHexByte       ; Output to screen
     226      xchg     al,ah                      ; low byte next
     227      call     VideoIO_PrintHexByte       ; Output to screen
     228      ret
     229VideoIO_PrintHexWord    EndP
     230
     231
     232; Print hex-dword to screen
     233; This outputs eight characters
     234; In:          DX:AX - dword to send
     235; Out:         DX:AX - dword sent
     236; Destroyed:   None
     237VideoIO_PrintHexDWord   Proc     Near
     238      xchg     ax,dx
     239      call     VideoIO_PrintHexWord       ; High word first
     240      xchg     ax,dx
     241      call     VideoIO_PrintHexWord       ; Low word next
     242      ret
     243VideoIO_PrintHexDWord   EndP
     244
     245
     246; Print hex-qword to screen
     247; This outputs sixteen characters
     248; In:          BX:CX:DX:AX - qword to send
     249; Out:         BX:CX:DX:AX - qword sent
     250; Destroyed:   None
     251VideoIO_PrintHexQWord   Proc     Near
     252      xchg     dx,bx
     253      xchg     ax,cx
     254      call     VideoIO_PrintHexDWord      ; High dword first
     255      xchg     dx,bx
     256      xchg     ax,cx
     257      call     VideoIO_PrintHexDWord      ; Low dword next
     258      ret
     259VideoIO_PrintHexQWord   EndP
     260
     261
     262
     263
    181264
    182265;        In: AL - Single Char to Print
     
    205288   cmp     al, 99
    206289   ja      VIOPBN_DoNotWriteAnything
    207    movzx   bx, al
     290   ;movzx   bx, al
     291   mov   bl,al
     292   mov   bh,0
     293
    208294   call    VideoIO_Internal_SetRegs
    209295   cmp     bl, 10
    210296   jb      VIOPBN_Lower10
    211297   push    ax
    212       movzx   ax, bl
     298      ;movzx   ax, bl
     299      mov   al,bl
     300      mov   ah,0
     301
    213302      mov     dl, 10
    214303      div     dl
     
    231320;        In: AL - Single Byte to Print
    232321; Destroyed: None
    233 VideoIO_PrintByteDynamicNumber  Proc Near   Uses ax bx dx es di
     322VideoIO_PrintByteDynamicNumber  Proc Near   Uses ax bx cx dx es di               ; Rousseau: cx was missing from push-list
    234323   xor     cl, cl
    235324   mov     bh, al
     
    240329   cmp     ah, 100
    241330   jb      VIOPBDN_Lower100
    242    movzx   ax, ah
     331   ;movzx   ax, ah
     332   mov   al,ah
     333   mov   ah,0
     334
    243335   mov     dl, 100
    244336   div     dl
     
    249341   add     di, 2
    250342 VIOPBDN_Lower100:
    251    movzx   ax, ah
     343   ;movzx   ax, ah
     344   mov   al,ah
     345   mov   ah,0
     346
    252347   mov     dl, 10
    253348   div     dl
     
    270365; Destroyed: None Important
    271366VideoIO_Internal_MakeWinDown    Proc Near   Uses dx di
    272    movzx   dx, cl
     367   ;movzx   dx, cl
     368   mov   dl,cl
     369   mov   dh,0
     370
    273371   mov     bl, al
    274372   call    VideoIO_Internal_SetRegs
     
    281379   dec     dx
    282380   jnz     VIOIMWD_Loop
    283    ret     
     381   ret
    284382VideoIO_Internal_MakeWinDown    EndP
    285383
     
    287385; Destroyed: None Important
    288386VideoIO_Internal_MakeWinRight   Proc Near   Uses dx di
    289    movzx  dx, cl
     387   ;movzx  dx, cl
     388   mov   dl,cl
     389   mov   dh,0
     390
    290391   mov    bl, al
    291392   call   VideoIO_Internal_SetRegs
     
    298399      dec    dx
    299400   jnz    VIOIMWR_Loop
    300    ret     
     401   ret
    301402VideoIO_Internal_MakeWinRight   EndP
    302403
     
    366467   sub     bl, WinBeginPosX
    367468   dec     bl
    368  
     469
    369470  VIOIMW_Loop:
    370471      mov     ch, WinBeginPosY
     
    439540      call    VideoIO_CursorSet
    440541      call    VideoIO_CursorOn           ; Set and turn cursor on
    441      
     542
    442543      ; ES:DI - Screen-Position to Start of String
    443544      ; DL    - Position in String (relative to begin, base=0)
     
    460561         cmp     dl, StringLen           ; String "full" ?
    461562         jae     VIOLUES_Loop
    462          movzx   bx, dl
     563         ;movzx   bx, dl
     564         mov   bl,dl
     565         mov   bh,0
     566
    463567         shl     bx, 1
    464568         mov     es:[di+bx], al
     
    476580         mov     al, ' '
    477581         dec     dl
    478          movzx   bx, dl
     582         ;movzx   bx, dl
     583         mov   bl,dl
     584         mov   bh,0
     585
    479586         shl     bx, 1
    480587         mov     es:[di+bx], al
     
    502609   ret
    503610VideoIO_LetUserEditString       EndP
     611
     612
     613
     614;
     615; Rousseau Additions.
     616;
     617
     618
     619; Function Template
     620;ProcName                        Proc Near   Uses ax bx cx dx si es di
     621;ProcName                        EndP
     622
     623
     624;
     625; Clear the current page
     626;
     627VideoIO_ClearScreen             Proc Near   Uses ax bx cx dx si es di
     628   mov   al, 0       ; clear entire window
     629   mov   bh,07h      ; Attribute for new lines
     630   xor   cx,cx       ; Row, Column ULC
     631   xor   dx,dx
     632   dec   dx          ; Row, Column LRC (does this corrupt other pages ?)
     633   mov   ah, 06h     ; Function Code
     634   int   10h         ; Do It !
     635   ret
     636VideoIO_ClearScreen             EndP
     637
     638;
     639; Rousseau: added
     640; Set poosition to teletype cursor
     641;
     642VideoIO_SyncPos                 Proc Near   Uses ax bx cx dx
     643   pushf
     644   mov   bh, 0
     645   mov   ah, 03h
     646   int   10h
     647   mov   [TextPosX], dl
     648   mov   [TextPosY], dh
     649   popf
     650   ret
     651VideoIO_SyncPos                 EndP
     652
     653
     654
     655VideoIO_DBG_WriteString         Proc Near   Uses ax bx cx dx si es di
     656   mov   ch, [CFG_Partitions]                                                    ; y
     657   add   ch, 7
     658   add   ch, [CFG_IncludeFloppy]
     659   push cx
     660   mov   cl, 1                                                                   ; x
     661   call  VideoIO_Locate
     662   mov   ch, 15                                                                  ; fgc
     663   mov   cl, 0                                                                   ; bgc
     664   call  VideoIO_Color
     665   mov   si, offset ShowBootLog
     666   call  VideoIO_Print
     667   pop cx
     668   inc   ch
     669
     670   ;mov   ch, 21                                                                 ; y
     671   mov   cl, 1                                                                   ; x
     672   call  VideoIO_Locate
     673   mov   ch, 15                                                                  ; fgc
     674   mov   cl, 0                                                                   ; bgc
     675   call  VideoIO_Color
     676
     677
     678   ; Rousseau:
     679   mov al, [NewPartitions]
     680   ;call  VideoIO_PrintByteDynamicNumber
     681   mov al, [CFG_Partitions]
     682   ;call  VideoIO_PrintByteDynamicNumber
     683   ret
     684VideoIO_DBG_WriteString         EndP
     685
     686
     687; Dump the disk-info.
     688; Disk number is in DL.
     689VideoIO_DumpDiskInfo    Proc Near
     690
     691   VideoIO_DumpDiskInfo_next_disk:
     692      push     dx
     693      xor      ax,ax
     694      mov      al,[TextPosY]
     695      push     ax
     696
     697      mov      ax,21
     698      mov      dh,dl
     699      and      dh,01111111b
     700      mul      dh
     701      mov      dh,al
     702
     703      mov      [TextPosX],dh
     704
     705      mov   si, offset Disk
     706      call  VideoIO_Print
     707      mov   al,dl
     708
     709      ; NIET GOED, GAAT FOUT > 9, HEX PRINT GEBRUIKEN !!
     710      shr      al,4
     711      add      al,'0'
     712      call     VideoIO_PrintSingleChar
     713      mov      al,dl
     714      and      al,01111111b
     715      add      al,'0'
     716      call     VideoIO_PrintSingleChar
     717      mov      al,'h'
     718      call     VideoIO_PrintSingleChar
     719
     720      inc      [TextPosY]
     721      mov      [TextPosX],dh
     722
     723      mov      al,'-'
     724      mov      cl,17
     725      call     VideoIO_PrintSingleMultiChar
     726
     727      inc      [TextPosY]
     728      mov      [TextPosX],dh
     729      mov      si, offset BiosCyls
     730      call     VideoIO_Print
     731
     732      push     dx
     733      mov      bx,offset BIOS_Cyls
     734      xor      dh,dh
     735      and      dl,01111111b
     736      shl      dx,1
     737      shl      dx,1
     738      add      bx,dx
     739      mov      ax,[bx]
     740      mov      dx,[bx+02]
     741      call     VideoIO_PrintHexDWord
     742      pop      dx
     743
     744      inc      [TextPosY]
     745      mov      [TextPosX],dh
     746      mov      si, offset BiosHeads
     747      call     VideoIO_Print
     748
     749      push     dx
     750      mov      bx,offset BIOS_Heads
     751      xor      dh,dh
     752      and      dl,01111111b
     753      shl      dx,1
     754      shl      dx,1
     755      add      bx,dx
     756      mov      ax,[bx]
     757      mov      dx,[bx+02]
     758      call     VideoIO_PrintHexDWord
     759      pop      dx
     760
     761      inc      [TextPosY]
     762      mov      [TextPosX],dh
     763      mov      si, offset BiosSecs
     764      call     VideoIO_Print
     765
     766      push     dx
     767      mov      bx,offset BIOS_Secs
     768      xor      dh,dh
     769      and      dl,01111111b
     770      shl      dx,1
     771      shl      dx,1
     772      add      bx,dx
     773      mov      ax,[bx]
     774      mov      dx,[bx+02]
     775      call     VideoIO_PrintHexDWord
     776      pop      dx
     777
     778      inc      [TextPosY]
     779      mov      [TextPosX],dh
     780      mov      si, offset LvmSecs
     781      call     VideoIO_Print
     782
     783      push     dx
     784      mov      bx,offset TrueSecs
     785      xor      dh,dh
     786      and      dl,01111111b
     787      shl      dx,1
     788      shl      dx,1
     789      add      bx,dx
     790      mov      ax,[bx]
     791      mov      dx,[bx+02]
     792      call     VideoIO_PrintHexDWord
     793      pop      dx
     794
     795      inc      [TextPosY]
     796      mov      [TextPosX],dh
     797      mov      si, offset BiosLBA
     798      call     VideoIO_Print
     799
     800      push     dx
     801      mov      bx,offset BIOS_TotalSecs
     802      xor      dh,dh
     803      and      dl,01111111b
     804      shl      dx,1
     805      shl      dx,1
     806      shl      dx,1
     807      add      bx,dx
     808      mov      ax,[bx]
     809      mov      dx,[bx+02]
     810      call     VideoIO_PrintHexDWord
     811      pop      dx
     812
     813      inc      [TextPosY]
     814      mov      [TextPosX],dh
     815
     816      pop      ax
     817      mov      [TextPosY],al
     818      pop      dx
     819
     820      inc      dl
     821      mov      al,dl
     822      and      al,01111111b
     823      cmp      al,[TotalHarddiscs]
     824      jae      VideoIO_DumpDiskInfo_end
     825      jmp      VideoIO_DumpDiskInfo_next_disk
     826
     827   VideoIO_DumpDiskInfo_end:
     828      mov      [TextPosX],0
     829      add      [TextPosY],6
     830      ret
     831VideoIO_DumpDiskInfo    EndP
     832
     833
     834
     835; Disk Info to Dump to AB LogScreen
     836Disk:             db "DISK ",0
     837BiosCyls:         db "Cyls    :",0
     838BiosHeads:        db "Heads   :",0
     839BiosSecs:         db "Secs    :",0
     840LvmSecs:          db "SecsLVM :",0
     841BiosLBA:          db "LBA Secs:",0
     842
     843
     844HugeBootDisk:     db "Boot Disk is Huge    : ",0
     845DisksFound:       db "Disks Found          : ",0
     846PartitionsFound:  db "Partitions Found     : ",0
     847;AutoStartPart:    db "Auto Start Partition : ",0
     848
     849Phase1:           db "eCS Install Phase 1  : ",0
     850
     851
     852ShowMenu:         db "Press TAB to return to the AiR-BOOT Menu",0
     853ShowBootLog:      db "Press TAB to see the Boot Log...",0
     854
     855Yes:              db "YES",0
     856No:               db "NO",0
     857On:               db "ON",0
     858Off:              db "OFF",0
     859None:             db "NONE",0
     860Active:           db "ACTIVE",0
     861NotActive:        db "NOT ACTIVE",0
     862
     863; New Line for use by MBR_Teletype
     864NL:         db 0dh, 0ah, 0
  • trunk/BOOTCODE/SETUP/MAIN.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'MAIN',0
     24ENDIF
     25
    2226LocMENU_RoutinePtr           equ          0
    2327LocMENU_VariablePtr          equ          2
     
    6670
    6771SETUP_CheckEnterSETUP           Proc Near   Uses
     72
     73
     74
     75   ; Rousseau: added
     76   ;mov     SETUP_ExitEvent, 0
     77   ;xor     al, al                        ; -PARTITION SETUP PreDefines-
     78   ;mov     PartSetup_UpperPart, al       ; Upper-Partition == 0
     79   ;mov     PartSetup_ActivePart, al      ; Active-Partition == 0
     80
     81   ; Setup PartitionPointers-Table...again (needed when re-entering setup)
     82   ;call    PART_CalculateStraightPartPointers
     83   ;call    VideoIO_DBG_WriteString
     84   ; Rousseau: end added
     85
     86
     87
    6888   test    CFG_AutoEnterSetup, 1
    6989   jnz     SCES_ForceEnter
     
    152172      je      SMT_KeyEsc
    153173      cmp     ah, Keys_F1
    154       je      SMT_KeyHelp
     174      jne   skip_xx
     175      jmp      SMT_KeyHelp
     176   skip_xx:
    155177      cmp     ah, Keys_F10
    156       je      SMT_SaveAndExitNOW
     178      jne   skip_yy
     179      jmp      SMT_SaveAndExitNOW
     180   skip_yy:
    157181      ; ASCII values...
    158182      cmp     al, Keys_Space
     
    264288SETUP_MenuTask                  EndP
    265289
     290
     291
     292CLR_MENU_WINDOW_CLASSIC    = 0e01h
     293CLR_MENU_WINDOW_BM   = 0e01h
    266294;        In: BP - Pointer to Menu
    267295;       Out: DH - Active Item on Screen
    268296SETUP_DrawMenuOnScreen          Proc Near   Uses
    269297   call    SETUP_DrawMenuWindow
    270    mov     cx, 0E01h
     298   mov     cx, CLR_MENU_WINDOW_BM
    271299   call    VideoIO_Color
    272300   xor     ch, ch
     
    294322SETUP_FillUpItemPacks           EndP
    295323
     324
     325
     326CLR_SELECTED_ITEM_CLASSIC  = 0f04h
     327CLR_SELECTED_ITEM_BM = 0f04h
    296328; Displays selected Item on screen
    297329;        In: DH - Active Item
    298330; Destroyed: None
    299331SETUP_DrawSelectItem            Proc Near Uses cx
    300    mov     cx, 0F04h
     332   mov     cx, CLR_SELECTED_ITEM_BM
    301333   call    VideoIO_Color
    302334   mov     ch, dh
     
    305337SETUP_DrawSelectItem            EndP
    306338
     339
     340CLR_DESELECTED_ITEM_CLASSIC  = 0e01h
     341CLR_DESELECTED_ITEM_BM  = 0e01h
    307342; Display last-selected Item on screen (De-Select)
    308343;        In: DL - Active Item
    309344; Destroyed: None
    310345SETUP_DrawDeSelectItem          Proc Near Uses cx
    311    mov     cx, 0E01h
     346   mov     cx, CLR_DESELECTED_ITEM_BM
    312347   call    VideoIO_Color
    313348   mov     ch, dl
     
    356391   mov     wptr TextColorFore, dx
    357392   ret
    358          
     393
    359394   ; ------------------------------------------------------ Draw ITEMPACK
    360395  SDIOS_ItemPackDraw:
     
    368403        SDIOS_ItemPack_NoFixUpItemPack:
    369404         call    VideoIO_Locate
    370          mov     cx, 0F01h
     405
     406CLR_ITEM_PACK_CLASSIC   = 0f01h
     407CLR_ITEM_PACK_BM  = 0f01h
     408
     409         mov     cx, CLR_ITEM_PACK_BM
    371410         call    VideoIO_Color           ; White on blue background
    372411         mov     si, ds:[si+LocMENU_ItemNamePtr] ; SI - Name of Item
     
    418457   ret
    419458SETUP_FillUpItemPack_Now        EndP
     459
     460
    420461
    421462SETUP_DrawMenuWindow            Proc Near   Uses es
     
    474515   mov     cl, CopyrightVersionLen
    475516   call    VideoIO_FixedPrint            ; and 'vX.XX'.
    476    add     si, 3
     517
     518   ; Rousseau:
     519   ; Strange, had to adjust this value.
     520   ; Somewhere some offset changed...
     521   ; Possibly happened with the movzx change to 286 instructions because some
     522   ; offsets are hard coded.
     523   ;add     si, 3
     524   add     si, 2
     525
    477526   call    GetLenOfString                ; CX - Len of "Copyright" string
    478527   mov     dx, cx
     
    871920   mov     si, di                        ; DS:SI - Current Password
    872921   xor     dl, dl
    873    ; DL - location of cursor (first=0)         
     922   ; DL - location of cursor (first=0)
    874923  SLEP_Loop:
    875924   mov     cx, EnterPwd_Location
     
    910959   cmp     dl, 8
    911960   je      SLEP_SkipThiz
    912    movzx   bx, dl
     961
     962   ;movzx   bx, dl
     963   mov   bl,dl
     964   mov   bh,0
     965
    913966   mov     ds:[si+bx], al
    914967   mov     al, 42                        ; fixed star :]
     
    920973   je      SLEP_SkipThiz
    921974   dec     dl
    922    movzx   bx, dl
     975
     976   ;movzx   bx, dl
     977   mov   bl,dl
     978   mov   bh,0
     979
    923980   mov     al, 32
    924981   mov     ds:[si+bx], al
     
    10981155   jz      SMICTN_NoFiller
    10991156   dec     al
    1100    movzx   cx, al
     1157
     1158   ;movzx   cx, al
     1159   mov   cl,al
     1160   mov   ch,0
     1161
    11011162   xor     al, al
    11021163   rep     stosb                         ; and fill up with NULs, if required
     
    15231584  SMCBBS_Enabled:
    15241585   dec     dl
    1525    movzx   bx, dl
     1586
     1587   ;movzx   bx, dl
     1588   mov   bl,dl
     1589   mov   bh,0
     1590
    15261591   shl     bx, 1
    15271592   mov     si, wptr [ContinueBIOSbootTable+bx]
  • trunk/BOOTCODE/SETUP/MENUS.ASM

    r29 r30  
    5555;
    5656
     57IFDEF ModuleNames
     58DB 'MENUS',0
     59ENDIF
     60
    5761LocMENU_LenOfMenuPtrBlock    equ          8
    5862LocMENU_LenOfItemPack        equ         12
     
    6367LocMENU_ItemPack             equ          8 ; only if VariablePtr>0
    6468
    65 SETUP_MainMenu: 
     69SETUP_MainMenu:
    6670                db      0                ; Where Current Item will get saved
    6771                dw      offset TXT_SETUPHELP_MAIN ; Pointer to help information
     
    209213                dw      offset TXT_SETUP_IgnoreLVM, offset TXT_SETUPHELP_IgnoreLVM
    210214                dw      6 dup (0)
    211                 dw      offset SETUPMAGIC_EnableDisable, offset CFG_ForceLBAUsage
     215                dw      offset SETUPMAGIC_EnableDisable, offset CFG_ForceLBAUsage            ; Rousseau: LBA
    212216                dw      offset TXT_SETUP_ForceLBAUsage, offset TXT_SETUPHELP_ForceLBAUsage
    213217                dw      6 dup (0)
  • trunk/BOOTCODE/SETUP/PART_SET.ASM

    r29 r30  
    1919;                                          AiR-BOOT SETUP / PARTITION SETUP
    2020;---------------------------------------------------------------------------
     21
     22IFDEF ModuleNames
     23DB 'PART_SET',0
     24ENDIF
    2125
    2226; This here is called from Menu in AIR-BSET.asm
     
    5862      je      PSM_KeyVIBRdetection
    5963      cmp     al, TXT_SETUP_FlagLetterHide
    60       je      PSM_KeyHiddenSetup
     64
     65      jne   skip_x
     66      jmp      PSM_KeyHiddenSetup
     67   skip_x:
    6168      cmp     al, TXT_SETUP_FlagLetterDrvLetter
    62       je      PSM_KeyDriveLetterForceSetup
     69
     70      jne   skip_y
     71      jmp      PSM_KeyDriveLetterForceSetup
     72   skip_y:
     73
    6374      cmp     al, TXT_SETUP_FlagLetterExtMShack
    64       je      PSM_KeyDriveLetterExtMShack
     75      jne   skip_z
     76      jmp      PSM_KeyDriveLetterExtMShack
     77   skip_z:
    6578      jmp     PSM_MainLoop
    6679
     
    331344   inc     al
    332345   call    VideoIO_PrintByteNumber
    333    
     346
    334347   ; Display "No Hd" field aka "01/01"
    335348   call    VideoIO_Locate
     
    426439   call    PARTSETUP_ReColorPart
    427440
    428    ; Running Fixing 
     441   ; Running Fixing
    429442   cmp     dh, 0FFh
    430443   jne     PSBCB_NoUnderflow
     
    558571   ;  This is done for security purposes, because if they match, we will update
    559572   ;  the name in both - IPT and BR/LVM.
    560    movzx   bx, dl
     573
     574   ;movzx   bx, dl
     575   mov   bl,dl
     576   mov   bh,0
     577
    561578   cmp     [PartitionVolumeLetters+bx], 0 ; ==0 means not supported by LVM
    562579   je      PSCPN_NotLVMSupported
     
    638655
    639656   ; Check, where to save 2nd destination to...
    640    movzx   bx, dl
     657
     658   ;movzx   bx, dl
     659   mov   bl,dl
     660   mov   bh,0
     661
    641662   cmp     [PartitionVolumeLetters+bx], 0 ; ==0 means not supported by LVM
    642663   je      PSCPN_SaveBootRecord
     
    775796PARTHIDESETUP_DrawMenuBase      Proc Near   Uses dx
    776797   ; PartSetup_HiddenX1
    777    mov     cx, 0D05h                     ; Lila on lila
     798
     799CLR_PART_HIDE_WINDOW_BASE_CLASSIC   = 0d05h
     800CLR_PART_HIDE_WINDOW_BASE_BM   = 0a02h
     801
     802   mov     cx, CLR_PART_HIDE_WINDOW_BASE_BM                    ; Lila on lila
    778803   call    VideoIO_Color
    779804   mov     bh, 05h
     
    792817   mov     al, 'µ'
    793818   call    VideoIO_PrintSingleChar
    794    mov     cx, 0E05h                     ; Yellow on Lila
     819
     820CLR_PART_HIDE_WINDOW_LABEL_CLASSIC = 0e05h
     821CLR_PART_HIDE_WINDOW_LABEL_BM = 0e02h
     822
     823   mov     cx, CLR_PART_HIDE_WINDOW_LABEL_BM                     ; Yellow on Lila
    795824   call    VideoIO_Color
    796825   mov     si, offset TXT_SETUP_HideFeature
    797826   call    VideoIO_Print
    798    mov     cx, 0D05h                     ; Lila on lila
     827
     828CLR_PART_HIDE_WINDOW_BORDER_CLASSIC = 0d05h
     829CLR_PART_HIDE_WINDOW_BORDER_BM = 0d02h
     830
     831
     832   mov     cx, CLR_PART_HIDE_WINDOW_BORDER_BM                     ; Lila on lila
    799833   call    VideoIO_Color
    800834   mov     al, 'Æ'
     
    851885
    852886   ; --- Make ':' Line down
    853    mov     cx, 0F05h                     ; Yellow on Lila
     887
     888CLR_PART_HIDE_MENU_BASE_CLASSIC  = 0f05h
     889CLR_PART_HIDE_MENU_BASE_BM  = 0f02h
     890
     891   mov     cx, CLR_PART_HIDE_MENU_BASE_BM                     ; Yellow on Lila
    854892   call    VideoIO_Color
    855893   mov     ch, 07h
     
    873911   dec     dh
    874912   jnz     PHSRP_Loop
     913
     914CLR_PART_HIDE_MENU_MARKERS_CLASSIC = 0d05h
     915CLR_PART_HIDE_MENU_MARKERS_BM = 0a02h
     916
    875917   ; At last calculate Scroll-Markers
    876    mov     cx, 0D05h                     ; Lila on lila
     918   mov     cx, CLR_PART_HIDE_MENU_MARKERS_BM                     ; Lila on lila                          ; Hide Feature Markers
    877919   call    VideoIO_Color
    878920   mov     cx, 0603h                     ; 6, +3
     
    919961   push    cx
    920962      ; Display "Label" field aka "OS2" without ending NULs/Spaces
    921       mov     cx, 0F05h
     963
     964CLR_PART_HIDE_LABEL_CLASSIC   = 0f05h
     965CLR_PART_HIDE_LABEL_BM = 0f02h
     966
     967      mov     cx, CLR_PART_HIDE_LABEL_BM
    922968      call    VideoIO_Color              ; Bright White on Lila
    923969      push    si
     
    927973         call    VideoIO_FixedPrint
    928974      pop     si
    929       mov     cx, 0D05h
     975
     976CLR_PART_HIDE_WINDOW_FS_CLASSIC   = 0d05h
     977CLR_PART_HIDE_WINDOW_FS_BM = 0a02h
     978
     979      mov     cx, CLR_PART_HIDE_WINDOW_FS_BM
    930980      call    VideoIO_Color              ; Bright Lila on Lila
    931981      mov     al, ' '
     
    948998   call    VideoIO_Locate
    949999   push    cx
    950       mov     cx, 0E05h
     1000
     1001CLR_PART_HIDE_WINDOW_CHOISES_CLASSIC   = 0e05h
     1002CLR_PART_HIDE_WINDOW_CHOISES_BM   = 0e02h
     1003
     1004      mov     cx, CLR_PART_HIDE_WINDOW_CHOISES_BM
    9511005      call    VideoIO_Color              ; Yellow on Lila
    9521006      mov     al, ' '
     
    9801034  PHSBCB_SkipRetrace:
    9811035
     1036CLR_PART_HIDE_WINDOW_MENU_BAR_CLASSIC  = 5eh
     1037CLR_PART_HIDE_WINDOW_MENU_BAR_BM = 2eh
     1038
    9821039   ; Deactivate current active bar
    983    mov     cl, 5Eh                       ; Yellow on Lila
     1040   mov     cl, CLR_PART_HIDE_WINDOW_MENU_BAR_BM                       ; Yellow on Lila
    9841041   call    PARTHIDESETUP_ReColorPart
    9851042
    986    ; Running Fixing 
     1043   ; Running Fixing
    9871044   cmp     dh, 0FFh
    9881045   jne     PHSBCB_NoUnderflow
     
    10151072
    10161073   ; Activate fresh active bar
    1017    mov     cl, 1Fh                       ; Bright White on Blue
     1074
     1075CLR_PART_HIDE_WINDOW_MENU_ACTIVE_BAR_CLASSIC = 1fh
     1076CLR_PART_HIDE_WINDOW_MENU_ACTIVE_BAR_BM   = 1fh
     1077
     1078   mov     cl, CLR_PART_HIDE_WINDOW_MENU_ACTIVE_BAR_BM                       ; Bright White on Blue
    10181079   call    PARTHIDESETUP_ReColorPart
    10191080   ; Now DL==DH
     
    11781239
    11791240   ; Now get the Logical-Drive-Letter for that partition...
    1180    movzx   bx, dl
     1241   ;movzx   bx, dl
     1242   mov   bl,dl
     1243   mov   bh,0
     1244
    11811245   mov     dl, bptr [DriveLetters+bx]
    11821246
     
    12641328
    12651329   ; Draw base-window
    1266    mov     cx, 0D05h                     ; Lila on lila
     1330
     1331CLR_PART_DL_XX_CLASSIC = 0d05h
     1332CLR_PART_DL_XX_BM = 0a02h
     1333
     1334   mov     cx, CLR_PART_DL_XX_BM                     ; Lila on lila
    12671335   call    VideoIO_Color
    12681336   mov     bh, 06h
     
    12811349      mov     al, 'µ'
    12821350      call    VideoIO_PrintSingleChar
    1283       mov     cx, 0E05h                  ; Yellow on Lila
     1351
     1352CLR_PART_DL_WINDOW_TITLE_CLASSIC  = 0e05h
     1353CLR_PART_DL_WINDOW_TITLE_BM  = 0e02h
     1354
     1355      mov     cx, CLR_PART_DL_WINDOW_TITLE_BM                  ; Yellow on Lila
    12841356      call    VideoIO_Color
    12851357      mov     si, offset TXT_SETUP_DriveLetter
    12861358      call    VideoIO_Print
    1287       mov     cx, 0D05h                  ; Lila on lila
     1359
     1360CLR_PART_DL_WINDOW_BORDER2_CLASSIC  = 0d05h
     1361CLR_PART_DL_WINDOW_BORDER2_BM  = 0a02h
     1362
     1363      mov     cx, CLR_PART_DL_WINDOW_BORDER2_BM                 ; Lila on lila
    12881364      call    VideoIO_Color
    12891365      mov     al, 'Æ'
     
    12921368   ; Display help-information
    12931369   mov     si, offset TXT_SETUPHELP_DriveLetter
    1294    mov     cx, 0D05h                     ; Lila on lila
     1370
     1371CLR_PART_DL_SETUP_HELP_CLASSIC = 0d05h
     1372CLR_PART_DL_SETUP_HELP_BM = 0a02h
     1373
     1374
     1375   mov     cx, CLR_PART_DL_SETUP_HELP_BM                     ; Lila on lila
    12951376   call    VideoIO_Color
    12961377
     
    13061387   mov     al, '>'
    13071388   call    VideoIO_PrintSingleChar
    1308    ; 
     1389   ;
    13091390   mov     cx, 0F01h                     ; Bright White on Blue
    13101391   call    VideoIO_Color
  • trunk/BOOTCODE/SPECIAL/APM.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'APM',0
     24ENDIF
     25
    2226; Here is APM Code to turn off the computer
    2327
  • trunk/BOOTCODE/SPECIAL/F00K/BILLSUXX.ASM

    r29 r30  
    2727; Here is code to change Extended Partition to Type 05h or 0Fh depending
    2828;  on the partition's P-flag including the overall M$hack-Enable Flag.
     29
     30IFDEF ModuleNames
     31DB 'BILLSUXX',0
     32ENDIF
     33
    2934MSHACK_ProcessPartTables        Proc Near  Uses ax dx di
    3035   ; Check Overall M$-Hack Enable
  • trunk/BOOTCODE/SPECIAL/FAT16.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'FAT16',0
     24ENDIF
     25
    2226; Here is access code for accessing FAT-16 partitions. It's not a complete
    2327;  File-API and only for simple readonly-access.
     
    2731;        I did not want to code silly cylinder stuff here. I have also used
    2832;        i386 code in here, because Linux requires so as well. Please note that
    29 ;        I don't use i386 code anywhere (!) else in AiR-BOOT.
    30 ;
     33;        I don't use i386 code anywhere (!) else in AiR-BOOT.                    ; Rousseau: yes you did, movezx is 386-only :-)
     34;                                                                                ; Replaced by 286 instructions.
    3135; Initialize FAT-16 access on specified partition (required for following xs)
    3236;        In: DS:SI - IPT-Entry that contains a FAT-16 partition
     
    131135      mov    ax, dx
    132136      sub    ax, 2                       ; Everything starts at Cluster 2
    133       movzx  bx, FAT16_SecsPerCluster
     137      ;movzx  bx, FAT16_SecsPerCluster
     138      mov   bl,FAT16_SecsPerCluster
     139      mov   bh,0
     140
    134141      mul    bx
    135142      shl    edx, 16
     
    145152   add    di, ax
    146153   ; Finally, look for next Cluster following to this one...
    147    movzx  bx, dl
     154   ;movzx  bx, dl
     155   mov   bl,dl
     156   mov   bh,0
     157
    148158   shl    bx, 1                          ; BX - Offset within FAT-Table
    149159   shr    dx, 8                          ; DX - FAT-Sector
     
    259269         pop       ax
    260270         mov    dx, si
    261          movzx  cx, ah
     271         ;movzx  cx, ah
     272         mov   cl,ah
     273         mov   ch,0
     274
    262275         rep    movsb
    263276         mov    si, dx                   ; Restore SI
  • trunk/BOOTCODE/SPECIAL/FX.ASM

    r29 r30  
    1919;                                                            AiR-BOOT / F/X
    2020;---------------------------------------------------------------------------
     21
     22IFDEF ModuleNames
     23DB 'FX',0
     24ENDIF
    2125
    2226; There you go. Some nice old-school demo coder effects :)
     
    268272      cmp     di, FX_MaxScanLine
    269273      jb      FX_MCS_VerticalLoop
    270  
     274
    271275      mov     ax, FX_CooperBarsTimer
    272276      dec     ax
     
    386390     FX_CC_ActiveState:
    387391      ; increment SinusPos by 1
    388       movzx   bx, bptr ds:[FX_SinusPos+si]
     392      ;movzx   bx, bptr ds:[FX_SinusPos+si]
     393      mov   bl,bptr ds:[FX_SinusPos+si]
     394      mov   bh,0
     395
    389396      inc     bx
    390397      mov     bptr ds:[FX_SinusPos+si], bl
     
    409416FX_CalculateWideScroller        Proc Near   Uses
    410417   mov     bx, FX_WideScrollerCurPos
    411    movzx   cx, FX_WideScrollerSpeed
     418   ;movzx   cx, FX_WideScrollerSpeed
     419   mov   cl,FX_WideScrollerSpeed
     420   mov   ch,0
     421
    412422   test    FX_WideScrollerAbsDirection, 1
    413423   jnz     FXCWS_RIGHT
  • trunk/BOOTCODE/SPECIAL/FXTABLES.ASM

    r29 r30  
    2020;---------------------------------------------------------------------------
    2121
     22IFDEF ModuleNames
     23DB 'FXTABLES',0
     24ENDIF
     25
    2226; Sinus-Table - 128xWORD = 256 Bytes
    2327FX_SinusTab dw 00101h, 00102h, 00103h, 00105h, 00107h, 0010Ah, 0010Dh, 00111h
  • trunk/BOOTCODE/SPECIAL/LINUX.ASM

    r29 r30  
    4040;  some nice menus, setup, text, cyrillic support, demo-coder effects, easy
    4141;  handling, help, auto-detection and plenty of other stuff INTO AROUND 25k.
    42 ; 
     42;
    4343; Oh, why is this code here? Because of 2 friends of mine. Otherwise I wouldnt
    4444;  have done it as well as fat16.asm.
     45
     46IFDEF ModuleNames
     47DB 'LINUX',0
     48ENDIF
    4549
    4650Linux_TranslateBase     db '/dev/hd'
     
    217221   mov     dx, ds:[si+LocIPT_LocationBegin]
    218222   ; from now on, we don't need si anymore
    219    
     223
    220224   ; Linux has 1 'BR' (which is crap) and some setup sectors
    221225   ; we load them at 9000:0, what a luck, we are at 8000:0 :-))
     
    342346   jz      LLL_LoadNormalKernel
    343347   jmp     LLL_LoadBigKernel
    344          
     348
    345349  LLL_LoadNormalKernel:
    346350   ; NORMAL KERNEL
     
    458462                        dw          0
    459463                        dw          0FFFFh
    460 MBR_Linux_GDT_Dst       db          0, 0, 10h    ; Dest is "10000:0" 
     464MBR_Linux_GDT_Dst       db          0, 0, 10h    ; Dest is "10000:0"
    461465                        db          093h
    462466                        dw          0
  • trunk/BOOTCODE/SPECIAL/LVM.ASM

    r29 r30  
    1919;                                                            AiR-BOOT / LVM
    2020;---------------------------------------------------------------------------
     21
     22IFDEF ModuleNames
     23DB 'LVM',0
     24ENDIF
    2125
    2226LVM_InitCRCTable                Proc Near   Uses
     
    2529   mov    di, offset LVM_CRCTable
    2630  LVM_ICRCT_Loop:
    27       movzx  ax, cl
     31      ;movzx  ax, cl
     32      mov   al,cl
     33      mov   ah,0
     34
    2835      xor    dx, dx                      ; DX:AX - CRC-Value
    2936      mov    ch, 8
     
    8693   test    [CFG_IgnoreLVM], 1            ; We are supposed to ignore LVM, so
    8794   jnz     LVMCSS_InvalidSignature       ;  any sector is bad!
    88    cmp     wptr [si+LocLVM_SignatureStart], 5202h
     95   cmp     wptr [si+LocLVM_SignatureStart], 5202h                                ; Rousseau: identify LVM sector
    8996   jne     LVMCSS_InvalidSignature
    9097   cmp     wptr [si+LocLVM_SignatureStart+2], 'BM'
  • trunk/BOOTCODE/SPECIAL/SOUND.ASM

    r29 r30  
    1919;                                                  AiR-BOOT / SOUND SUPPORT
    2020;---------------------------------------------------------------------------
     21
     22IFDEF ModuleNames
     23DB 'SOUND',0
     24ENDIF
    2125
    2226; Here is some sound code. Requested by Hex1753.
     
    108112   ret
    109113SOUND_WaitToSilence            EndP
     114
     115
     116
     117; Rousseau: added
     118SOUND_Beep                     PROC Near
     119   pushf
     120   pusha
     121
     122   mov      al, 7
     123   mov      bh, 0
     124   mov      bl, 7
     125   mov      ah, 0eh
     126   int      10h
     127
     128   popa
     129   popf
     130   ret
     131SOUND_Beep                     ENDP
  • trunk/BOOTCODE/SPECIAL/VIRUS.ASM

    r29 r30  
    2323; system will get halted. On Non-Real-Mode this will only save Interrupt Vectors.
    2424; Segment Registers preserved
     25
     26IFDEF ModuleNames
     27DB 'VIRUS',0
     28ENDIF
     29
    2530VIRUS_CheckForStealth      Proc Near  Uses ds si es di
    2631   xor     al, al
     
    154159   mov     bx, BootBasePtr
    155160   mov     dx, 0080h
    156    mov     cx, 003Ch                     ; First Harddrive, Sector 60
     161   ;mov     cx, 003Ch                     ; First Harddrive, Sector 60
     162   mov     cx, image_size / sector_size  ; Harddisc 0, Sector 60 (or 62 for extended version)
    157163   mov     ax, 0301h                     ; Write 1 Sector
    158164   int     13h
     
    166172   mov     bx, offset TmpSector
    167173   mov     dx, 0080h
    168    mov     cx, 003Ch                     ; Harddisc 0, Sector 60
     174   ;mov     cx, 003Ch                     ; Harddisc 0, Sector 60
     175   mov     cx, image_size / sector_size  ; Harddisc 0, Sector 60 (or 62 for extended version)
    169176   mov     ax, 0201h                     ; Load 1 Sector
    170177   pushf
  • trunk/BOOTCODE/TEXT/EN/OTHER.ASM

    r29 r30  
    5252;----------------------------------|----------------------------|
    5353TXT_BootMenuEnterSetup         db 'F10 to enter Setup', 0
     54;TXT_BootMenuEnterBootLog       db 'TAB to enter Boot Log', 0
    5455
    5556; Dynamic Length (till 80 chars)
     
    6162                               db 13, 10, '   Press any key to continue...', 0
    6263
    63 TXT_VirusFoundMain:            db 13, 10, ' - !ATTENTION! -> A VIRUS WAS FOUND <- !ATTENTION!', 13, 10, 0
     64TXT_VirusFoundMain:            db 13, 10, ' - !ATTENTION! -> A V1RU5 WAS FOUND <- !ATTENTION!', 13, 10, 0
    6465TXT_VirusFound1ok:             db '    It got squashed, but the system may not reboot correctly. If this happens,', 13, 10
    6566                               db '    use your AiR-BOOT system disc.', 13, 10, 0
  • trunk/ENV/DOS.BAT

    r29 r30  
    11rem This file sets Assembler, Linker and EXE2BIN for DOS environment
    2 set assembler=tasm.exe /m9 /dReal /t
     2set assembler=tasm.exe /m9 /dReal /l
     3rem set assembler=tasm.exe /m9 /dReal /t
    34set linker=tlink.exe /3 /x
    45set exe2bin=exe2bin.exe
  • trunk/INCLUDE/ASM.INC

    r29 r30  
    3636
    3737; Shortcuts for pointer-types
    38 bptr                            equ   byte ptr
    39 wptr                            equ   word ptr
    40 dptr                            equ  dword ptr
    41 qptr                            equ  qword ptr
    42 tptr                            equ  tbyte ptr
     38bptr                             equ   byte ptr
     39wptr                             equ   word ptr
     40dptr                             equ  dword ptr
     41qptr                             equ  qword ptr
     42tptr                             equ  tbyte ptr
     43
     44
     45sector_size                      equ   512
     46image_size_60secs                equ   7800h
     47image_size_62secs                equ   7c00h
     48
     49;image_size                       equ   image_size_60secs
     50image_size                       equ   image_size_62secs
     51
     52sector_count                     equ   image_size / sector_size                  ; Image size in sectors
     53
     54IF image_size EQ image_size_60secs
     55   partition_count               equ   30                                        ; Maximum number of partitions supported
     56ELSE
     57   partition_count               equ   45                                        ; Maximum number of partitions supported
     58ENDIF
  • trunk/INSTALL/C/INST-OS2.TGT

    r29 r30  
    22225
    2323MCommand
    24 67
    25 copy inst-os2.exe ..\..\RELEASE\OS2\airboot2.exe
     24131
     25@ren INST-OS2.EXE INST-OS2.XEX
     26@ren INST-OS2.XEX INST-OS2.EXE
     27copy INST-OS2.EXE ..\..\RELEASE\OS2\AIRBOOT2.EXE
    2628del install.obj
    2729
     
    2931MItem
    303212
    31 inst-os2.exe
     33INST-OS2.EXE
    32347
    3335WString
     
    36388
    3739WVList
    38 2
     404
    39419
    40 MCState
     42MVState
    414310
    4244WString
     
    454711
    4648WString
     4922
     50?????Other options(,):
     510
     5212
     53WString
     5419
     55op map=INST-OS2.MAP
     560
     5713
     58MVState
     5914
     60WString
     617
     62OS2LINK
     6315
     64WString
     6522
     66?????Other options(,):
     671
     6816
     69WString
     7019
     71op map=INST-OS2.MAP
     720
     7317
     74MCState
     7518
     76WString
     777
     78OS2LINK
     7919
     80WString
    478113
    4882?????Map file
    49831
    50840
    51 12
     8520
    5286MCState
    53 13
     8721
    5488WString
    55897
    5690OS2LINK
    57 14
     9122
    5892WString
    599324
     
    61951
    62960
    63 15
     9723
     98WVList
     991
     10024
     101ActionStates
     10225
     103WString
     1045
     105&Make
     10626
    64107WVList
    651080
     
    681111
    691120
    70 16
     11327
    71114WPickList
    721152
    73 17
     11628
    74117MItem
    751183
    76119*.c
    77 18
     12029
    78121WString
    791224
    80123COBJ
    81 19
     12430
    82125WVList
    831260
    84 20
     12731
    85128WVList
    861290
     
    891321
    901330
    91 21
     13432
    92135MItem
    931369
    94 install.c
    95 22
     137INSTALL.C
     13833
    96139WString
    971404
    98141COBJ
    99 23
     14234
    100143WVList
    1011440
    102 24
     14535
    103146WVList
    1041470
    105 17
     14828
    1061491
    1071501
  • trunk/INSTALL/C/INST-WIN.TGT

    r29 r30  
    22225
    2323MCommand
    24 69
    25 copy inst-win.exe ..\..\RELEASE\WINNT\airbootw.exe
     24133
     25@ren INST-WIN.EXE INST-WIN.XEX
     26@ren INST-WIN.XEX INST-WIN.EXE
     27copy INST-WIN.EXE ..\..\RELEASE\WINNT\AIRBOOTW.EXE
    2628del install.obj
    2729
     
    2931MItem
    303212
    31 inst-win.exe
     33INST-WIN.EXE
    32347
    3335WString
     
    36388
    3739WVList
    38 2
     404
    39419
    40 MCState
     42MVState
    414310
    4244WString
     
    454711
    4648WString
     4922
     50?????Other options(,):
     510
     5212
     53WString
     5419
     55op map=INST-WIN.MAP
     560
     5713
     58MVState
     5914
     60WString
     617
     62WINLINK
     6315
     64WString
     6522
     66?????Other options(,):
     671
     6816
     69WString
     7019
     71op map=INST-WIN.MAP
     720
     7317
     74MCState
     7518
     76WString
     777
     78WINLINK
     7919
     80WString
    478113
    4882?????Map file
    49831
    50840
    51 12
     8520
    5286MCState
    53 13
     8721
    5488WString
    55897
    5690WINLINK
    57 14
     9122
    5892WString
    599324
     
    61951
    62960
    63 15
     9723
    6498WVList
    65 1
    66 16
     992
     10024
    67101ActionStates
    68 17
     10225
    69103WString
    701045
    71105&Make
    72 18
     10626
     107WVList
     1080
     10927
     110ActionStates
     11128
     112WString
     1134
     114&Run
     11529
    73116WVList
    741170
     
    771201
    781210
    79 19
     12230
    80123WPickList
    811242
    82 20
     12531
    83126MItem
    841273
    85128*.c
    86 21
     12932
    87130WString
    881314
    89132COBJ
    90 22
     13333
    91134WVList
    921350
    93 23
     13634
    94137WVList
    951380
     
    981411
    991420
    100 24
     14335
    101144MItem
    1021459
    103 install.c
    104 25
     146INSTALL.C
     14736
    105148WString
    1061494
    107150COBJ
    108 26
     15137
    109152WVList
    1101530
    111 27
     15438
    112155WVList
    1131560
    114 20
     15731
    1151581
    1161591
  • trunk/INSTALL/C/INSTALL.C

    r29 r30  
    2525   #include <os2.h>
    2626   #include <malloc.h>
     27   #include <stdlib.h>                                                           // Rousseau: added to use getenv()
    2728   #define PLATFORM_OS2
    2829#elif defined(__NT__)
     
    3940
    4041
    41 #define STATUS_NOTINSTALLED 0 // No ID found
    42 #define STATUS_CORRUPT      1 // ID found, Checksum failure
    43 #define STATUS_INSTALLED    2 // ID found, Checksum valid
    44 #define STATUS_INSTALLEDMGU 3 // ID found, Checksum valid, may get updated
    45 #define STATUS_IMPOSSIBLE   4 // Unable/Not willing to install
     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
     58
     59
    4660
    4761// ============================================================================
    4862//  Variables
    4963// ============================================================================
    50 CHAR   Track0[60*512];   // current track 0 from harddrive
    51 CHAR   Bootcode[60*512]; // bootcode image from airboot.bin
     64CHAR   Track0[SECTOR_COUNT * BYTES_PER_SECTOR];                                  // current track 0 from harddrive
     65CHAR   Bootcode[SECTOR_COUNT * BYTES_PER_SECTOR];                                // bootcode image from airboot.bin
    5266
    5367UCHAR  Bootcode_LanguageID    = ' ';
     
    6478BOOL   Option_ForceConfig      = FALSE;
    6579BOOL   Option_Silent           = FALSE;
     80
     81BOOL   Option_CID              = FALSE;                                          // Rousseau: added
    6682
    6783BOOL   Install_Code            = FALSE;
     
    86102   USHORT OS2_GetIOCTLHandle () {
    87103      USHORT IOCTLHandle = 0;
    88  
     104
    89105      if (DosPhysicalDisk(INFO_GETIOCTLHANDLE, &IOCTLHandle, sizeof(IOCTLHandle),"1:" , 3) != 0)
    90106         return 0;
     
    114130         AutoDriveLetter       = BootDrive+0x7D;
    115131         AutoDriveLetterSerial = InfoLevel2.ulVSN;
    116 printf("%X\n", InfoLevel2.ulVSN);
     132         if (!Option_CID) {
     133            printf("%X\n", InfoLevel2.ulVSN);
     134         }
    117135       }
    118136    }
     
    122140      USHORT               SectorsPerTrack = 0;
    123141      DEVICEPARAMETERBLOCK DeviceParmBlock;
    124       ULONG                ulDataLength; 
     142      ULONG                ulDataLength;
    125143
    126144      IOCTLHandle = OS2_GetIOCTLHandle();
     
    129147         SectorsPerTrack = DeviceParmBlock.cSectorsPerTrack;
    130148      OS2_FreeIOCTLHandle (IOCTLHandle);
    131       if (SectorsPerTrack>61) return TRUE;
     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 !!
    132151      // OS/2 is only able to support 512-byte/sector media, so we dont need to check this
    133152      return FALSE;
     
    136155   BOOL Track0Load (void) {
    137156      USHORT      IOCTLHandle;
    138       ULONG       TrackLayoutLen  = sizeof(TRACKLAYOUT)+sizeof(ULONG)*(60-1);
     157      ULONG       TrackLayoutLen  = sizeof(TRACKLAYOUT)+sizeof(ULONG)*(SECTOR_COUNT-1);
    139158      TRACKLAYOUT *TrackLayoutPtr = malloc(TrackLayoutLen);
    140159      ULONG       cbParms = sizeof(TrackLayoutPtr);
    141       ULONG       cbData  = 512;
     160      ULONG       cbData  = BYTES_PER_SECTOR;
    142161      int         i;
    143162      BOOL        Success = FALSE;
     
    149168      TrackLayoutPtr->usCylinder    = 0;
    150169      TrackLayoutPtr->usFirstSector = 0;
    151       TrackLayoutPtr->cSectors      = 60;
    152 
    153       for (i=0; i<60; i++) {
     170      TrackLayoutPtr->cSectors      = SECTOR_COUNT;
     171
     172      for (i=0; i<SECTOR_COUNT; i++) {
    154173         TrackLayoutPtr->TrackTable[i].usSectorNumber = i+1;
    155          TrackLayoutPtr->TrackTable[i].usSectorSize   = 512;
     174         TrackLayoutPtr->TrackTable[i].usSectorSize   = BYTES_PER_SECTOR;
    156175       }
    157176
     
    166185   BOOL Track0Write (void) {
    167186      USHORT      IOCTLHandle;
    168       ULONG       TrackLayoutLen  = sizeof(TRACKLAYOUT)+sizeof(ULONG)*(60-1);
     187      ULONG       TrackLayoutLen  = sizeof(TRACKLAYOUT)+sizeof(ULONG)*(SECTOR_COUNT-1);
    169188      TRACKLAYOUT *TrackLayoutPtr = malloc(TrackLayoutLen);
    170189      ULONG       cbParms = sizeof(TrackLayoutPtr);
    171       ULONG       cbData  = 512;
     190      ULONG       cbData  = BYTES_PER_SECTOR;
    172191      INT         i;
    173192      BOOL        Success = FALSE;
     
    180199      TrackLayoutPtr->usCylinder    = 0;
    181200      TrackLayoutPtr->usFirstSector = 0;
    182       TrackLayoutPtr->cSectors      = 60;
    183 
    184       for (i=0; i<60; i++) {
     201      TrackLayoutPtr->cSectors      = SECTOR_COUNT;
     202
     203      for (i=0; i<SECTOR_COUNT; i++) {
    185204         TrackLayoutPtr->TrackTable[i].usSectorNumber = i+1;
    186          TrackLayoutPtr->TrackTable[i].usSectorSize   = 512;
     205         TrackLayoutPtr->TrackTable[i].usSectorSize   = BYTES_PER_SECTOR;
    187206       }
    188207
     
    218237      GetVersionEx(&Version);
    219238      if (Version.dwPlatformId == VER_PLATFORM_WIN32_NT) return TRUE;
    220       printf(" - This installer is for WindowsNT family only.\n");
    221       printf("    Please use DOS installer for Windows9x.\n");
     239      if (!Option_CID) {
     240         printf(" - This installer is for WindowsNT family only.\n");
     241         printf("    Please use DOS installer for Windows9x.\n");
     242      }
    222243      return FALSE;
    223244    }
     
    231252      CloseHandle(IOCTLHandle);
    232253    }
    233  
     254
    234255   USHORT CountHarddrives (void) {
    235256      return 1;
     
    246267         SectorsPerTrack = Geometry.SectorsPerTrack;
    247268      WINNT_FreeIOCTLHandle(IOCTLHandle);
    248       if (SectorsPerTrack>61) return TRUE;
     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 !!
    249271      return FALSE;
    250272    }
     
    257279      IOCTLHandle = WINNT_GetIOCTLHandle();
    258280      SetFilePointer(IOCTLHandle, 0, 0, FILE_BEGIN);
    259       if (ReadFile(IOCTLHandle, &Track0, 60*512, &BytesRead, NULL))
     281      if (ReadFile(IOCTLHandle, &Track0, SECTOR_COUNT * BYTES_PER_SECTOR, &BytesRead, NULL))
    260282         Success = TRUE;
    261283      WINNT_FreeIOCTLHandle(IOCTLHandle);
     
    270292      IOCTLHandle = WINNT_GetIOCTLHandle();
    271293      SetFilePointer(IOCTLHandle, 0, 0, FILE_BEGIN);
    272       if (WriteFile(IOCTLHandle, &Track0, 60*512, &BytesWritten, NULL))
     294      if (WriteFile(IOCTLHandle, &Track0, SECTOR_COUNT * BYTES_PER_SECTOR, &BytesWritten, NULL))
    273295         Success = TRUE;
    274296      WINNT_FreeIOCTLHandle(IOCTLHandle);
     
    307329   FileHandle = fopen("airboot.bin", "rb");
    308330   if (!FileHandle) {
    309       printf("airboot.bin not found\n");
     331      if (!Option_CID) {
     332         printf("airboot.bin not found\n");
     333      }
    310334      return FALSE;
    311335    }
     
    313337   fseek (FileHandle, 0, SEEK_END);
    314338   BootcodeSize = ftell(FileHandle);
    315    if (BootcodeSize!=30720) {
     339   if (BootcodeSize!=IMAGE_SIZE) {
    316340      fclose (FileHandle);
    317       printf("Invalid airboot.bin\n");
     341      if (!Option_CID) {
     342         printf("Invalid airboot.bin\n");
     343      }
    318344      return FALSE;
    319345    }
    320346   fseek (FileHandle, 0, SEEK_SET);
    321    fread (&Bootcode, 1, 30720, FileHandle);
     347   fread (&Bootcode, 1, IMAGE_SIZE, FileHandle);
    322348   fclose (FileHandle);
    323349
     
    330356 }
    331357
     358/**
     359 * Check MBR and AB signatures.
     360 * Also check code sectors if AB is installed.
     361 * Set global status accordingly.
     362 */
    332363void Status_CheckCode (void) {
    333364   USHORT TotalCodeSectorsUsed = 0;
     
    338369   // EZ-Setup check!
    339370   Status_Code = STATUS_NOTINSTALLED;
    340    if ((Track0[0x1FE]!=0x55) || (Track0[0x1FF]!=0xAA)) return;
    341    if (strncmp(&Track0[2], "AiRBOOT", 7)!=0) return;
     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
    342373   // MBR and AiR-BOOT signature found...
    343    TotalCodeSectorsUsed = Track0[0x10];
    344    SectorPtr = &Track0[1*512]; // Start at sector 2
     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
    345377   while (TotalCodeSectorsUsed>0) {
    346378      Checksum = GetChecksumOfSector(Checksum, SectorPtr);
    347       SectorPtr += 512;
     379      SectorPtr += BYTES_PER_SECTOR;
    348380      TotalCodeSectorsUsed--;
    349381    }
    350382   if (Checksum!=*(PUSHORT)&Track0[0x11]) {
    351       Status_Code = STATUS_CORRUPT; return;
     383      Status_Code = STATUS_CORRUPT; return;                                      // Bad checksum for code
    352384    }
    353385   // Checksum fine...
     
    355387   Installed_CodeVersion = (Track0[0x0D] << 8) | Track0[0x0E];
    356388   if (Installed_CodeVersion<Bootcode_Version)
    357       Status_Code = STATUS_INSTALLEDMGU;
     389      Status_Code = STATUS_INSTALLEDMGU;                                         // Do upgrade
    358390     else
    359       Status_Code = STATUS_INSTALLED;
    360  }
     391      Status_Code = STATUS_INSTALLED;                                            // Same version installed
     392 }
     393
    361394
    362395void Status_CheckConfig (void) {
    363    PCHAR  ConfigSectorPtr = &Track0[0x6C00];
     396   PCHAR  ConfigSectorPtr = &Track0[CONFIG_OFFSET];                              // Config sector offset hard-coded !
    364397   PCHAR  SectorPtr = NULL;
    365398   USHORT Checksum = 0;
     
    369402   if (strncmp(ConfigSectorPtr, "AiRCFG-TABLE­", 13)==0) {
    370403      // AiR-BOOT signature found...
    371       SectorPtr = &Track0[54*512]; // Start at sector 55
    372       ConfigChecksum = *(PUSHORT)&Track0[54*512+20];
     404      SectorPtr = &Track0[54 * BYTES_PER_SECTOR];                                // Start at sector 55
     405      ConfigChecksum = *(PUSHORT)&Track0[54 * BYTES_PER_SECTOR + 20];
    373406      // Remove checksum
    374       *(PUSHORT)&Track0[54*512+20] = 0;
     407      *(PUSHORT)&Track0[54 * BYTES_PER_SECTOR + 20] = 0;                         // Config sector secnum hard-coded !
     408
     409      /*
     410      // Rousseau:
     411      // Calculate chechsum over 5 sectors starting at the config-sector at 55.
     412      // 55,56,57,58,59 (60 is MBR backup in normal version)
     413      // SHOULD ADJUST THIS FOR EXTENDED VERSION !                               // !!!!!!!!!!!
     414      */
    375415      SectorCount = 5;
    376416      while (SectorCount>0) {
    377417         Checksum = GetChecksumOfSector(Checksum, SectorPtr);
    378          SectorPtr += 512;
     418         SectorPtr += BYTES_PER_SECTOR;
    379419         SectorCount--;
    380420       }
    381421      // Restore checksum
    382       *(PUSHORT)&Track0[54*512+20] = ConfigChecksum;
     422      *(PUSHORT)&Track0[54 * BYTES_PER_SECTOR + 20] = ConfigChecksum;            // Config sector secnum hard-coded !
    383423      if (Checksum!=ConfigChecksum) {
    384424        Status_Config = STATUS_CORRUPT; return;
     
    386426       }
    387427      // Checksum fine
    388       Installed_ConfigVersion = (Track0[54*512+0x0D] << 8) | Track0[54*512+0x0E];
     428      Installed_ConfigVersion = (Track0[54 * BYTES_PER_SECTOR + 0x0D] << 8) | Track0[54 * BYTES_PER_SECTOR + 0x0E];
    389429      if (Installed_ConfigVersion>=Bootcode_ConfigVersion) {
    390430         Status_Config = STATUS_INSTALLED; return;
     
    394434      //  If new configuration data was added, those spaces are not overwritten
    395435      // Sector 60 (MBR-BackUp) *MUST BE* copied, otherwise it would be lost.
     436      // Rousseau: Upgrade from v0.27
    396437      if (Installed_ConfigVersion<=0x27) {
    397438         // UPGRADE v0.27 and prior versions
     
    407448         //           -> Total-length 101
    408449         //          Offset 432 Length 34 - New IPT entry (BIOS continued)
    409          memcpy(&Bootcode[54*512+16], &Track0[54*512+16], 69-16);
    410          memcpy(&Bootcode[54*512+466], &Track0[54*512+466], 46);
     450         memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], 69 - 16);    // CHECKEN !!
     451         memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 466], &Track0[54 * BYTES_PER_SECTOR + 466], 46);       // CHECKEN !!
    411452         // Sector 56-57 no changes
    412          memcpy(&Bootcode[55*512], &Track0[55*512], 1024);
     453         memcpy(&Bootcode[55*512], &Track0[55 * BYTES_PER_SECTOR], 1024);
    413454         // Sector 58-59
    414455         // Changes: Offset 900 Length 30 - Logical driveletter table
    415          memcpy(&Bootcode[57*512], &Track0[57*512], 900);
     456         memcpy(&Bootcode[57 * BYTES_PER_SECTOR], &Track0[57 * BYTES_PER_SECTOR], 900);               // AANPASSEN 900 !!
    416457         // Sector 60 copy unmodified
    417          memcpy(&Bootcode[59*512], &Track0[59*512], 512);
     458         memcpy(&Bootcode[59 * BYTES_PER_SECTOR], &Track0[59 * BYTES_PER_SECTOR], BYTES_PER_SECTOR);  // CHECKEN !!
    418459         return;
    419460       }
     461      // Rousseau: Upgrade from v0.91
    420462      if (Installed_ConfigVersion<=0x91) {
    421463         // UPGRADE v0.91 and prior versions
    422464         // Sector 55-57 no changes
    423          memcpy(&Bootcode[54*512+16], &Track0[54*512+16], 512+1024-16);
     465         memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], BYTES_PER_SECTOR + 1024 - 16);   // CHACKEN !!
    424466         // Sector 58-59
    425467         // Changes: Offset 900 Length 30 - Logical driveletter table
    426          memcpy(&Bootcode[57*512], &Track0[57*512], 900);
     468         memcpy(&Bootcode[57 * BYTES_PER_SECTOR], &Track0[57 * BYTES_PER_SECTOR], 900);               // AANPASSEN 900 !!
    427469         // Sector 60 copy unmodified
    428          memcpy(&Bootcode[59*512], &Track0[59*512], 512);
     470         memcpy(&Bootcode[59 * BYTES_PER_SECTOR], &Track0[59 * BYTES_PER_SECTOR], BYTES_PER_SECTOR);
    429471         return;
    430472       }
     
    432474      //  We don't need to "upgrade" the configuration, we simply copy it over.
    433475      //   From Sector 55, 6 sectors in total but never header/version
    434       memcpy(&Bootcode[54*512+16], &Track0[54*512+16], 512*6-16);
     476      // Rousseau: We copy two more sectors (8 in total) in the extended (45 partition) version.
     477      switch (IMAGE_SIZE) {
     478         case IMAGE_SIZE_60SECS: {
     479            memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], BYTES_PER_SECTOR * 6 - 16);
     480            break;
     481         }
     482         case IMAGE_SIZE_62SECS: {
     483            memcpy(&Bootcode[54 * BYTES_PER_SECTOR + 16], &Track0[54 * BYTES_PER_SECTOR + 16], BYTES_PER_SECTOR * 8 - 16);
     484            break;
     485         }
     486      }
     487
    435488      return;
    436489    }
     
    442495
    443496// Checks partition table for valid data
    444 BOOL Virus_CheckThisMBR (PCHAR MBRptr) {
     497BOOL Virus_CheckThisMBR (PCHAR MBRptr) {                                         // Rousseau: adjusted this function
    445498   USHORT PartitionNo;
    446499   ULONG  CHSStart, CHSEnd;
    447500
    448    if (*(PUSHORT)(MBRptr + 510)!=0x0AA55) return FALSE;
     501   //printf("DEBUG: Virus_CheckThisMBR\n");
     502
     503   if (*(PUSHORT)(MBRptr + BYTES_PER_SECTOR - 2)!=0x0AA55) return FALSE;
     504
     505   //printf("DEBUG: Virus_CheckThisMBR - Checking Partitions\n");
     506
    449507   MBRptr += 446;
    450508   for (PartitionNo=0; PartitionNo<4; PartitionNo++) {
    451       if (*(MBRptr+4)!=0) {
     509      if (*(MBRptr+4) != 0) {
     510         /*
     511         // Rousseau 2011-02-04: ## Check for GPT ##
     512         */
     513         if (*(MBRptr+4) == GPT) {
     514            if (!Option_CID) {
     515               printf("ERROR: This drive is partitioned with the modern GPT layout.\n");
     516               printf("       AiR-BOOT is currently unable to handle GPT partitioned drives.\n");
     517               printf("       Installation aborted, no changes made.\n");
     518            }
     519            exit(2);
     520         }
     521
     522         /*
     523         // Rousseau: 2011-05-05
     524         //           Last minute change to have AB install a disk with nopartitions
     525         //           on the bootdisk.
     526         //           It still checks for GPT but will skip the check below.
     527         */
     528         continue;
     529
     530         //printf("DEBUG: Virus_CheckThisMBR - Partition: %d\n", PartitionNo);
    452531         // Partition-type defined, analyse partition data
    453          CHSStart = (*(MBRptr+3) | ((*(MBRptr+2) >> 6) << 8)) << 16; // Cylinder
    454          CHSStart |= (*(MBRptr+2) & 0x3F) | ((*(MBRptr+1) << 8)); // Sector / Head
    455 
    456          CHSEnd = (*(MBRptr+7) | ((*(MBRptr+6) >> 6) << 8)) << 16; // Cylinder
    457          CHSEnd |= (*(MBRptr+6) & 0x3F) | ((*(MBRptr+5) << 8)); // Sector / Head
    458 
    459          if (CHSStart<CHSEnd) {
     532         CHSStart = (*(MBRptr+3) | ((*(MBRptr+2) >> 6) << 8)) << 16;             // Cylinder
     533         CHSStart |= (*(MBRptr+2) & 0x3F) | ((*(MBRptr+1) << 8));                // Sector / Head
     534         //printf("DEBUG: Virus_CheckThisMBR - CHSStart: %d\n", CHSStart);                               // 3F MASK CHECKEN !!
     535
     536         CHSEnd = (*(MBRptr+7) | ((*(MBRptr+6) >> 6) << 8)) << 16;               // Cylinder
     537         CHSEnd |= (*(MBRptr+6) & 0x3F) | ((*(MBRptr+5) << 8));                  // Sector / Head
     538         //printf("DEBUG: Virus_CheckThisMBR - CHSEnd: %d\n", CHSEnd);
     539
     540
     541         /*
     542         // Rousseau 2011-02-03: ## Changed below from < to <= ##
     543         // When a partition is above 1024x255x63 (8GiB) the start and end of the partition
     544         // in the MBR is the same (1024/255/63) to indicate extended CHS-values.
     545         // This made the installer see this as a non-valid entry.
     546         // Fixme: This could use some further optimazation like checking if CHS is really 1024/255/63
     547         //        to exclude truly faulty partition-entries.
     548         */
     549         /*if (CHSStart<CHSEnd) {*/
     550         if (CHSStart<=CHSEnd) {
    460551            if (*(PULONG)(MBRptr+12)!=0) // Absolute length > 0?
    461552               return TRUE;
     
    466557    }
    467558   // No partitions defined/no valid partitions found
    468    return FALSE;
     559   // Rousseau: Still return TRUE (OK)
     560   //return FALSE;
     561   return TRUE;
    469562 }
    470563
     
    474567
    475568BOOL Virus_CheckForBackUpMBR (void) {
    476    return Virus_CheckThisMBR(&Track0[59*512]);
     569   return Virus_CheckThisMBR(&Track0[59 * BYTES_PER_SECTOR]);
    477570 }
    478571
     
    481574   USHORT i;
    482575
    483    for (i=0; i<511; i++) {
     576   for (i=0; i<511; i++) {                                                       // BYTES_PER_SECTOR RELATED ??
    484577      if (*(PUSHORT)CurPtr==0x13CD) return FALSE;
    485578      CurPtr++;
     
    490583
    491584// Copies backup MBR into current MBR on current memory copy of track 0
     585// Rousseau: Two sectors higher in the extended version.
    492586void Virus_CopyBackUpMBR (void) {
    493    memcpy(&Track0, &Track0[59*512], 512);
     587   switch (IMAGE_SIZE) {
     588      case IMAGE_SIZE_60SECS: {
     589         memcpy(&Track0, &Track0[59 * BYTES_PER_SECTOR], BYTES_PER_SECTOR);      // sector 60
     590         break;
     591      }
     592      case IMAGE_SIZE_62SECS: {
     593         memcpy(&Track0, &Track0[61 * BYTES_PER_SECTOR], BYTES_PER_SECTOR);      // sector 62
     594         break;
     595      }
     596   }
    494597 }
    495598
     
    497600   switch (Status) {
    498601    case STATUS_NOTINSTALLED: {
    499        printf("not installed\n");
     602       if (!Option_CID) {
     603         printf("not installed\n");
     604      }
    500605       break;
    501606     }
    502607    case STATUS_CORRUPT: {
    503        printf("not intact\n");
     608       if (!Option_CID) {
     609         printf("not intact\n");
     610      }
    504611       break;
    505612     }
    506613    case STATUS_INSTALLED:
    507614    case STATUS_INSTALLEDMGU:
    508        printf("intact (v%x.%02x)", Version>>8, Version & 0x0FF);
    509        if (Status==STATUS_INSTALLEDMGU) printf(", but may be updated");
    510        printf("\n");
     615       if (!Option_CID) {
     616         printf("intact (v%x.%02x)", Version>>8, Version & 0x0FF);
     617       }
     618       if (Status==STATUS_INSTALLEDMGU)
     619         if (!Option_CID) {
     620            printf(", but may be updated");
     621            printf("\n");
     622         }
    511623       break;
    512624    case STATUS_IMPOSSIBLE:
    513        printf(ImpossibleCause);
     625      if (!Option_CID) {
     626         printf(ImpossibleCause);
     627      }
    514628       break;
    515629    }
     
    517631
    518632void Language_PrintF(UCHAR LanguageID) {
     633   if (Option_CID)
     634      return;
    519635   switch (LanguageID) {
    520636     case 'E': printf("english"); break;
     
    537653
    538654   // Calculate checksum for code...
    539    TotalCodeSectorsUsed = Bootcode[0x10];
    540    SectorPtr = &Bootcode[1*512]; // Start at sector 2
     655   TotalCodeSectorsUsed = Bootcode[0x10];                                        // SECTORS USED CHECKEN !! (34h / 52d in v1.06)
     656   SectorPtr = &Bootcode[1 * BYTES_PER_SECTOR]; // Start at sector 2
    541657   SectorCount = TotalCodeSectorsUsed;
    542658   while (SectorCount>0) {
    543659      Checksum = GetChecksumOfSector(Checksum, SectorPtr);
    544       SectorPtr += 512;
     660      SectorPtr += BYTES_PER_SECTOR;
    545661      SectorCount--;
    546662    }
     
    551667
    552668   // Copy over code sectors...
    553    memcpy(&Track0[512], &Bootcode[512], TotalCodeSectorsUsed*512);
     669   memcpy(&Track0[BYTES_PER_SECTOR], &Bootcode[BYTES_PER_SECTOR], TotalCodeSectorsUsed * BYTES_PER_SECTOR);
    554670 }
    555671
     
    562678      if (AutoDriveLetter!=0) {
    563679         // Add DriveLetter Automatic veriables, if set
    564          Bootcode[54*512+0x1AB] = AutoDriveLetter;
    565          *(PULONG)&Bootcode[54*512+0x1AC] = AutoDriveLetterSerial;
     680         Bootcode[54 * BYTES_PER_SECTOR + 0x1AB] = AutoDriveLetter;                       // CHECKEN !
     681         *(PULONG)&Bootcode[54 * BYTES_PER_SECTOR + 0x1AC] = AutoDriveLetterSerial;
    566682       }
    567683   #endif
    568684
    569685   // Delete current checksum
    570    *(PUSHORT)&Bootcode[54*512+20] = 0;
    571 
    572    SectorPtr = &Bootcode[54*512]; // Start at sector 55
     686   *(PUSHORT)&Bootcode[54 * BYTES_PER_SECTOR + 20] = 0;
     687
     688   SectorPtr = &Bootcode[54 * BYTES_PER_SECTOR];                                // Start at sector 55
    573689   SectorCount = 5;
    574690   while (SectorCount>0) {
    575691      Checksum = GetChecksumOfSector(Checksum, SectorPtr);
    576       SectorPtr += 512;
     692      SectorPtr += BYTES_PER_SECTOR;
    577693      SectorCount--;
    578694    }
    579    *(PUSHORT)&Bootcode[54*512+20] = Checksum;
     695   *(PUSHORT)&Bootcode[54 * BYTES_PER_SECTOR + 20] = Checksum;
    580696
    581697   // Copy configuration sectors
    582    memcpy(&Track0[54*512], &Bootcode[54*512], 6*512);
     698   // Rousseau: Two more sectors for extended version.
     699   switch (IMAGE_SIZE) {
     700      case IMAGE_SIZE_60SECS: {
     701         memcpy(&Track0[54 * BYTES_PER_SECTOR], &Bootcode[54 * BYTES_PER_SECTOR], 6 * BYTES_PER_SECTOR);
     702         break;
     703      }
     704      case IMAGE_SIZE_62SECS: {
     705         memcpy(&Track0[54 * BYTES_PER_SECTOR], &Bootcode[54 * BYTES_PER_SECTOR], 8 * BYTES_PER_SECTOR);
     706         break;
     707      }
     708   }
    583709 }
    584710
     
    593719   BOOL   ExitOnly    = FALSE;
    594720
    595    printf("AiR-BOOT Installer v1.00\n");
    596    printf(" - (c) Copyright 1998-2009 by Martin Kiewitz.\n");
    597    printf("\n-> ...Please wait... <-\n");
     721//   printf("AiR-BOOT Installer v1.07\n");
     722//   printf(" - (c) Copyright 1998-2011 by Martin Kiewitz.\n");
     723//   printf("\n-> ...Please wait... <-\n");
    598724
    599725   // Check commandline parameters
     
    615741         if (strcmp(&TempSpace, "forceconfig")==0) Option_ForceConfig = TRUE;
    616742         if (strcmp(&TempSpace, "silent")==0) Option_Silent = TRUE;
     743         if (strcmp(&TempSpace, "cid")==0) Option_CID = TRUE;
    617744       }
    618745      CurArgument++;
    619746    }
     747
     748   if (Option_CID) {
     749      Option_Silent = TRUE;
     750   }
    620751
    621752   #ifdef PLATFORM_WINNT
     
    624755
    625756   if (CountHarddrives()==0) {
    626       printf(" - No physical drives found on this system. Install impossible.\n");
    627       return 1;
    628     }
    629 
    630    printf(" - Loading bootcode from file...");
     757      if (!Option_CID) {
     758         printf(" - No physical drives found on this system. Install impossible.\n");
     759      }
     760      return 3;   // Rouseau: changed from 1 to 3
     761    }
     762
     763   if (!Option_CID) {
     764      printf(" - Loading bootcode from file...");
     765   }
    631766   if (LoadBootcodeFromFile()==FALSE) return 1;
    632    printf("ok\n");
    633 
    634    printf(" - Loading MBR from harddisc...");
     767   if (!Option_CID) {
     768      printf("ok\n");
     769   }
     770
     771   if (!Option_CID) {
     772      printf(" - Loading MBR from harddisc...");
     773   }
    635774   if (HarddriveCheckGeometry()) {
    636775      // No EZ-SETUP check here, because we are under 32-bit OS and this
    637776      //  wouldn't make any sense
    638777      if (!Track0Load()) {
    639          printf("LOAD ERROR!\n");
     778         if (!Option_CID) {
     779            printf("LOAD ERROR!\n");
     780         }
    640781         return 1;
    641782       }
    642783    } else {
    643784      StatusCode = STATUS_IMPOSSIBLE;
    644       ImpossibleCause = "unable to install\n   Your harddisc does not have at least 62 sectors per track.";
    645     }
    646    printf("ok\n");
    647 
    648 
    649    printf("\n-> ...Current Status... <-\n");
     785      if (!Option_CID) {
     786         ImpossibleCause = "unable to install\n   Your harddisc does not have at least 62 sectors per track.";
     787      }
     788    }
     789   if (!Option_CID) {
     790      printf("ok\n");
     791   }
     792
     793
     794   if (!Option_CID) {
     795      printf("\n-> ...Current Status... <-\n");
     796   }
    650797   Status_CheckCode();
    651    printf(" - AiR-BOOT is ");
     798   if (!Option_CID) {
     799      printf(" - AiR-BOOT is ");
     800   }
    652801   Status_PrintF(Status_Code, Installed_CodeVersion);
    653802   if (StatusCode==STATUS_IMPOSSIBLE) return 1;
    654803   Status_CheckConfig();
    655    printf(" - Configuration is ");
     804   if (!Option_CID) {
     805      printf(" - Configuration is ");
     806   }
    656807   Status_PrintF(Status_Config, Installed_ConfigVersion);
    657808   // Display language as well, if code installed
    658809   if ((Status_Code==STATUS_INSTALLED) || (Status_Code==STATUS_INSTALLEDMGU)) {
    659       printf(" - Language is ");
     810      if (!Option_CID) {
     811         printf(" - Language is ");
     812      }
    660813      Language_PrintF(Installed_LanguageID);
    661       printf("\n");
     814      if (!Option_CID) {
     815         printf("\n");
     816      }
    662817    }
    663818
     
    682837   //  Code==not installed, config==installed -> (-> Virus?)
    683838   //  Code==installed, config==not installed -> Check MBR (-> Virus?)
     839
     840   //printf("DEBUG: Status_Code: %d, Status_Config: %d\n", Status_Code, Status_Config);  // Rousseau: DEBUG
     841
    684842   if ((Status_Code==STATUS_NOTINSTALLED) & (Status_Config==STATUS_NOTINSTALLED)) {
    685843      // Nothing installed, so check MBR, if squashed...
    686844      if (!Virus_CheckCurrentMBR()) {
    687          printf("\n\n");
    688          printf("AiR-BOOT detected that the data on your harddisc got damaged.\n");
    689          printf("If you had AiR-BOOT installed before: the corruption killed AiR-BOOT completly!\n");
    690          printf("Installation halted.\n");
    691          return 1;
    692        }
     845         if (!Option_CID) {
     846            printf("\n\n");
     847            printf("AiR-BOOT detected that the data on your harddisc got damaged.\n");
     848            printf("If you had AiR-BOOT installed before: the corruption killed AiR-BOOT completly!\n");
     849            printf("Installation halted.\n");
     850         }
     851         return 255; // Rousseau: changed from 1 to 255
     852       }
     853       //printf("DEBUG: Installing...\n");                                               // Rousseau: DEBUG
    693854    } else {
    694855      if ((Status_Code==STATUS_NOTINSTALLED) | (!Virus_CheckCurrentMBR())) {
    695856         // Code not installed, but Config or MBR squashed...
    696857         //  -> Virus proposed, check for backup (if available)
    697          printf("\n\n");
    698          printf("-> ...!ATTENTION!... <-\n");
     858         if (!Option_CID) {
     859            printf("\n\n");
     860            printf("-> ...!ATTENTION!... <-\n");
     861         }
    699862         if (Virus_CheckForStealth())
    700             printf("Your system GOT infected by a stealth-virus (or your MBR got trashed).\n");
     863            if (!Option_CID) {
     864               printf("Your system GOT infected by a stealth-virus (or your MBR got trashed).\n");
     865            }
    701866           else
    702             printf("Probably your system was infected by a virus.\n");
    703          printf("Repairing AiR-BOOT will normally squash the virus.\n");
    704          printf("But to be sure it's gone, you should check your harddisc using a virus-scanner.\n");
     867            if (!Option_CID) {
     868               printf("Probably your system was infected by a virus.\n");
     869               printf("Repairing AiR-BOOT will normally squash the virus.\n");
     870               printf("But to be sure it's gone, you should check your harddisc using a virus-scanner.\n");
     871            }
    705872         if (!Virus_CheckCurrentMBR()) {
    706873            // MBR squashed, so check backup and display message
    707             printf("\n");
    708             printf("AiR-BOOT detected that the virus has broken your partition-table.\n");
     874            if (!Option_CID) {
     875               printf("\n");
     876               printf("AiR-BOOT detected that the virus has broken your partition-table.\n");
     877            }
    709878            if (Virus_CheckForBackUpMBR()) {
    710                printf("Good news: AiR-BOOT has found a (hopefully) functional backup.\n");
    711                printf("Shall I use this backup, instead of the current active one? (Y/N)\n");
     879               if (!Option_CID) {
     880                  printf("Good news: AiR-BOOT has found a (hopefully) functional backup.\n");
     881                  printf("Shall I use this backup, instead of the current active one? (Y/N)\n");
     882               }
    712883               // User selection, Y/N, if he wants to restore MBR
    713884               //  *NOT* CID (silent) able
     
    718889                  Virus_CopyBackUpMBR();
    719890             } else {
    720                printf("Sadly the virus also broke AiR-BOOT's backup. You will have to help yourself.\n");
     891                if (!Option_CID) {
     892                  printf("Sadly the virus also broke AiR-BOOT's backup. You will have to help yourself.\n");
     893               }
    721894             }
    722895          }
     
    727900   //  MAIN-MENU
    728901   // =============================================================
    729    printf("\n-> ...Please press... <-\n");
    730 
    731    if (Install_IsCorrupt) printf(" <R> - Repair AiR-BOOT ");
    732     else if (Status_Code==STATUS_NOTINSTALLED) printf(" <A> - Add AiR-BOOT ");
    733     else printf(" <U> - Update/Change AiR-BOOT to ");
    734    printf("'v%x.%02x/", Bootcode_Version>>8, Bootcode_Version & 0x0FF);
    735    Language_PrintF(Bootcode_LanguageID);
    736    printf("' on current system\n");
    737 
    738    printf(" <D> - Delete AiR-BOOT from current system\n");
    739    printf(" <Q> - Quit without any change\n");
    740 
    741    if (Option_Silent) {
     902   if (!Option_CID) {
     903      printf("\n-> ...Please press... <-\n");
     904   }
     905
     906   if (!Option_CID) {
     907      if (Install_IsCorrupt) printf(" <R> - Repair AiR-BOOT ");
     908       else if (Status_Code==STATUS_NOTINSTALLED) printf(" <A> - Add AiR-BOOT ");
     909       else printf(" <U> - Update/Change AiR-BOOT to ");
     910      printf("'v%x.%02x/", Bootcode_Version>>8, Bootcode_Version & 0x0FF);
     911      Language_PrintF(Bootcode_LanguageID);
     912      printf("' on current system\n");
     913
     914      printf(" <D> - Delete AiR-BOOT from current system\n");
     915      printf(" <Q> - Quit without any change\n");
     916   }
     917
     918   if (Option_Silent || Option_CID) {
    742919      // Silent operation? Always add AiR-BOOT then
    743920      UserKey = 'a';
     
    748925    }
    749926
    750    printf("\n\n\n-------------------------------------------------------------------------------\n");
     927   if (!Option_CID) {
     928      printf("\n\n\n-------------------------------------------------------------------------------\n");
     929   }
    751930   switch (UserKey) {
    752931    case 'a':
     
    754933    case 'u': {
    755934      if (Install_Code || Install_Config) {
    756          printf("Add/Repair/Update AiR-BOOT in progress...\n");
     935         if (!Option_CID) {
     936            printf("Add/Repair/Update AiR-BOOT in progress...\n");
     937         }
    757938         #ifdef PLATFORM_OS2
    758939            OS2_GetBootAutoDriveLetter();
    759940         #endif
    760941         if (Install_Code) {
    761             printf(" þ Writing AiR-BOOT code...");
     942            if (!Option_CID) {
     943               printf(" þ Writing AiR-BOOT code...");
     944            }
    762945            Install_WriteCode();
    763             printf("ok\n");
     946            if (!Option_CID) {
     947               printf("ok\n");
     948            }
    764949          }
    765950         if (Install_Config) {
    766             printf(" þ Writing AiR-BOOT configuration...");
     951            if (!Option_CID) {
     952               printf(" þ Writing AiR-BOOT configuration...");
     953            }
    767954            Install_WriteConfig();
    768             printf("ok\n");
     955            if (!Option_CID) {
     956               printf("ok\n");
     957            }
    769958          }
    770959
    771960         if (!Track0Write()) {
    772             printf("SAVE ERROR!\n");
     961            if (!Option_CID) {
     962               printf("SAVE ERROR!\n");
     963            }
    773964            return 1;
    774965          }
    775          printf("\n");
    776          printf("Your copy of AiR-BOOT is now fully functional.\n");
    777          printf("Please hit ESC to exit AiR-BOOT installer or ENTER to reboot your system...\n");
    778          if (Option_Silent) {
     966         if (!Option_CID) {
     967            printf("\n");
     968            printf("Your copy of AiR-BOOT is now fully functional.\n");
     969            printf("Please hit ESC to exit AiR-BOOT installer or ENTER to reboot your system...\n");
     970         }
     971         if (Option_Silent || Option_CID) {
    779972            // Silent operation? Always reboot system (shall we do this really?)
    780973            UserKey = 0x0D;
     
    784977             } while (!((UserKey==0x0D) || (UserKey==0x1B)));
    785978          }
    786          if (UserKey==0x0D) {              // ENTER reboots system...
    787             printf("Now rebooting system...\n");
    788             RebootSystem();
     979         if (UserKey==0x0D) {              // ENTER reboots system... (if not in eCS install mode)
     980
     981            /*
     982            // Rousseau: ## Disable Reboot when installing eComStation ##
     983            // In the install-environment, the MEMDRIVE env-var is defined.
     984            // So, only reboot if this env-var is not defined.
     985            */
     986            if (!getenv("MEMDRIVE")) {
     987               if (!Option_CID) {
     988                  printf("Now rebooting system...\n");
     989               }
     990               //RebootSystem();
     991            }
     992            ExitOnly = TRUE;
    789993          }
    790994       } else {
    791          printf(" þ All components of AiR-BOOT are intact and up-to-date. Nothing to do.\n");
     995         if (!Option_CID) {
     996            printf(" þ All components of AiR-BOOT are intact and up-to-date. Nothing to do.\n");
     997         }
    792998         ExitOnly = TRUE;
    793999        }
     
    7951001     }
    7961002    case 'd': {
    797       printf(" þ Removing AiR-BOOT automatically is not possible at this time.\n");
     1003      if (!Option_CID) {
     1004         printf(" þ Removing AiR-BOOT automatically is not possible at this time.\n");
     1005      }
    7981006      #ifdef PLATFORM_OS2
    799          printf("    You may remove AiR-BOOT manually by entering \"FDISK /MBR\" or \"LVM /NEWMBR:1\"\n");
    800          printf("    in commandline.\n");
     1007         if (!Option_CID) {
     1008            printf("    You may remove AiR-BOOT manually by entering \"FDISK /MBR\" or \"LVM /NEWMBR:1\"\n");
     1009            printf("    in commandline.\n");
     1010         }
    8011011      #endif
    8021012      #ifdef PLATFORM_WINNT
    803          printf("    You may remove AiR-BOOT manually by entering \"FDISK /MBR\" in commandline.\n");
     1013         if (!Option_CID) {
     1014            printf("    You may remove AiR-BOOT manually by entering \"FDISK /MBR\" in commandline.\n");
     1015         }
    8041016      #endif
    8051017      ExitOnly = TRUE;
     
    8111023
    8121024   if (ExitOnly) {
    813       printf("\n");
    814       printf("Please hit ENTER to exit AiR-BOOT installer...\n");
    815       if (!Option_Silent) {
     1025      if (!Option_CID) {
     1026         printf("\n");
     1027         printf("Please hit ENTER to exit AiR-BOOT installer...\n");
     1028      }
     1029      if (!Option_Silent || !Option_CID) {
    8161030         while (getch()!=0x0D);
    8171031       }
  • trunk/INSTALL/C/OS2.WPJ

    r29 r30  
    551
    66WRect
    7 0
    8 0
     7840
     8620
    997680
    10 9216
     109210
    11112
    1212MProject
     
    2121WFileName
    222212
    23 inst-os2.tgt
     23INST-OS2.TGT
    24246
    2525WVList
     
    3838WFileName
    393912
    40 inst-os2.tgt
     40INST-OS2.TGT
    41410
    42421
  • trunk/INSTALL/C/WIN32.WPJ

    r29 r30  
    551
    66WRect
    7 0
    8 0
     7840
     8620
    997680
    10 9216
     109210
    11112
    1212MProject
     
    2121WFileName
    222212
    23 inst-win.tgt
     23INST-WIN.TGT
    24246
    2525WVList
     
    3030WRect
    3131576
    32 529
     32520
    33335632
    34 4147
     344140
    35350
    36360
     
    3838WFileName
    393912
    40 inst-win.tgt
     40INST-WIN.TGT
    41410
    42421
  • trunk/INSTALL/DOS/AIRBOOT.ASM

    r29 r30  
    2929COM_StartUp:    jmp     COM_Init
    3030
    31 COM_Copyright   db 'AiR-BOOT Installer for DOS v1.00', 13, 10
     31COM_Copyright   db 'AiR-BOOT Installer for DOS v1.07', 13, 10
    3232                db ' - (c) Copyright 2008-2009 by M. Kiewitz.', 13, 10
    3333                db 13, 10
     
    134134
    135135                mov     ah, 3Fh
    136                 mov     cx, 30720        ; Image size
     136                mov     cx, image_size        ; Image size
    137137                mov     dx, offset BootImage
    138138                int     21h              ; DOS: READ FILE
     
    141141                call    APIShowError
    142142
    143 COM_DoneRead:   cmp     ax, 30720
     143COM_DoneRead:   cmp     ax, image_size
    144144                je      COM_DoneRead2
    145145COM_InvalidFile:mov     si, offset COM_FailedRead2
  • trunk/INSTALL/DOS/MAKE.BAT

    r29 r30  
    1919echo Errorlevel not 0, make failed
    2020:ExitMe
    21 pause
     21rem pause
  • trunk/INSTALL/INST_X86/INSTALL.INC

    r29 r30  
    158158                   je      VirusRestoreNo
    159159                   jmp     VirusKeyLoop
    160              
     160
    161161VirusRestoreYes:call    Init_CopyBackupMBR
    162162VirusRestoreNo: jmp     VirusSkip
     
    191191                mov     si, offset TXT_MENU_OnCurSystem
    192192                call    APIShowMessage
    193              
     193
    194194                mov     si, offset TXT_MENU_Delete
    195195                call    APIShowMessage
     
    347347   call    SaveImageSector           ; Hide-Partition Table 2
    348348   call    SaveImageSector           ; MBR BackUp (just to be sure, no valid is there)
     349
     350   ;call     SaveImageSector
     351   ;call     SaveImageSector
    349352   ret
    350353InstallConfig                  EndP
    351354
    352355
    353              
     356
    354357;       Out: Carry Flag SET if Harddisc failed 62-sectors test
    355358Init_CheckHarddisc             Proc Near  Uses
  • trunk/TOOLS/DOS/INITHDD/INITHDD.ASM

    r29 r30  
    2020
    2121Include ..\..\..\include\asm.inc
    22 include ..\..\..\include\dos\airboot.inc
     22;include ..\..\..\include\dos\airboot.inc
    2323
    2424                .386p
     
    3636TXT_ERROR_NotNeeded     db 'INITHDD: Initialization not needed.', 13, 10, 0
    3737TXT_Done                db 'INITHDD: HDD was successfully initialized.', 13, 10, 0
     38TXT_Cleared             db 'INITHDD: Reserved Sectors successfully cleared.', 13, 10, 0      ; Rousseau: added
    3839
    3940StandardMBR:
     
    6869   dw 00000h, 00000h, 00000h, 0AA55h
    6970
    70    Include ..\..\..\include\DOS\Const.asm
     71;   Include ..\..\..\include\DOS\Const.asm
    7172
    7273INITHDD_Start:  mov     ax, cs
     
    8485                mov     ax, 0201h          ; Read 1 sector
    8586                int     13h
     87                jnc     Clear                                                    ; Rousseau: added (only clear)
    8688                jnc     LoadMBR_NoError
    8789                mov     si, offset TXT_ERROR_IO
     
    9193                ; Check Master-Boot-Record Signature
    9294                cmp     wptr ds:[CurMBR+01FEh], 0AA55h
    93                 je      AlreadyInitialized
     95                ;;je      AlreadyInitialized                                     ; Rousseau: always initialize
    9496
    9597                mov     ax, cs
     
    107109                mov     si, offset TXT_Done
    108110                call    MBR_Teletype
     111
     112                ; Rousseau: added
     113               Clear:
     114                call    MBR_ClearReservedSectors
     115                mov     si, offset TXT_Cleared
     116                call    MBR_Teletype
     117                ; Rousseau: end added
     118
    109119                jmp     GoByeBye
    110120
     
    132142MBR_Teletype                    EndP
    133143
     144
     145; Rousseau: added
     146MBR_ClearReservedSectors        Proc Near
     147   mov   ax, cs
     148   mov   es, ax                           ; Make sure that ES is right
     149   mov   cx, 2                            ; Index of first reserved sector to clear
     150  MBR_ClearReservedSectors_loop:
     151   push  cx                               ; Put on stack for later use
     152   mov   bx, offset ZeroSEC               ; Block of 0's
     153   mov   dx, 0080h                        ; First harddrive, Sector in cx
     154   ;mov   cx, 0001h
     155   mov   ax, 0301h                        ; Function 03, 1 sector to write
     156   int   13h
     157   pop   cx                               ; Pop sector-index
     158   inc   cx                               ; Next sector
     159   cmp   cx, 62                           ; If below 63 (Possible LVM) then...
     160   jbe   MBR_ClearReservedSectors_loop    ; Repeat
     161   ret
     162MBR_ClearReservedSectors        EndP
     163
     164
     165
    134166CurMBR                  db      512 dup (?)
     167ZeroSEC                 db      512 dup (0)                                      ; Rousseau: added
    135168
    136169code_seg        ends
  • trunk/TOOLS/DOS/INITHDD/MAKE.BAT

    r29 r30  
    1919echo Errorlevel not 0, make failed
    2020:ExitMe
    21 pause
     21rem pause
  • trunk/TOOLS/INTERNAL/FIXCODE.ASM

    r29 r30  
    9191
    9292                mov     ah, 3Fh
    93                 mov     cx, 30720        ; Image size
     93                mov     cx, image_size   ; Image size
    9494                mov     dx, offset BootCode
    9595                int     21h              ; DOS: READ FILE
     
    9898                call    ShowError
    9999
    100 DoneReadCode:   cmp     ax, 30720
     100DoneReadCode:   cmp     ax, image_size
    101101                je      DoneReadCode2
    102102InvalidCode:    mov     dx, offset COM_FailedInvalidCode
     
    232232
    233233                mov     ah, 40h
    234                 mov     cx, 30720        ; Image size
     234                mov     cx, image_size   ; Image size
    235235                mov     dx, offset BootCode
    236236                int     21h              ; DOS: WRITE FILE
     
    239239                call    ShowError
    240240
    241 DoneWriteCode:  cmp     ax, 30720
     241DoneWriteCode:  cmp     ax, image_size
    242242                jne     FailedWriteCode
    243243
     
    250250
    251251; Buffers for files
    252 BootCode        db 30720 dup (?)
     252BootCode        db  image_size dup (?)
    253253MBRProtection   db  1024 dup (?)
    254254
  • trunk/TOOLS/INTERNAL/MAKE.BAT

    r29 r30  
    66%linker% fixcode.obj >nul
    77if errorlevel 1 goto Failed
    8 %exe2bin% fixcode.exe fixcode.com >nul
     8%exe2bin% FIXCODE.EXE FIXCODE.COM >nul
    99if errorlevel 1 goto Failed
    1010
     
    1717echo Errorlevel not 0, make failed
    1818:ExitMe
    19 pause
     19rem pause
  • trunk/TOOLS/OS2/SETABOOT/SETABOOT.C

    r29 r30  
    1717//
    1818
     19/*
     20// Rousseau: 2011-02-05
     21// - Made volumes compare case insensitive so fs-label matches volume-name on command-line.  (around line 510)
     22//   This means bootable volumes cannot not have the same and only differ in case.
     23*/
     24
     25
    1926#define INCL_BASE
    2027#define INCL_WINSHELLDATA
     
    6269
    6370typedef struct _AiRBOOTCONFIG {
    64    CHAR   Identifier[13];
     71   CHAR   Identifier[13];                                                        // Rousseau: INVISIBLE CHAR AT END !
    6572   UCHAR  MajorVersion;
    6673   UCHAR  MinorVersion;
     
    110117   UCHAR  AutomaticPartition;
    111118   UCHAR  ForceLBAUsage;
     119   UCHAR  IgnoreLVM;
     120   UCHAR  Reserved[82];
     121   CHAR   InstallVolume[12];
    112122 } AiRBOOTCONFIG;
    113123typedef AiRBOOTCONFIG *PAiRBOOTCONFIG;
     124
     125
    114126
    115127typedef struct _AiRBOOTIPENTRY {
     
    139151
    140152
     153/* Executables to search for */
     154PCHAR   classic_setboots[] = {
     155   "SETBM.EXE",
     156   NULL
     157};
     158
     159
     160/*
     161// ProtoTypes.
     162*/
     163BOOL Track0DetectAirBoot (BOOL* ab_bad);
     164BOOL Track0WriteAiRBOOTConfig (void);
     165
     166
     167
    141168   USHORT CountHarddrives (void) {
    142169      USHORT NumDrives = 0;
     
    149176   USHORT OS2_GetIOCTLHandle () {
    150177      USHORT IOCTLHandle = 0;
    151  
     178
    152179      if (DosPhysicalDisk(INFO_GETIOCTLHANDLE, &IOCTLHandle, sizeof(IOCTLHandle),"1:" , 3) != 0)
    153180         return 0;
     
    236263    }
    237264
     265
     266APIRET QueryBootDrive(char *bootdrv)
     267{
     268        ULONG   aulSysInfo[QSV_MAX]     = {0};                                             // System Information Data Buffer
     269        APIRET  rc                              = NO_ERROR;                                                                                                    // Return code
     270
     271        if(bootdrv==0) return 1;
     272
     273        rc = DosQuerySysInfo(1L,                                                                                                                            // Request all available system
     274                                                        QSV_MAX ,                                                                                                              // information
     275                                                        (PVOID)aulSysInfo,                                                                                          // Pointer to buffer
     276                                                        sizeof(ULONG)*QSV_MAX);                                                                             // Size of the buffer
     277
     278        if (rc != NO_ERROR) {
     279                return 1;
     280        }
     281        else {
     282                //printf("Bootable drive: %c:\n",
     283                //              aulSysInfo[QSV_BOOT_DRIVE-1]+'A'-1);  /* Max length of path name */
     284                bootdrv[0]=aulSysInfo[QSV_BOOT_DRIVE-1]+'A'-1;
     285
     286                /*
     287                printf("Total physical memory is %u bytes.\n",
     288                                aulSysInfo[QSV_TOTPHYSMEM-1]);
     289                */
     290
     291                return 0;
     292        }
     293
     294
     295}
     296
    238297USHORT GetChecksumOfSector (USHORT BaseCheck, USHORT SectorNo) {
    239298   PUSHORT CurPos     = (PUSHORT)((ULONG)&Track0+(SectorNo-1)*512);
     
    246305 }
    247306
    248 BOOL Track0DetectAirBoot (void) {
    249    USHORT ResultCheck;
    250    USHORT CurSectorNo = 0;
    251 
    252    AiRBOOT_CodeSig = (PAiRBOOTCODESIG)&Track0[2];
    253    AiRBOOT_Config  = (PAiRBOOTCONFIG)&Track0[(55-1)*512];
    254    AiRBOOT_IPT     = (PAiRBOOTIPENTRY)&Track0[(56-1)*512];
    255 
    256    if (strncmp(AiRBOOT_CodeSig->Identifier, "AiRBOOT", 7)!=0) {
    257       return FALSE;
    258     }
    259 
    260    if ((AiRBOOT_CodeSig->TotalCodeSectors)>53) {
    261       puts ("SETABOOT: AiR-BOOT Code damaged!");
    262       return FALSE;
    263     }
    264 
    265    ResultCheck = 0; CurSectorNo = 0;
    266    while (CurSectorNo<AiRBOOT_CodeSig->TotalCodeSectors) {
    267       ResultCheck = GetChecksumOfSector(ResultCheck, CurSectorNo+2);
    268       CurSectorNo++;
    269     }
    270    if (ResultCheck!=AiRBOOT_CodeSig->CheckSumOfCode) {
    271       puts ("SETABOOT: AiR-BOOT Code damaged!");
    272       return FALSE;
    273     }
    274 
    275    if (strncmp(AiRBOOT_Config->Identifier, "AiRCFG-TABLE­", 13)!=0) {
    276       puts ("SETABOOT: AiR-BOOT Config damaged!");
    277       return FALSE;
    278     }
    279 
    280    // Set Config-CheckSum to 0
    281    AiRBOOT_ConfigCheckSum = AiRBOOT_Config->CheckSumOfConfig;
    282    AiRBOOT_Config->CheckSumOfConfig = 0;
    283 
    284    // Calculate CheckSum...
    285    ResultCheck = 0; CurSectorNo = 55;
    286    while (CurSectorNo<60) {
    287       ResultCheck = GetChecksumOfSector(ResultCheck, CurSectorNo);
    288       CurSectorNo++;
    289     }
    290    if (ResultCheck!=AiRBOOT_ConfigCheckSum) {
    291       puts ("SETABOOT: AiR-BOOT Config damaged!");
    292       return FALSE;
    293     }
    294    return TRUE;
    295  }
    296 
    297 BOOL Track0WriteAiRBOOTConfig (void) {
    298    USHORT ResultCheck;
    299    USHORT CurSectorNo = 0;
    300 
    301    // Update Edit-Counter...
    302    AiRBOOT_Config->EditCounter++;
    303    AiRBOOT_Config->CheckSumOfConfig = 0;
    304 
    305    // Calculate CheckSum...
    306    ResultCheck = 0; CurSectorNo = 55;
    307    while (CurSectorNo<60) {
    308       ResultCheck = GetChecksumOfSector(ResultCheck, CurSectorNo);
    309       CurSectorNo++;
    310     }
    311    AiRBOOT_Config->CheckSumOfConfig = ResultCheck;
    312 
    313    if (!Track0Write())
    314       return FALSE;
    315    return TRUE;
    316  }
    317 
    318 int main (int argc, char **argv) {
     307
     308
     309
     310/*
     311// If AiR-BOOT is not installed, the user probably meant to control OS/2 BM with this utility.
     312// Since the functionality of this utility is for AiR-BOOT only, we will pass the request to
     313// the OS/2 BM SETBOOT utility which is called SETBM.EXE as of eCS 2.01.
     314// Since the objective here is to supply OS/2 BM SETBOOT compatibility, if SETBM.EXE is not found,
     315// some other system locations are searched for the OS/2 version of SETBOOT.EXE.
     316// Any SETBOOT.EXE that is found and that does not have a module-name of "setaboot" is invoked,
     317// and passed along the command-line the user issued.
     318// In this case also the return-value of the OS/2 version of SETBOOT.EXE is returned.
     319*/
     320int   DoClassicActions(int argc, char **argv) {
     321   APIRET      rc             = -1;
     322   RESULTCODES  crc                        = {-1,-1};
     323   PTIB        ptib           = NULL;
     324   PPIB        ppib           = NULL;
     325   char        buffer[256]    = "\0";
     326   char        cmdline[256]   = "\0";
     327   PSZ         path           = NULL;
     328   char        sresult[256]   = "\0";
     329   char        bootdrive      = '?';
     330   char*       p              = NULL;
     331   int         i              = 0;
     332
     333   //printf("\nCLASSIC ACTIONS !! (%d)\n", argc);
     334
     335   rc = QueryBootDrive(&bootdrive);
     336
     337   rc = DosScanEnv("PATH", &path);
     338   rc = DosSearchPath(SEARCH_CUR_DIRECTORY | SEARCH_IGNORENETERRS,
     339                        path,
     340                        classic_setboots[0],
     341                        sresult,
     342                        sizeof(sresult));
     343
     344   //printf("SRESULT: rc=%d, %s\n", rc, sresult);
     345
     346   if (rc) {
     347      printf("\n");
     348      printf("ERROR: SETBOOT (AiR-BOOT version)\n");
     349      printf("Since the AiR-BOOT Boot Manager is not installed, this program (SETBOOT.EXE), funcions as a wrapper\n");
     350      printf("to %s that should be used to control IBM Boot Manager.\n", classic_setboots[0]);
     351      printf("However, %s could not be found in the PATH, the error-code is: %d\n", classic_setboots[0], rc);
     352      printf("You can resolve this situation by renaming a valid SETBOOT.EXE to %s\n", classic_setboots[0]);
     353      printf("and put it in your %c:\\OS2 directory.", bootdrive);
     354      printf("\n");
     355      exit(rc);
     356   }
     357
     358
     359
     360
     361   memset(cmdline, 0, sizeof(cmdline));                                          // Clear the command-line buffer.
     362   p = cmdline;                                                                  // Temporary pointer to insert arguments.
     363   strcpy(p, sresult);                                                           // Copy the program-name.
     364   p += strlen(sresult)+1;                                                       // Advance to point for space separated parameters.
     365
     366   /*
     367   // Process all the arguments,
     368   // inserting the separated by a space.
     369   */
     370   for (i=1; i<argc; i++) {
     371      strcpy(p, argv[i]);                                                        // Copy the argument.
     372      p += strlen(argv[i]);                                                      // Advance pointer past argument.
     373      *p++ = ' ';                                                                // Space separation.
     374   }
     375
     376   /*
     377   for (i=0; i<100; i++) {
     378      printf("%c", cmdline[i] ? cmdline[i] : '#');
     379   }
     380   printf("\n");
     381   */
     382
     383   //printf("CMDLINE: %s\n", cmdline);
     384   //printf("CMDLINE+: %s\n", cmdline+strlen(sresult)+1);
     385
     386   rc = DosExecPgm(buffer,
     387            sizeof(buffer),
     388            EXEC_SYNC,
     389            cmdline,
     390            NULL,
     391            &crc,
     392            sresult);
     393
     394   //rc = 3;
     395   if (rc) {
     396      printf("\n");
     397      printf("ERROR: SETBOOT (AiR-BOOT version)\n");
     398      printf("Since the AiR-BOOT Boot Manager is not installed, this program (SETBOOT.EXE), funcions as a wrapper\n");
     399      printf("to %s that should be used to control IBM Boot Manager.\n", classic_setboots[0]);
     400      printf("However, something went wrong when executing %s.\n", classic_setboots[0]);
     401      printf("The error-code is: %d and the termination-code is: %d\n", rc, crc.codeTerminate);
     402      printf("\n");
     403      exit(rc);
     404   }
     405
     406
     407   //printf("DosExecPgm: rc=%08X, codeterminate=%08X, coderesult=%08X\n", rc, crc.codeTerminate, crc.codeResult);
     408
     409   /*
     410   rc = DosGetInfoBlocks(&ptib, &ppib);
     411
     412   rc = DosQueryModuleName(ppib->pib_hmte, sizeof(buffer), buffer);
     413   printf("MODULE: %s\n", buffer);
     414   printf("CMDLINE: %s\n", ppib->pib_pchcmd);
     415   */
     416
     417   return crc.codeResult;
     418}
     419
     420
     421int   DoAirBootActions(int argc, char **argv, BOOL ab_detected, BOOL ab_bad) {
    319422   ULONG           CurArgument      = 0;
    320423   ULONG           ArgumentLen      = 0;
     
    347450   ULONG           XWPBootCount     = 0;
    348451   CHAR            XWPBootName[30][12];
    349    CHAR            XWPBootCommand[30][28]; // 'setaboot /IBA:""' (16 chars)
     452   CHAR            XWPBootCommand[30][28];                                       // 'setaboot /IBA:""' (16 chars)
    350453   BOOL            XWPEntryFound    = FALSE;
     454   BOOL            CDBoot           = FALSE;                                     // TRUE if booted from CD; New System will be added when using /4:"LABEL"
     455   BOOL            Track0Loaded     = FALSE;                                     // Assume track0 did not load correctly.
     456   BOOL            AiRBOOTBad       = FALSE;
     457
     458   //printf("\nAiR-BOOT ACTIONS !!\n");
     459
     460   AiRBOOTDetected = ab_detected;
     461   AiRBOOTBad = ab_bad;
     462
     463   if (AiRBOOTBad)
     464      return 1;
    351465
    352466   // Use OSO001.MSG, so we safe us the trouble of translating :)
     
    354468      return 1;
    355469
    356    puts ("SETABOOT - AiR-BOOT Configuration Utility (OS/2) - (c) 2004-2009 by M. Kiewitz");
     470   /*
     471   // Rousseau: changed version to be the same as the AiR-BOOT is accompanies.
     472   */
     473   //puts ("SETABOOT - AiR-BOOT Configuration Utility (OS/2) - (c) 2004-2009 by M. Kiewitz");
     474   puts ("SETABOOT v1.07 - AiR-BOOT Configuration Utility - (c) 2004-2011 by M. Kiewitz");
     475
     476
     477   //return 0;
     478
     479   /*
     480   // Rousseau:
     481   // Log some debug stuff to (virtual) flop.
     482   */
     483   /*
     484   {
     485      char        buf[512]="\0";
     486      FILE*       fp = NULL;
     487      int         i = 0;
     488
     489      fp = fopen("A:\\SETBOOT.TXT", "a");
     490      sprintf(buf, "Bliep");
     491      fprintf(fp,"Program: %s\n", argv[0]);
     492      fprintf(fp,"Arguments: %d\n", argc);
     493      for (i=0; i<argc-1; i++) {
     494         fprintf(fp, "Arg %d: %s\n", i+1, argv[i+1]);
     495      }
     496      fprintf(fp, "\n");
     497      fclose(fp);
     498   }
     499   */
     500
     501
     502
     503   /*
     504   // Rousseau: ## Enable boot-through when installing new system ##
     505   // In the install-environment, the MEMDRIVE env-var is defined.
     506   // This modifies the behavior after phase 1.
     507   */
     508   if (getenv("MEMDRIVE")) {
     509      printf("CDBoot Environment.\n");
     510      CDBoot = TRUE;
     511   }
     512
    357513
    358514   if (argc==1) {
     
    361517    }
    362518
     519
     520
     521
    363522   // Now we check for AiR-BOOT existance...
     523   /*
    364524   if (CountHarddrives()>0) {
    365525      if (Track0Load()) {
    366          if (Track0DetectAirBoot()) AiRBOOTDetected = TRUE;
    367        } else {
     526         // Rousseau: Track0DetectAirBoot() will init globals.
     527         if (Track0DetectAirBoot()) // REPLACE WITH BOOL
     528            AiRBOOTDetected = TRUE;
     529       }
     530       else {
    368531         MSG_Print (TXT_ERROR_DuringAccessHDD);
    369532       }
    370     } else {
     533    }
     534    else {
    371535      MSG_Print (TXT_ERROR_DuringAccessHDD);
    372     }
     536   }
     537   */
    373538
    374539   CurArgument = 1;
     
    460625
    461626            *StartPos = 0; StartPos++;
     627
    462628            // Search that partition in IPT of AiR-BOOT...
    463629            if ((CurChar=='4') && (ArgumentLen==0)) {
     
    475641             }
    476642
     643
     644            /*
     645            // Rousseau:
     646            // Insert label of newly installed system in AiR-BOOT configuration.
     647            // Note that it is changed to uppercase because AiR-BOOT uses the FS-label when
     648            // scanning partitions and LVM-info is not found. (Otherwise PART-label)
     649            // The auto-boot flag is not set in this case as this is handled by the AiR-BOOT loader.
     650            */
     651            if (CDBoot) {
     652               strncpy(AiRBOOT_Config->InstallVolume, _strupr(StartPos), ArgumentLen);
     653               AiRBOOT_Config->InstallVolume[ArgumentLen] = '\0';
     654               printf("Writing Install Volume: %s to AiR-BOOT configuration.\n", AiRBOOT_Config->InstallVolume);
     655               Track0WriteAiRBOOTConfig();
     656               return 0;
     657            }
     658
     659
     660
     661
    477662            BadValue = TRUE;
    478663            CurPartitionNo = 0; CurIPTEntry = AiRBOOT_IPT;
    479664            while (CurPartitionNo<AiRBOOT_Config->Partitions) {
    480                if (strncmp(CurIPTEntry->PartitionName, StartPos, ArgumentLen)==0) {
     665               /*
     666               // Rousseau: Changed below to case-insensitive compare.
     667               // This solves the part/vol-label (mixed-case) v.s. fs-label (upper-case) issue.
     668               */
     669               /*if (strncmp(CurIPTEntry->PartitionName, StartPos, ArgumentLen)==0) {*/
     670               if (strnicmp(CurIPTEntry->PartitionName, StartPos, ArgumentLen)==0) {
    481671                  if (ArgumentLen==11) {
    482672                     BadValue = FALSE;
     
    495685               CurPartitionNo++; CurIPTEntry++;
    496686             }
     687
    497688
    498689            if (BadValue) {
     
    602793      PrfWriteProfileData (HINI_USERPROFILE, "XWorkplace", "RebootTo", XWPOrgStringPtr, XWPStringSize);
    603794      free(XWPOrgStringPtr);
    604        
     795
    605796      puts ("SETABOOT: XWorkPlace updated.");
    606797      return 0;
     
    611802         return 1;
    612803       }
    613       printf ("SETABOOT: AiR-BOOT %X.%02X detected.\n\n", AiRBOOT_CodeSig->MajorVersion, AiRBOOT_CodeSig->MinorVersion);
     804      printf("SETABOOT: AiR-BOOT %X.%02X detected.\n\n", AiRBOOT_CodeSig->MajorVersion, AiRBOOT_CodeSig->MinorVersion);
     805      //printf("DEBUG: InstallVolume: %s\n", AiRBOOT_Config->InstallVolume);
    614806      if (AiRBOOT_Config->BootMenuActive) {
    615807         if (AiRBOOT_Config->TimedBoot) {
     
    697889    }
    698890   return 0;
     891
     892
     893
     894}
     895
     896
     897/*
     898// Rousseau:
     899// Global pointers will be initialized here !
     900*/
     901BOOL Track0DetectAirBoot (BOOL* ab_bad) {
     902   USHORT ResultCheck;
     903   USHORT CurSectorNo = 0;
     904
     905   /* Globals that get initialized */
     906   AiRBOOT_CodeSig = (PAiRBOOTCODESIG)&Track0[2];
     907   AiRBOOT_Config  = (PAiRBOOTCONFIG)&Track0[(55-1)*512];
     908   AiRBOOT_IPT     = (PAiRBOOTIPENTRY)&Track0[(56-1)*512];
     909
     910   if (strncmp(AiRBOOT_CodeSig->Identifier, "AiRBOOT", 7)!=0) {
     911      *ab_bad = FALSE;
     912      return FALSE;
     913    }
     914
     915   if ((AiRBOOT_CodeSig->TotalCodeSectors)>53) {
     916      puts ("SETABOOT: AiR-BOOT Code damaged!");
     917      *ab_bad = TRUE;
     918      return TRUE;
     919    }
     920
     921   ResultCheck = 0; CurSectorNo = 0;
     922   while (CurSectorNo<AiRBOOT_CodeSig->TotalCodeSectors) {
     923      ResultCheck = GetChecksumOfSector(ResultCheck, CurSectorNo+2);
     924      CurSectorNo++;
     925    }
     926   if (ResultCheck!=AiRBOOT_CodeSig->CheckSumOfCode) {
     927      puts ("SETABOOT: AiR-BOOT Code damaged!");
     928      *ab_bad = TRUE;
     929      return TRUE;
     930    }
     931
     932   if (strncmp(AiRBOOT_Config->Identifier, "AiRCFG-TABLE­", 13)!=0) {            // Rousseau: INVISIBLE CHAR HERE !
     933      puts ("SETABOOT: AiR-BOOT Config damaged!");
     934      *ab_bad = TRUE;
     935      return TRUE;
     936    }
     937
     938   // Set Config-CheckSum to 0
     939   AiRBOOT_ConfigCheckSum = AiRBOOT_Config->CheckSumOfConfig;
     940   AiRBOOT_Config->CheckSumOfConfig = 0;
     941
     942   // Calculate CheckSum...
     943   ResultCheck = 0; CurSectorNo = 55;
     944   while (CurSectorNo<60) {
     945      ResultCheck = GetChecksumOfSector(ResultCheck, CurSectorNo);
     946      CurSectorNo++;
     947    }
     948   if (ResultCheck!=AiRBOOT_ConfigCheckSum) {
     949      puts ("SETABOOT: AiR-BOOT Config damaged!");
     950      *ab_bad = TRUE;
     951      return TRUE;
     952    }
     953   *ab_bad = FALSE;
     954   return TRUE;
    699955 }
     956
     957BOOL Track0WriteAiRBOOTConfig (void) {
     958   USHORT ResultCheck;
     959   USHORT CurSectorNo = 0;
     960
     961   // Update Edit-Counter...
     962   AiRBOOT_Config->EditCounter++;
     963   AiRBOOT_Config->CheckSumOfConfig = 0;
     964
     965   // Calculate CheckSum...
     966   ResultCheck = 0; CurSectorNo = 55;
     967   while (CurSectorNo<60) {
     968      ResultCheck = GetChecksumOfSector(ResultCheck, CurSectorNo);
     969      CurSectorNo++;
     970    }
     971   AiRBOOT_Config->CheckSumOfConfig = ResultCheck;
     972
     973   if (!Track0Write())
     974      return FALSE;
     975   return TRUE;
     976 }
     977
     978
     979/*
     980// Rousseau: # This is the main entry-point #
     981// Special behavior if eCS is booted from CDROM and phase 1 called this program.
     982// In that case, the name of the newly installed system is put in the AiR-BOOT configuration.
     983// This will cause AiR-BOOT to boot through after phase 1.
     984*/
     985int main (int argc, char **argv) {
     986   BOOL  AiRBOOTDetected   = FALSE;
     987   BOOL  Track0Loaded      = FALSE;                                              // Assume track0 did not load correctly.
     988   BOOL  AiRBOOTBad        = FALSE;
     989   int   rc                = -1;
     990
     991
     992   /*
     993   // Rousseau: ## Changed order to first check for AiR-BOOT existance ##
     994   // If AiR-BOOT is not installed, all action is passed-thru to IBM SETBOOT (SETBM.EXE).
     995   */
     996
     997
     998   /*
     999   // Try to load track zero.
     1000   // We don't care if no harddisk is present, since we first want to know if AiR-BOOT is
     1001   // installed to adjust our behaviour.
     1002   // If it's not installed, or a loading error occurs, all actions will be deferred to
     1003   // IBM SETBOOT (SETBM.EXE).
     1004   // This means we also let IBM SETBOOT handle the situation in which no HD's are present.
     1005   */
     1006   Track0Loaded = Track0Load();
     1007
     1008   /*
     1009   // Now see if AiR-BOOT is present.
     1010   // If there was a loading error, no AiR-BOOT signature will be present, so
     1011   // we pass-thru to IBM SETBOOT.
     1012   */
     1013   AiRBOOTDetected = Track0DetectAirBoot(&AiRBOOTBad);
     1014
     1015   if (AiRBOOTDetected) {
     1016      rc = DoAirBootActions(argc, argv, AiRBOOTDetected, AiRBOOTBad);
     1017   }
     1018   else {
     1019      rc = DoClassicActions(argc, argv);
     1020   }
     1021
     1022
     1023   return rc;
     1024 }
  • trunk/TOOLS/OS2/SETABOOT/SETABOOT.TGT

    r29 r30  
    22225
    2323MCommand
    24 0
     24117
     25@ren SETABOOT.EXE SETABOOT.XEX
     26@ren SETABOOT.XEX SETABOOT.EXE
     27copy SETABOOT.EXE ..\..\..\RELEASE\OS2\SETABOOT.EXE
     28
    25296
    2630MItem
    273112
    28 setaboot.exe
     32SETABOOT.EXE
    29337
    3034WString
     
    33378
    3438WVList
    35 2
     394
    36409
    37 MCState
     41MVState
    384210
    3943WString
     
    424611
    4347WString
     4822
     49?????Other options(,):
     501
     5112
     52WString
     5319
     54op map=SETABOOT.MAP
     550
     5613
     57MCState
     5814
     59WString
     607
     61OS2LINK
     6215
     63WString
    446413
    4565?????Map file
    46661
    47670
    48 12
     6816
    4969MCState
    50 13
     7017
    5171WString
    52727
    5373OS2LINK
    54 14
     7418
    5575WString
    567624
     
    58781
    59790
    60 15
     8019
     81MVState
     8220
     83WString
     847
     85OS2LINK
     8621
     87WString
     8822
     89?????Other options(,):
     900
     9122
     92WString
     9319
     94op map=SETABOOT.MAP
     950
     9623
     97WVList
     981
     9924
     100ActionStates
     10125
     102WString
     1035
     104&Make
     10526
    61106WVList
    621070
     
    651101
    661110
    67 16
     11227
    68113WPickList
    691142
    70 17
     11528
    71116MItem
    721173
    73118*.C
    74 18
     11929
    75120WString
    761214
    77122COBJ
    78 19
     12330
    79124WVList
    801250
    81 20
     12631
    82127WVList
    831280
     
    861311
    871320
    88 21
     13332
    89134MItem
    9013510
    91136SETABOOT.C
    92 22
     13733
    93138WString
    941394
    95140COBJ
    96 23
     14134
    97142WVList
    981430
    99 24
     14435
    100145WVList
    1011460
    102 17
     14728
    1031481
    1041491
  • trunk/TOOLS/OS2/SETABOOT/SETABOOT.WPJ

    r29 r30  
    551
    66WRect
    7 0
    8 0
     7840
     8620
    997680
    10 9216
     109210
    11112
    1212MProject
     
    2121WFileName
    222212
    23 setaboot.tgt
     23SETABOOT.TGT
    24246
    2525WVList
     
    31310
    32320
    33 5670
    34 4215
     335664
     344210
    35350
    36360
     
    3838WFileName
    393912
    40 setaboot.tgt
     40SETABOOT.TGT
    41410
    42420
Note: See TracChangeset for help on using the changeset viewer.