Changeset 51


Ignore:
Timestamp:
Apr 13, 2014, 3:50:38 PM (11 years ago)
Author:
Ben Rietbroek
Message:

AiR-BOOT v1.0.8-rc3 build-20120909 [2012-09-10]

With Git one can easily hop-skip-and-jump between branches.
So I use Git for my local repos and make use of this easy branching.
Because SVN can only handle lineair history, these branches had to be
rebased before committing them to Netlabs. So, this commit contains a
multitude of changes which makes it a bit hairy.

New

o Display LVM drive-letters in the main menu

A populair request was to show drive-letter information in the menu.
Drive-letters however, are OS specific and AiR-BOOT cannot
accurately predict what drive-letter other operating systems would
assign to what partition. eCS LVM drive-letters however are stored
in the LVM-record and can thus be displayed.

o Added 'Show LVM Drive Letters' option in SETUP/BASIC

This will toggle the display of LVM drive-letters in the main menu.
By default this option is enabled.

o Show popup message when BIOS INT13X extensions are not available

The system is halted.

o Show 'DEL to Power Off' in the bottom left corner

This tries to power-off the system, but it may not work for you.

o Simple interactive debugger

Outputs to the serial port with a few one-letter commands to dump
internal tables and state. (Only available in debug builds)

o Enhanced drive-letter feature

Enable multiple eCS installations using the same drive-letter.
This makes it possible to clone a system with the command
'XCOPY /h /o /t /s /e /r /v /e' to another drive and have that boot
from the same drive-letter.
(Or installing to the same drive by hiding the other system)

Changes

o Reduced MBR protection-image from 1024 to 768 bytes

Luckily the MBR Protection Image code does not exceed 768 bytes,
so that gives us another 256 bytes of precious code-space.
Now the non-EN versions are happy again.
Note that the alignment for the image changed from 512 to 256 bytes.
MBR-PROT.ASM, FIXCODE.C, PARTMAIN.ASM and AIR-BOOT.ASM have been
adjusted for this change.
The fight for code-space continues...

o Updating from v1.06 now also copies over drive-letters

When the user has forced drive-letters in v1.06 these will be copied
over to the v1.0.8 configuration when upgrading.
Because the drive-letter feature is broken in v1.07,
the drive-letter table does not get copied over when upgrading
from v1.07.

o Made FX-code optional to compile in

The FX-code supplies the shifting screen-effects when 'Cooper Bars'
is enabled in the setup. With the current enhancements made however,
there is a continuous lack of code-space, especially when debug-code
is included during development. The FX-code occupies some
1200 bytes, a space that can be put to better use. Therefore the
inclusion of the FX-code has been made conditional to make room for
either debugging or future new features.

o Also rewrite PBR on HPFS

Earlier, a fix was made to write a modified PBR back in case JFS was
used. This was done to enable the drive-letter feature on JFS, since
the PBR JFS-bootcode does not use the supplied PBR in memory.
With the enhancements in the drive-letter feature, the HPFS PBR
needs to be updated on disk also, to cope with zero drive-letters in
the HPFS PBR. This potentially fixes a missing drive-letter in the
PBR when the system is restored from an archive. You might need the
drive-letter feature to force the correct drive-letter on the first
boot, after which the feature can be disabled.

o Added extra MBR protection

When AiR-BOOT is active, it is only AiR-BOOT that writes to the MBR.
To protect the MBR from programming errors, like the one below,
any write to the MBR is now checked for validity.
In essence this is protecting your MBR from bad programming done
by me...

Fixes

o Fixed a minor bug with displaying LVM drive-letters

When more partitions that can be displayed were present, scrolling
the menu would not scroll the drive-letter. Fixed.

o Fixed a bug with regard to the drive-letter feature

When partitions were deleted, and some partitions above the deleted
partition(s) had a drive-letter forced, these partitions would lose
this assignment. This bug is also present in v1.06.

Note

The AIRBOOT.HIS file mentions a DOCU directory with the AiR-BOOT
documentation etc. However, this is not present in this commit and
will be provided at a later time.

Location:
trunk
Files:
1 added
49 edited

Legend:

Unmodified
Added
Removed
  • trunk/BOOTCODE/AIR-BOOT.ASM

    r50 r51  
    1919
    2020
    21 ;------------------------------------------------------------------------------
     21
     22
     23
     24
     25
     26;##############################################################################
    2227;                                                       AiR-BOOT / DEFINITIONS
    23 ;------------------------------------------------------------------------------
    24 ;
     28;##############################################################################
    2529
    2630;
    2731; Include AiR-BOOT Version Information.
     32; This version-info is defined using simpel EQU's so it can serve as a
     33; single source for other formats. The AiR-BOOT signature and the
     34; OS/2 BLDLEVEL use this basic version information.
    2835;
    2936Include VERSION.INC
     
    3138;
    3239; Include OS/2 BLDLEVEL Information.
     40; It uses the version-information in VERSION.INC to build it's signature.
    3341;
    3442Include BLDLEVEL.INC
    3543
    36 
    37 ; -------------------------
    38 ; Rousseau: JUMPS disabled
    39 ; -------------------------
     44;
     45; Include some macro's.
     46; This file contains the ORIGIN macro that is used to detect overlaps.
     47;
     48Include ../INCLUDE/ASM.INC
     49
     50
    4051; We actually don't want to use this directive because it generates extra
    4152; NOP instructions that we can do without.
    42 ; Relative conditional jumps that are out-of-range are manually reworked by
    43 ; skipping an unconditional jump to the target on base of complementary
    44 ; condition logic and temporary labels.
    4553; TASM also has a bug in that when the .ERR2 directive is used when
    4654; the .386 directive is in effect, the JUMPS directive is also active
     
    5462ENDIF
    5563
     64
    5665;
    5766; If defined then each module is prefixed with it's name.
    58 ; This is used for debugging purposes.
     67; This is used for debugging purposes but it also increases code space.
    5968; It should be off in release code.
    6069;
    61 ;ModuleNames             equ     1
    62 
    63 
    64 ;
    65 ; The first harddisk is BIOS coded 80h.
    66 ; This makes a total of 128 disk could be supported using this coding.
    67 ; This value is used to store disk-information and this info is allocated
    68 ; in the BSS.
    69 ;
    70 MaxDisks                equ     64
    71 
    72 
    73 
    74 
    75 ;
    76 ; Include Debug Modules and enable COM-port debugging.
     70;~ MODULE_NAMES    EQU
     71
     72
     73
     74; -----------------------------------------------------------------------------
     75;                                                                        DEBUG
     76; -----------------------------------------------------------------------------
     77
     78;
     79; Enable this to include Debug Modules and enable COM-port debugging.
     80; To have room for the debug-code, the FX-code can only be enabled
     81; when AUX_DEBUG is not defined.
    7782;
    7883;~ AUX_DEBUG       EQU
    7984
    80 
    81 
    82 
    83 
     85;
     86; To have FX enabled, make sure FX_ENABLE is defined.
     87; There is no need (for now) to remove Cooper Bars from the setup-menu
     88; because AiR-BOOT does not crash when enabling Cooper Bars while FX
     89; is not compiled in. Only TAB to post-screen does not work.
     90; Way to go Martin !
     91;
     92IFNDEF  AUX_DEBUG
     93FX_ENABLED      EQU
     94ENDIF
     95
     96;
     97; If ReleaseCode is not defined, it will produce debug-able code...
     98; Rousseau: This is currently *not* functional so don't use it !
     99;           It was used to debug AiR-BOOT as a .COM file.
     100;
     101ReleaseCode             equ     -1
     102
     103
     104; -----------------------------------------------------------------------------
     105;                                                                          AUX
     106; -----------------------------------------------------------------------------
    84107;
    85108; bits 7-5 = datarate
     
    106129
    107130
    108 ;
    109 ; If ReleaseCode is not defined, it will produce debug-able code...
    110 ;
    111 ReleaseCode             equ     -1
    112 
    113 
    114 ;
    115 ; All Special Equ's for this project
    116 ;
     131; -----------------------------------------------------------------------------
     132;                                                                       LABELS
     133; -----------------------------------------------------------------------------
     134; Address labels after code-move
     135BootBaseSeg                 equ     08000h   ; Pre-boot, in the low 640K
     136BootBasePtr                 equ         0h   ; We put our MBR to this location
     137BootBaseExec                equ     BootBasePtr+offset MBR_RealStart
     138StackSeg                    equ     07000h   ; Put the stack below the code
    117139
    118140; Use different addresses depending on whether in pre-boot
     
    129151ENDIF
    130152
    131 ; Address labels after code-move
    132 BootBaseSeg                 equ     08000h   ; Pre-boot, in the low 640K
    133 BootBasePtr                 equ         0h   ; We put our MBR to this location
    134 BootBaseExec                equ     BootBasePtr+offset MBR_RealStart
    135 StackSeg                    equ     07000h   ; Put the stack below the code
    136 
     153
     154
     155; -----------------------------------------------------------------------------
     156;                                                                        VIDEO
     157; -----------------------------------------------------------------------------
    137158; Video pages, no INT 10h is used for menu-drawing etc.
    138159VideoIO_Page0               equ     0B800h
     
    141162VideoIO_Page4               equ     0BC00h
    142163VideoIO_FXSegment           equ     0A000h
    143 
    144 ; Include some macro's
    145 Include ../INCLUDE/ASM.INC
    146164
    147165; Special line-drawing characters
     
    155173TextChar_WinRep6            equ     0D8h ; 'Ø'
    156174
    157 ; Offsets for Partition-Entries in MBR/EPRs
     175
     176
     177; -----------------------------------------------------------------------------
     178;                                                              PARTITION TABLE
     179; -----------------------------------------------------------------------------
     180; Offsets for Partition-Entries in MBR/EBRs
    158181LocBRPT_LenOfEntry          equ     16  ; Length of a standard MBR or EPR entry
    159182LocBRPT_Flags               equ     0   ; Bootable, Hidden, etc.
    160 LocBRPT_BeginCHS            equ     1   ; Combined 10-bits cyl with 6 bits
    161 LocBRPT_BeginHead           equ     1   ; Start head      (0<=H<255)    255 is invalid !
    162 LocBRPT_BeginSector         equ     2   ; Start sector    (1<=S<=255)
    163 LocBRPT_BeginCylinder       equ     3   ; Start cylinder  (0<=C<[1024,16384,65536,n])
     183LocBRPT_BeginCHS            equ     1   ; Packed CHS value
     184LocBRPT_BeginHead           equ     1   ; Start head, usually < 16
     185LocBRPT_BeginSector         equ     2   ; Start sector, max 63 + cyl high bits
     186LocBRPT_BeginCylinder       equ     3   ; Start cylinder 8+2 bits, max 1023
    164187LocBRPT_SystemID            equ     4   ; Type of system using the partition
    165 LocBRPT_EndCHS              equ     5   ; Same for end of partition
    166 LocBRPT_EndHead             equ     5
    167 LocBRPT_EndSector           equ     6
    168 LocBRPT_EndCylinder         equ     7
    169 LocBRPT_RelativeBegin       equ     8
    170 LocBRPT_AbsoluteLength      equ     12
    171 
    172 LocBR_Magic                 equ     510
    173 
    174 
     188LocBRPT_EndCHS              equ     5   ; Packed CHS value
     189LocBRPT_EndHead             equ     5   ; End head, usually < 16
     190LocBRPT_EndSector           equ     6   ; End sector, max 63 + cyl high bits
     191LocBRPT_EndCylinder         equ     7   ; End cylinder 8+2 bits, max 1023
     192LocBRPT_RelativeBegin       equ     8   ; LBA32 address of partition
     193LocBRPT_AbsoluteLength      equ     12  ; 32-bit length of partition
     194
     195; Signature relative to start of MBR/EBR
     196LocBR_Magic                 equ     510 ; Offset of 0AA55h signature
     197
     198; -----------------------------------------------------------------------------
     199;                                                                   LVM RECORD
     200; -----------------------------------------------------------------------------
    175201; Used as a quick compare in LVM.ASM
    176202LocLVM_SignatureByte0       equ     02h
     
    193219LocLVM_MaxEntries           equ     4   ; Max entries in an LVM-sector
    194220
     221
     222; -----------------------------------------------------------------------------
     223;                                                                    LVM ENTRY
     224; -----------------------------------------------------------------------------
    195225; Offsets for LVM entry.
    196226; These are relative to the start of the entry.
    197 LocLVM_VolumeID             equ     00h ; is DWORD
    198 LocLVM_PartitionID          equ     04h ; is DWORD
    199 LocLVM_PartitionSize        equ     08h ; is DWORD
    200 LocLVM_PartitionStart       equ     0ch ; is DWORD
     227LocLVM_VolumeID             equ     00h ; DWORD
     228LocLVM_PartitionID          equ     04h ; DWORD
     229LocLVM_PartitionSize        equ     08h ; DWORD
     230LocLVM_PartitionStart       equ     0ch ; DWORD
    201231LocLVM_OnBootMenu           equ     10h ; is on IBM BM Bootmenu
    202232LocLVM_Startable            equ     11h ; is Startable (newly installed system)
    203 LocLVM_VolumeLetter         equ     12h ; is Drive Letter for partition (C-Z or 0)
    204 LocLVM_Unknown              equ     13h ; unknown BYTE
     233LocLVM_VolumeLetter         equ     12h ; Drive Letter for partition (C-Z or 0)
     234LocLVM_Unknown              equ     13h ; unknown BYTE (can be used ?)
     235LocLVM_InstallLetter        equ     13h ; unknown BYTE (can be used ?)
    205236
    206237; Truncated to 11 chars when  displayed in menu.
     
    213244
    214245; LVM constants.
    215 LocLVM_LabelLen             equ     14h ; Length of an LVM Label (Disk/Part/Vol)
    216 LocLVM_DiskNameLen          equ     14h ; Length of an LVM DiskName
    217 LocLVM_VolumeNameLen        equ     14h ; Length of an LVM VolumeName
    218 LocLVM_PartitionNameLen     equ     14h ; Length of an LVM PartitionName
    219 
    220 
    221 
     246LocLVM_LabelLen             equ     14h ; Length of LVM Label (Disk/Part/Vol)
     247LocLVM_DiskNameLen          equ     14h ; Length of LVM DiskName
     248LocLVM_VolumeNameLen        equ     14h ; Length of LVM VolumeName
     249LocLVM_PartitionNameLen     equ     14h ; Length of LVM PartitionName
     250
     251
     252; -----------------------------------------------------------------------------
     253;                                                                 AiR-BOOT IPT
     254; -----------------------------------------------------------------------------
    222255; Offsets for IPT (Internal Partition Table)
    223 LocIPT_MaxPartitions        equ     partition_count ; 45 in v1.07
     256LocIPT_MaxPartitions        equ     max_partitions  ; 45 in v1.07+
    224257LocIPT_LenOfSizeElement     equ     6   ; Size of one Size-Element
    225258LocIPT_LenOfIPT             equ     34  ; Length of an IPT-entry
     
    228261LocIPT_Drive                equ     15  ; Drive-ID             (80h,81h)
    229262LocIPT_SystemID             equ     16  ; Partition-Type       (06,07,etc)
    230 LocIPT_Flags                equ     17  ; AiR-BOOT Flags for partition (see below)
     263LocIPT_Flags                equ     17  ; AiR-BOOT Flags for part (see below)
    231264LocIPT_BootRecordCRC        equ     18  ; CRC of Boot-Record
    232265LocIPT_LocationBegin        equ     20  ; Begin of Partition
     
    235268LocIPT_AbsolutePartTable    equ     30  ; Absolute Sector of PartTable
    236269
    237 ; Hidden Partition Table
    238 ;~ LocHPT_LenOfHPT             equ     30  ; Length of an HPT-entry
    239 ; Length of an HPT-entry ((45 * 6 bits-per-part) / 8) * 45
    240 ; Packed table !
    241 LocHPT_LenOfHPT             equ     34
    242270
    243271; AiR-BOOT IPT-Flags
    244272LocIPT_DefaultFlags         equ     00000011b   ; Don't know if boot-able :)
    245 LocIPT_DefaultNonBootFlags  equ     00000010b   ; ...VIBR Detection is always on
     273LocIPT_DefaultNonBootFlags  equ     00000010b   ; VIBR Detection is always on
    246274
    247275Flags_Bootable              equ     00000001b
     
    259287FileSysFlags_DriveLetter    equ     01000000b   ; DriveLetter Feature possible
    260288
     289
     290; -----------------------------------------------------------------------------
     291;                                                                 AiR-BOOT HPT
     292; -----------------------------------------------------------------------------
     293; Hidden Partition Table
     294; Length of an HPT-entry ((45 * 6 bits-per-part) / 8) * 45
     295; 33.75 = 34 bytes for HPT-entry, coincidently same as length of IPT-entry.
     296; Packed table !
     297LocHPT_LenOfHPT             equ     34
     298
     299
     300; -----------------------------------------------------------------------------
     301;                                                              NAVIGATION KEYS
     302; -----------------------------------------------------------------------------
    261303; Navigation keys
    262304Keys_Up                     equ     48h
     
    274316Keys_F1                     equ     3Bh
    275317Keys_F10                    equ     44h
    276 Keys_C                      equ     2Eh     ; Add. Check auf Ctrl!
     318Keys_C                      equ     2Eh     ; Add. Check for Ctrl!
    277319Keys_Y                      equ     2Ch
    278320Keys_Z                      equ     15h
     
    286328
    287329
    288 
    289 
    290 
    291 
    292 ;------------------------------------------------------------------------------
     330; -----------------------------------------------------------------------------
     331;                                                                         MISC
     332; -----------------------------------------------------------------------------
     333; Initial value for the FreeDriveletterMap
     334; Meaning A,B not free; C-Z free, rest unused. (right to left)
     335; Each partition with an assigned drive-letter clears a bit in this map.
     336; (Not implemented yet)
     337InitialFreeDriveletterMap   equ     00000011111111111111111111111100b
     338
     339;
     340; The first harddisk is BIOS coded 80h.
     341; This makes a total of 128 disks that could be supported using this coding.
     342; This value is used to store disk-information and this info is allocated
     343; in the BSS. 64 disks ought to be enough for everybody :-)
     344;
     345MaxDisks                    equ     64
     346
     347
     348
     349
     350
     351
     352;##############################################################################
    293353;                                                         AiR-BOOT / MAIN-CODE
    294 ;------------------------------------------------------------------------------
    295 
    296 ; ------------------------------------------
    297 ; Rousseau: # Changed this from .386 to .286
    298 ; ------------------------------------------
     354;##############################################################################
     355
     356;
    299357; Because of the TASM-bug the processor had to be changed to turn JUMPS
    300358; off. Existing movzx instructions were replaced with 286 equivalent code.
    301359; Out of range relative jumps have been recoded.
    302 ; TASM still generates an extra NOP after test [mem],1
    303 ; instructions.
    304 ; JWasm produces tighter code.
    305 ; JWasm:
    306 ; With segment overrides, the address is expanded to the bit-width.
    307 ; So, .386 will generate a 32-bit address, even in a USE16 segment.
     360;
     361; Since version 1.0.8, JWasm is the preferred assembler and Tasm will be
     362; dropped. Also, the chances of AiR-BOOT being used on a 286-machine are
     363; very slim, so a future version will revert back to .386 and also incorporate
     364; 32-bit code. This will enable some enhanced constructs such as scaled
     365; indexing, bit-instructions, 32-bit registers and what not.
     366;
    308367.286
    309368
    310 ; This influences the uses directive and other stuff,
    311 ; like calling-style and local variables.
    312 ; The model itself,large, has no effect because we generate
    313 ; a binairy image and not a segmented executable.
    314 
    315 ; Tasm needs a memory model for USES on PROC to work.
     369;
     370; For Tasm, MODEL is needed for the USES directive to work.
     371; So always use a model when assembling with Tasm otherwise registers on
     372; function calls that use USES are not saved and restored.
     373; The model itself, has no real effect because we generate a binary image
     374; and not a segmented executable.
     375; For the other assemblers we define no model to get rid of the default C/C++
     376; segments for future object-linked versions of AiR-BOOT.
     377;
    316378IFDEF   TASM
    317379    ;~ .model large, basic
     
    320382
    321383;
    322 ; This is used to switch between the original 1-segment (code_seg) and the
    323 ; 2-segment (code_seg and bss_data).
     384; The below is used to switch between the original 1-segment (code_seg) layout
     385; and the new 2-segment (code_seg and bss_data) layout.
     386; It will be removed in future versions.
    324387; The 2-segment layout was needed for JWasm because it does not treat
    325 ; db ? in a code segment as bss-data, even if at the end of the code segment.
     388; db ? at the end of a code segment as bss-data.
    326389; Therefore, a true BSS segment is now used.
    327 ; Both the code_seg and the bss_data are grouped to the logical airboot
     390; Both the code_seg and the bss_data are grouped to the logical AIRBOOT
    328391; segment.
    329392; Note that this influences the offsets in the BSS in the list-file and
     
    334397SEGMENTED   EQU
    335398
    336 IFDEF   SEGMENTED
    337     AIRBOOT     GROUP   LDRIMAGE,VOLATILE
    338 ENDIF
    339 
    340 ; Our code-segment starts here.
    341 LDRIMAGE    SEGMENT     USE16   PUBLIC  'CODE'
    342 
    343 IFDEF   SEGMENTED
    344     ASSUME  CS:AIRBOOT, DS:AIRBOOT, ES:nothing, SS:nothing
    345 ELSE
    346     ASSUME  CS:LDRIMAGE,DS:LDRIMAGE,ES:nothing, SS:nothing
    347 ENDIF
     399    IFDEF   SEGMENTED
     400        AIRBOOT     GROUP   LDRIMAGE,VOLATILE
     401    ENDIF
     402
     403    ; Our code-segment starts here.
     404    LDRIMAGE    SEGMENT     USE16   PUBLIC  'CODE'
     405
     406    IFDEF   SEGMENTED
     407        ASSUME  CS:AIRBOOT, DS:AIRBOOT, ES:nothing, SS:nothing
     408    ELSE
     409        ASSUME  CS:LDRIMAGE,DS:LDRIMAGE,ES:nothing, SS:nothing
     410    ENDIF
     411
     412
    348413
    349414;==============================================================================
    350                                                                     ; Sector 1
    351 
    352 ;##############################################################################
     415;                                                                     Sector 1
     416;==============================================================================
     417
     418;------------------------------------------------------------------------------
    353419                ; We are not a .COM file at 100h but a BINARY image
    354420                ; of which only the 1st sector gets loaded at 0000:07c00h
     
    357423                ; Then it jumps to a new entry-point and loads the rest of
    358424                ; the image to the new location.
    359                 org 00000h                          ; Sector 1
    360 ;##############################################################################
    361 
    362 
    363 ;
    364 ; Start of sector 1
    365 ; This is the MBR.
    366 ; Note the AiRBOOT signature, it's date, version and language.
    367 ; Version 1.07 was intruduced in 2011, version 1.0.8 in 2012.
    368 ; These new versions fix issues with huge drives, lvm and more.
    369 ; For a detailed description see AIR-BOOT.HIS.
    370 ;
    371 
    372 ;
    373 ; ---------------------------------------------
    374 ; Rousseau: # Combined letter and jump offset #
    375 ; ---------------------------------------------
     425                org 00000h
     426;------------------------------------------------------------------------------
     427
     428
     429;
     430; Since AiR-BOOT is a boot-loader residing in track0, the first 512 bytes
     431; have the layout of a Master Boot Record (MBR). When AiR-BOOT get's installed,
     432; the first 512 bytes of this code get's merged with the Partition Table.
     433; The rest is installed in the remaining sectors with sector 62 (LBA 61)
     434; being the last sector used by AiR-BOOT. Sector 63 is reserved for IBM LVM.
     435; The last sector used by AiR-BOOT is a copy of the MBR that AiR-BOOT makes
     436; every time a system gets booted.
     437;
     438
     439;
     440; Due to the addition of an extra 'I13X' sugnature and code to preserve the
     441; values of the registers on entry, the MBR-code has become a bit messy.
     442; This will be cleaned-up in future versions.
     443;
     444
     445;
    376446; Martin had a short jump followed by the AiRBOOT signature at first.
    377447; Then he encountered strange behaviour by some M$ operating-systems
    378448; if the the first insruction was not a CLI.
    379449; But there was no room to insert the CLI and of course he did not want to
    380 ; change the location of the AiRBOOT signature.
     450; change the location of the AiR-BOOT signature.
    381451; He solved this by inserting the M$ needed CLI at offset 0 followed by a short
    382 ; jump that uses the 'A' of the AiRBOOT signature as the jump displacement.
    383 ;
    384 
    385 
    386 ;------------------------------------------------------------------------------
     452; jump that uses the 'A' of the AiR-BOOT signature as the jump displacement.
     453;
     454
     455
     456; -----------------------------------------------------------------------------
     457;                                                            FIRST ENTRY-POINT
     458; -----------------------------------------------------------------------------
     459; ######################################################
     460; # ENTRY-POINT WHERE THE BIOS TRANSFERS CONTROL TO US #
     461; ######################################################
    387462AiR_BOOT:
    388 
    389         ; Some M$ operating systems need a CLI
    390         ; here otherwise they will go beserk
    391         ; and will do funny things during
    392         ; boot phase, it's laughable!
    393         cli
    394 
    395         ; JMP-Short -> MBR_Start
    396         ; Uses the 'A' from the signature as the displacement !
    397         db      0EBh
    398 
    399         ; ID String, Date (DD,MM,CC,YY), Version Number, Language ID
    400         ;~ db      'AiRBOOT', 24h, 02h, 20h, 12h, 01h, 08h, TXT_LanguageID
    401         InsertAirbootSignature  TXT_LanguageID
    402 
    403         ; Total Sectors Count.
    404         ; Will get overwritten by FIXCODE.
    405         db      1
    406 
    407         ; Total Sectors Count,
    408         ; Dynamic calculation.
    409         ;~ db      (code_end-$)/512
    410 
    411 
    412 MBR_CheckCode   dw      0               ; Check-Sum for Code
    413 
     463                ; Some M$ operating systems need a CLI
     464                ; here otherwise they will go beserk
     465                ; and will do funny things during
     466                ; boot phase, it's laughable!
     467    MBR_1stOpc: cli
     468
     469                ; JMP-Short -> MBR_Start
     470                ; Uses the 'A' from the signature as the displacement !
     471    MBR_JmpOpc  db      0EBh
     472
     473                ; ID String, Date (DD,MM,CC,YY), Version Number, Language ID
     474                ;~ db      'AiRBOOT',24h,02h,20h,12h,01h,08h,TXT_LanguageID
     475    MBR_ABSig:  InsertAirbootSignature  TXT_LanguageID
     476
     477                    ; Total Code Sectors Count.
     478                    ; Actual value will be inserted by FIXCODE.
     479    MBR_CodeSecs    db      1
     480
     481                    ; Total Code Sectors Count, dynamically calculated.
     482                    ;~ db      (code_end-$)/512
     483
     484                    ; Check-Sum for Code
     485    MBR_CheckCode   dw      0
     486
     487
     488
     489; -----------------------------------------------------------------------------
     490;                                                            THIRD ENTRY-POINT
     491; -----------------------------------------------------------------------------
    414492;
    415493; No single instruction below should be changed, added or removed in the code
     
    417495;
    418496MBR_Start:
    419                 sti                     ;    This opcode is dedicated to:
    420                 cld                     ;    =MICROSOFT JUMP DEPARTMENT=
    421 
     497                ;
     498                ; When we arrive here, no registers have been used yet.
     499                ; So, they still contain the values the BIOS left in them.
     500                ; We want to preserve those value's for later inspection
     501                ; by putting them on the stack.
     502                ;
     503
     504                ; No space for this instruction here.
     505                ; We'll enable interrupts later.
     506                ;sti            ; This opcode is dedicated to:
     507                                ; =MICROSOFT JUMP DEPARTMENT=
     508
     509
     510                ; Push all registers with values provided by the BIOS
     511                ; on the stack.
     512                pusha
     513                ; Temporary save SS and SP so we still have access to this
     514                ; stack after we have setup our own.
     515                mov     dx,ss
     516                mov     bx,sp
     517
     518                ;
    422519                ; Setup some base stuff
    423520                ; AX got loaded wrongly for debug, changed the instructions
    424521                ; without modifying the number of bytes.
    425                 ; Don't comment-out the redundant instruction below because this
     522                ; Don't comment-out the redundant instruction below because it
    426523                ; *will* change the number of bytes and break the jump-chain.
    427                 mov     ax, StartBaseSeg    ; The segment we are moving ourself from (NOT USED)
     524                ;
     525
     526                ; The segment we are moving ourself from (NOT USED)
     527                ;mov     ax, StartBaseSeg
    428528                ;mov     ds, ax
     529
     530                ; Make sure DS points to CS.
    429531                push    cs
    430532                pop     ds
    431                 mov     si, StartBasePtr    ; The offset we are moving ourself from
    432                 mov     ax, BootBaseSeg     ; The target segment we are moving ourself to
     533
     534                ; Setup the source and destination for the code move.
     535                mov     si, StartBasePtr    ; The offset we move ourself from
     536                mov     ax, BootBaseSeg     ; The target segment we move to
    433537                mov     es, ax
    434                 mov     di, BootBasePtr     ; The target offset we are moving ourself to
    435 
    436             ; Depending on pre-boot or debug,
    437             ; only move first 512 bytes or the whole she-bang++ (65400 bytes)
     538                ;mov     di, BootBasePtr    ; The target offset we move to
     539                ; Changed the instruction to make room.
     540                ; So, BootBasePtr is not used !
     541                ; The offset in the target segment is assumed to be 0000
     542                ; anyway.
     543                xor     di,di
     544                ;sti
     545
     546            ; Depending on pre-boot or debug.
     547            ; Note that ReleaseCode is obsolete, so we will always move
     548            ; 256 words; aka this sector, the MBR.
    438549            IFDEF ReleaseCode
    439550                mov     cx, 256          ; Pre-boot environment
    440551            ELSE
    441                 mov     cx, 32700        ; Debug environment (move ~64kB)
     552                mov     cx, 32700        ; Old Debug environment (move ~64kB)
    442553            ENDIF
    443554
    444555                ;
    445                 ; LET's MOVE OURSELVES !
    446                 ;
     556                ; This moves this 512-byte sector, loaded by the BIOS at
     557                ; 0000:7c00 to 8000:0000.
     558                ;
     559                cld
    447560                rep     movsw
    448561
    449                 ; Code an intersegment jump to the new location
     562                ; Code an intersegment jump to the new location.
     563                ; jmp    BootBaseSeg:BootBaseExec
     564                ; Note that DX:BX containts the old SS:SP.
    450565                db      0EAh
    451566                dw      BootBaseExec    ; This is MBR_RealStart + BootBasePtr
    452567                dw      BootBaseSeg     ; This is 08000h
    453                 ;jmp     far ptr BootBaseSeg:BootBaseExec
    454 
    455 
     568
     569
     570
     571
     572; -----------------------------------------------------------------------------
     573;                                                         SIMPLE MBR FUNCTIONS
     574; -----------------------------------------------------------------------------
    456575;
    457576; Some MBR-functions to provide absolute minimum functionality.
     
    469588                cli
    470589                jmp     MBR_HaltSys
    471 ;db 100 dup (0)
    472 
    473590
    474591
     
    478595                ORIGIN  0003Ch
    479596
    480 ; Comport settings
    481 ; It had to be moved to create room for the double I13X
    482 ; signature.
     597; Comport settings.
     598; It had to be moved to create room for the double I13X signature.
    483599; It cannot be in the config-area (sector 55)
    484600; because that area is crc-protected and would not allow 'poking'.
    485601BIOS_AuxParms   dw      BIOS_AUXPARMS_DEFAULT
    486602
     603
     604IFDEF   AUX_DEBUG
    487605reserved        db      6   dup('X')
    488 
    489 
     606ELSE
     607reserved        db      6   dup(0)
     608ENDIF
     609
     610
     611
     612
     613; -----------------------------------------------------------------------------
     614;                                                           SECOND ENTRY-POINT
     615; -----------------------------------------------------------------------------
    490616                ;
    491617                ; We arrive here after the first jump using the 'A' of the
    492                 ; AiR-BOOT signature.
    493                 ; So we ensure the jump is always at this offset.
    494                 ; We jump here, because Martin needed to
    495                 ; insert a CLI on start and did not
    496                 ; want to change the AiR-BOOT signature
    497                 ; because of Microsoft inventions...
     618                ; AiR-BOOT signature. So we ensure the jump is always at
     619                ; this offset. We jump here, because Martin needed to
     620                ; insert a CLI on start and did not want to change the
     621                ; AiR-BOOT signature because of Microsoft inventions...
    498622                ;
    499623                ORIGIN  00044h
    500624
    501625                ; Jump again...
    502                 ; This time to the setup-code.
     626                ; This time to the code that relocates to 8000:0000.
    503627                jmp     MBR_Start
    504628
     
    573697
    574698
    575 ;
    576 ; This is where the rest of AiR-BOOT gets loaded.
     699; -----------------------------------------------------------------------------
     700;                                                    ENTRY-POINT OF MOVED CODE
     701; -----------------------------------------------------------------------------
     702
     703;
     704; When we arrive here we are running at 8000:0000.
     705; DX:BX contains the SS:SP of the old stack.
     706;
     707
     708;
     709; This is where the rest of AiR-BOOT gets loaded from track0.
    577710;
    578711
    579712;------------------------------------------------------------------------------
    580713MBR_RealStart:
     714                ;
     715                ; Setup new stack and other segment registers.
     716                ;
    581717                mov     ax, StackSeg    ; 07000h, below the moved code
    582718                mov     ss, ax
    583                 ;mov     sp, 7FFFh      ; Odd stack-pointer ??
    584719                mov     sp, 7FFEh       ; Even is better
    585                 mov     ax, es          ; ES holds segment where we moved to
    586                 mov     ds, ax          ; Set DS==ES to Code Segment
     720                push    es              ; ES holds segment where we moved to
     721                pop     ds              ; Set DS==ES to Code Segment
     722
     723                ;
     724                ; Push the old SS:SP which was saved in DX:BX on the new stack.
     725                ;
     726                push    dx      ; Old SS
     727                push    bx      ; Old SP
    587728
    588729
     
    592733            ; loaded by dos while when air-boot is active from the MBR it
    593734            ; does the loading itself.
     735            ; (This debug environment is obsolete and dis-fuctional)
    594736            IFNDEF ReleaseCode
    595737                jmp     AiR_BOOT_Start
    596738            ENDIF
    597739
    598 
    599                 ; Load missing parts from harddrive...
    600                 ;mov     ax, cs          ; actually obsolete
    601                 ;mov     es, ax          ; actually obsolete
    602 
    603740                ; Load the configuration-sectors from disk.
     741                ; These are the main configuration sector and the various
     742                ; tables that follow it upto but not including the MBR backup.
    604743                mov     bx, offset Configuration
    605                 mov     dx, 0080h       ; First harddrive, Sector 55
    606                 mov     cx, 0037h       ; Is 55d is config-sector
     744                mov     dx, 0080h       ; First harddrive
     745                mov     cx, 0037h       ; Config sector is at 55d (CHS)
    607746
    608747                ; Call the i/o-part
    609748                call    MBR_LoadConfig
    610 
    611749                jnc     MBR_ConfigCopy_NoError
    612750
    613751                ; Some error occured
    614752    MBR_ConfigCopy_LoadError:
    615                 call    MBR_LoadError   ; Will Abort BootUp
     753                call    MBR_LoadError               ; Will Abort BootUp
    616754
    617755                ; Load the code sectors
    618756    MBR_ConfigCopy_NoError:
    619                 mov     bx, offset FurtherMoreLoad
    620                 mov     dx, 0080h       ; First harddrive
    621                 mov     cx, 0002h       ; Second sector
    622                 mov     ah, 02h
    623 
    624                 ; This location is in the code-segment.
    625                 ; When segment overrides are applied, the address is
    626                 ; expanded to the bit-with.
    627                 ; So the .286 or .386 directive influences the length
    628                 ; of the instruction, even with a USE16 segment.
    629                 mov     al, ds:[10h]    ; Number of code sectors
    630                 int     13h
     757                mov     bx, offset FurtherMoreLoad  ; Directly after MBR in mem
     758                mov     dx, 0080h                   ; First harddrive
     759                mov     cx, 0002h                   ; Start at second sector
     760                mov     ah, 02h                     ; Read sectors
     761
     762                ; This location is in the MBR.
     763                ; It is filled in by the FIXCODE helper that post processes
     764                ; the AIRBOOT loader image after it has been built.
     765                ; FIXCODE also embeds the MBR protection-image.
     766                mov     al, ds:[10h]                ; Number of code sectors
     767                int     13h                         ; Call BIOS service
    631768                jnc     MBR_RealStart_NoError
    632769                jmp     MBR_ConfigCopy_LoadError
     
    645782                ; Update: These are actually MOV EAX,'X31I' instructions
    646783                ; in the eCS LVM MBR-code. They are at different places in
    647                 ; the v1.x and v2.x LVM code.
    648                 ; Let's protect their location.
     784                ; the v1.x and v2.x LVM MBR-code. Other code might depend on
     785                ; their presence. Let's protect their location.
    649786                ORIGIN  000d0h
    650787                db      'I13X',0,'I13X',0
     
    659796                mov     ch,0
    660797
     798                ; Claculate checksum
    661799                xor     bx, bx
    662800    MBR_RealStart_CheckCodeLoop:
     
    675813                call    MBR_Teletype
    676814                jmp     MBR_HaltSystem
     815
     816
     817                ;
     818                ; OK, all loading went fine so the rest of the code
     819                ; is present now, so we jump to it.
     820                ; The old SS:SP is still on the stack.
     821                ;
    677822    MBR_RealStart_CheckSuccess:
    678823                jmp     AiR_BOOT_Start
     
    683828
    684829;------------------------------------------------------------------------------
    685    Include TEXT/TXTMBR.ASM                     ; All translateable Text in MBR
     830Include TEXT/TXTMBR.ASM                        ; All translateable Text in MBR
    686831;------------------------------------------------------------------------------
    687832
     
    711856
    712857                ; AiR-BOOT will merge the field from the MBR it replaces.
    713                 db      'DSIG'
     858    MBR_DrvSig  db      'DSIG'
    714859
    715860                ; Unused word at 01BCh.
    716861                ; An LVM 2.x MBR puts 0CC33h here.
    717862                ; AiR-BOOT will merge the field from the MBR it replaces.
    718                 dw      '$$'
     863    MBR_Spare   dw      '$$'
    719864
    720865
     
    726871                ; The 4 entries just for show.
    727872                ; AiR-BOOT will merge them from the MBR it replaces.
     873    MBR_PartTable:
    728874                db      16  dup('0')
    729875                db      16  dup('1')
     
    732878
    733879                ; Boot Sigbature
    734                 dw      0aa55h
    735 
    736 ; End of sector 1
     880    MBR_Sig     dw      0aa55h
     881
     882
    737883
    738884
     
    741887
    742888;==============================================================================
    743                                                                     ; Sector 2
    744 
    745                 ;
    746                 ; Here starts the second sector, sector 2
    747                 ;
     889;                                                                     Sector 2
     890;==============================================================================
     891
     892; -----------------------------------------------------------------------------
     893;                                                           FILE-SYSTEM TABLES
     894; -----------------------------------------------------------------------------
     895
     896
    748897                ORIGIN  00200h
    749898
     
    759908
    760909                ; first Normal-Partition-ID, Hidden-Partition-ID
    761                 ;  and Default-Partition-Flags.
     910                ; and Default-Partition-Flags.
    762911                ; 01h -> Boot-Able
    763912                ; 10h -> FAT32 - Name Getting Scheme
     
    795944
    796945
     946
     947
    797948;==============================================================================
    798                                                                     ; Sector 3
    799                 ;
    800                 ; Sector 3
    801                 ;
     949;                                                                     Sector 3
     950;==============================================================================
     951
     952; -----------------------------------------------------------------------------
     953;                               ENTRY-POINT AFTER LOADING THE REST OF THE CODE
     954; -----------------------------------------------------------------------------
     955
    802956                ORIGIN  00400h
    803957
    804958
    805                 ; ##############################################
    806                 ; ## ENTRY-POINT AFTER ALL THE INITIAL HASSLE ##
    807                 ; ##############################################
    808 
    809 
    810 
    811 
     959; ############################################
     960; # ENTRY-POINT AFTER ALL THE INITIAL HASSLE #
     961; ############################################
    812962AiR_BOOT_Start:
    813963
    814964
    815 
     965        ;
     966        ; Enable interrupts.
     967        ;
     968        sti
     969
     970        ;
     971        ; Pop the old SS:SP from the stack and save it in the BSS.
     972        ;
     973        pop     [OldSP]
     974        pop     [OldSS]
     975
     976
     977; -----------------------------------------------------------------------------
     978;                                                      IBM-BM BOOT PREPARATION
     979; -----------------------------------------------------------------------------
    816980        ;
    817981        ; Since v1.0.8, AiR-BOOT is able to chainload IBM-BM.
     
    826990        ; 0000:7E00 in case the partition that will be started is IBM-BM.
    827991        ; This copy is located at 8000:0000 and DS already points to this
    828         ; segment.
     992        ; segment. The 'I13X' signature and FS will be setup later.
    829993        ;
    830994        pusha                           ; Save all the general purpose regs
     
    8411005
    8421006
    843                 ;~ nop
    844                 ;~ mov     ax, offset sobss
    845                 ;~ mov     ax,offset BeginOfVariables
    846                 ;~ mov     ax,offset [TrueSecs]
    847                 ;~ lea     ax, [TrueSecs]  ; Tasm generates mov here
    848                 ;~ mov     ax,word ptr [TrueSecs]
    849                 ;~ mov     ax,offset EndOfVariables
    850                 ;~ mov     ax, offset eobss
    851                 ;~ nop
    852 
    853 
    854 
    855                 ;jmp skip
    856 
    857                 mov     al, byte ptr [CFG_Partitions]
    858                 mov     byte ptr [OldPartitionCount], al
    859 
    860                 ; Initialize Variable-Tables, Detections, etc.
     1007; -----------------------------------------------------------------------------
     1008;                                                                      PRECRAP
     1009; -----------------------------------------------------------------------------
     1010
     1011                ;
     1012                ; First it clears the BSS area.
     1013                ; Note that the old SS:SP is stored outside this area so ti
     1014                ; does not get lost.
     1015                ; Then initialize various runtime variables and structures.
     1016                ;
    8611017                call    PRECRAP_Main
    862 
    863                 ; Number of harddisks is now known
    864 
    865 IFDEF   AUX_DEBUG
     1018                ; Number of harddisks and other system-info is now known.
     1019
     1020            ;!
     1021            ;! DEBUG_BLOCK
     1022            ;! Let's see what the BIOS supplied us with...
     1023            ;! Uncomment below to activate.
     1024            ;!
     1025            __DUMP_BIOS_REGS__  EQU
     1026            IFDEF   AUX_DEBUG
     1027                IFDEF   __DUMP_BIOS_REGS__
     1028                    pushf
     1029                    pusha
     1030                    ; Print title.
     1031                    mov     si,offset [bios_reg]
     1032                    call    AuxIO_Print
     1033                    ; Save the current stack (SS:SP).
     1034                    mov     ax,ss
     1035                    mov     [CurrentSS],ax
     1036                    mov     [CurrentSP],sp
     1037
     1038                    ; Restore the old stack.
     1039                    mov     ss,[OldSS]
     1040                    mov     sp,[OldSP]
     1041
     1042                    ; Pop the registers with the BIOS values.
     1043                    popa
     1044                    ; Push them back for AiR-BOOT restart (debug mode).
     1045                    pusha
     1046                    ; Dump them to the serial-port.
     1047                    call    DEBUG_DumpRegisters
     1048                    ; Restore the current stack.
     1049                    mov     ax,[CurrentSS]
     1050                    mov     ss,ax
     1051                    mov     sp,[CurrentSP]
     1052
     1053                    ; Restore registers.
     1054                    popa
     1055                    popf
     1056                ENDIF
     1057            ENDIF
     1058
     1059
     1060
     1061
     1062            ;!
     1063            ;! DEBUG_BLOCK
     1064            ;! Dump the registers at this point.
     1065            ;! Uncomment below to activate.
     1066            ;!
     1067            IFDEF   AUX_DEBUG
     1068                ;~ call    DEBUG_DumpRegisters
     1069                ; Dump drive-letters of dl-feature before partitions are
     1070                ; scanned and processed.
     1071                call    DEBUG_DumpDriveLetters
     1072                call    DEBUG_DumpVolumeLetters
     1073                call    DEBUG_DumpPartitionXref
     1074            ENDIF
     1075
     1076; -----------------------------------------------------------------------------
     1077;                                                               PARTITION SCAN
     1078; -----------------------------------------------------------------------------
     1079                ;
     1080                ; Scan all partitions
     1081                ;
     1082                call    PARTSCAN_ScanForPartitions
     1083                ; Internal Partition Table is now populated.
     1084
     1085            ;!
     1086            ;! DEBUG_BLOCK
     1087            ;! Dump various tables.
     1088            ;! Uncomment below to activate.
     1089            ;!
     1090            IFDEF   AUX_DEBUG
    8661091                ;~ call    DEBUG_DumpIPT
    8671092                ;~ call    DEBUG_DumpPartitionPointers
    868                 ;~ call    DEBUG_DumpPartitionXref
    8691093                ;~ call    DEBUG_DumpNewPartTable
    8701094                ;~ call    DEBUG_DumpDriveLetters
    871 ENDIF
    872 
    873                 ; Scan all partitions
    874                 call    PARTSCAN_ScanForPartitions
     1095                call    DEBUG_DumpDriveLetters
     1096                call    DEBUG_DumpVolumeLetters
     1097                call    DEBUG_DumpPartitionXref
     1098            ENDIF
     1099
     1100
     1101; -----------------------------------------------------------------------------
     1102;                                 RESTORE FORCED DRIVELETTER CORRELATION [LVM]
     1103; -----------------------------------------------------------------------------
     1104
     1105                ;
     1106                ; Reconnect forced drive-letters to their corresponding
     1107                ; partitions.
     1108                ;
     1109                call    PARTSCAN_UpdateDriveLetters
     1110                ; Driveletter <-> Partition correlation is now restored.
     1111
     1112
     1113
     1114            ;!
     1115            ;! DEBUG_BLOCK
     1116            ;! Dump various tables.
     1117            ;! Uncomment below to activate.
     1118            ;!
     1119            IFDEF   AUX_DEBUG
     1120                ;~ call    DEBUG_DumpIPT
     1121                ;~ call    DEBUG_DumpPartitionPointers
     1122                ;~ call    DEBUG_DumpNewPartTable
     1123                ;~ call    DEBUG_DumpDriveLetters
     1124                call    DEBUG_DumpDriveLetters
     1125                call    DEBUG_DumpVolumeLetters
     1126                call    DEBUG_DumpPartitionXref
     1127            ENDIF
     1128
     1129
     1130; -----------------------------------------------------------------------------
     1131;                                                            SHOW WE ARE ALIVE
     1132; -----------------------------------------------------------------------------
     1133
     1134                ;
     1135                ; Put some info about AiR-BOOT and the system on the screen.
     1136                ;
    8751137
    8761138                ; Display number of physical disks found
     
    8991161
    9001162
    901 IFDEF   AUX_DEBUG
    902                 ;~ call    DEBUG_DumpIPT
    903                 ;~ call    DEBUG_DumpPartitionPointers
    904                 ;~ call    DEBUG_DumpPartitionXref
    905                 ;~ call    DEBUG_DumpNewPartTable
    906 ENDIF
    907 
    908 
    909                 ; ======================
    910                 ; == eCS PHASE1 check ==
    911                 ; ======================
    912 
    913                 ; If the firt byte if name of the Install Volume is not 0
     1163
     1164
     1165
     1166; -----------------------------------------------------------------------------
     1167;                                                     eComStation PHASE1 CHECK
     1168; -----------------------------------------------------------------------------
     1169
     1170                ;
     1171                ; Here we check if eComStation v2.1 is being installed.
     1172                ; If so, we forgo the menu and directly boot it.
     1173                ;
     1174
     1175                ; If the first byte of the name of the Install Volume is not 0
    9141176                ; then we potentially have a phase1 boot.
    9151177                test    byte ptr [eCS_InstallVolume],0ffh
     
    9261188
    9271189
     1190                ;
    9281191                ; == Install Volume Found ==
    929 
    930                 ; Because the old IPT read from disk differs from the new
    931                 ; IPT, we need to rescan all partitions.
    932                 ; This causes the PartitionXref table to be filled with
    933                 ; correct values so the auto-boot from the new partition
    934                 ; works correctly.
    935                 call    PARTSCAN_ScanForPartitions
    936 
    937                 ; Setup automatic boot to forgo the Menu.
    938                 ; PART_SetupPhase1 has filled in the other variables.
    939                 mov     byte ptr [CFG_AutomaticBoot],1
    940 
    941 
    942 IFDEF   AUX_DEBUG
     1192                ;
     1193
     1194
     1195            ;!
     1196            ;! DEBUG_BLOCK
     1197            ;! Dump various tables.
     1198            ;! Uncomment below to activate.
     1199            ;!
     1200            IFDEF   AUX_DEBUG
    9431201                ;~ call    DEBUG_DumpIPT
    9441202                ;~ call    DEBUG_DumpPartitionPointers
    9451203                ;~ call    DEBUG_DumpPartitionXref
    9461204                ;~ call    DEBUG_DumpNewPartTable
    947 ENDIF
    948 
    949 
     1205                ;~ call    DEBUG_DumpDriveLetters
     1206            ENDIF
     1207
     1208
     1209                ; Because one or more partitions are possibly added, the
     1210                ; PartitionXref table is not 'in sync' and could cause the
     1211                ; wrong system to be automatically booted.
     1212                ; So we rescan all partitions causing the PartitionXref
     1213                ; table to be filled with correct values so the auto-boot
     1214                ; from the new partition will work correctly.
     1215                call    PARTSCAN_ScanForPartitions
     1216
     1217
     1218            ;!
     1219            ;! DEBUG_BLOCK
     1220            ;! Dump various tables.
     1221            ;! Uncomment below to activate.
     1222            ;!
     1223            IFDEF   AUX_DEBUG
     1224                ;~ call    DEBUG_DumpIPT
     1225                ;~ call    DEBUG_DumpPartitionPointers
     1226                ;~ call    DEBUG_DumpPartitionXref
     1227                ;~ call    DEBUG_DumpNewPartTable
     1228                ;~ call    DEBUG_DumpDriveLetters
     1229            ENDIF
     1230
     1231                ; Setup automatic boot to forgo the Menu.
     1232                ; PART_SetupPhase1 has filled in the other variables.
     1233                mov     byte ptr [CFG_AutomaticBoot],1
     1234
     1235                ;
     1236                ; At this point the AiR-BOOT configuration has been altered
     1237                ; to automatically boot the newly installed system without
     1238                ; displaying the menu.
     1239                ; Code further down the road will take care of that.
     1240                ;
    9501241                jmp     MBR_Main_ContinueBoot
    9511242
     
    9531244
    9541245
    955 
     1246    ;
     1247    ; Wether a new system is being installed or not,
     1248    ; booting continues here.
     1249    ;
    9561250    MBR_Main_ContinueBoot:
     1251
     1252                ;
     1253                ; Inform user how to switch between post-screen and menu
     1254                ; by putting this info on the screen.
     1255                ;
    9571256                xor     si,si
    9581257                call    MBR_TeletypeNL
    9591258                xor     si,si
    9601259                call    MBR_TeletypeNL
    961 
    962 
    9631260                call    MBR_TeletypeSyncPos
    964 
    9651261                xor     si,si
    9661262                call    MBR_TeletypeNL
    9671263                call    MBR_TeletypeNL
    968 
    969 
    970 
    9711264                mov     si, offset ShowMenu
    9721265                call    MBR_TeletypeBold
    9731266
    9741267
    975 
    976 
    977 
     1268                ;
     1269                ; Debug stop.
     1270                ;
    9781271
    9791272                ;
     
    9811274                ;
    9821275
    983 
    984                 ; Rousseau:
    9851276                ; Wait for key so we can see debug log if ab-menu hangs.
    9861277                ;~ xor     ax, ax
    9871278                ;~ int     16h
    988 
    9891279                ;call     SOUND_Beep
    9901280
    991                 ; Rousseau: delayed save of video-page
    992 
     1281
     1282                ; Copy BIOS POST to Second Page
    9931283                mov     ax, VideoIO_Page1
    994                 call    VideoIO_BackUpTo    ; Copy BIOS POST to Second Page
     1284                call    VideoIO_BackUpTo
    9951285
    9961286                ;call     SOUND_Beep
    997 
    998 
    999                 ;
    1000                 ; COM-PORT DEBUG
    1001                 ;
    1002                 ;call    AuxIO_TeletypeNL
    1003                 ;mov     si, offset PartitionTable
    1004                 ;call    AuxIO_DumpSector
    1005                 ;call    AuxIO_TeletypeNL
    10061287
    10071288
    10081289                ; Save configuration so phase1 boot-through is disabled
    10091290                ; on next boot.
    1010                 mov     byte ptr [eCS_InstallVolume], 0  ; disable phase 1 for next boot
     1291                mov     byte ptr [eCS_InstallVolume], 0
    10111292                call    DriveIO_SaveConfiguration
    10121293
     
    10141295
    10151296                ;
    1016                 ; RE-ENTER SETUP
     1297                ; See if setup needs to be entered.
    10171298                ;
    10181299    MBR_Main_ReEnterSetup:
    10191300                call    SETUP_CheckEnterSETUP
    10201301
    1021                 ;call    SOUND_Beep
    1022 
    1023                 ; Rousseau: Every time I see "AfterCrap" I have to laugh :-)
     1302                ;
     1303                ; Do some post processing.
     1304                ;
    10241305                call    AFTERCRAP_Main
    10251306
     
    10341315
    10351316    MBR_Main_ReEnterBootMenuPre:
    1036 
    10371317                ; SetUp PartitionPointers for BootMenu (filter non-bootable)
    10381318                call    PART_CalculateMenuPartPointers
     
    10901370    MBR_Main_GotBootMenu:
    10911371                ; ------------------------------------------ BOOT-MENU VISUALS
     1372
     1373
     1374            IFDEF   FX_ENABLED
    10921375                call    FX_StartScreen
    1093 
    1094                 ;call    SOUND_Beep
     1376            ENDIF
    10951377
    10961378                call    BOOTMENU_BuildBackground
    10971379                call    BOOTMENU_BuildMain
     1380
     1381            IFDEF   FX_ENABLED
    10981382                call    FX_EndScreenRight
     1383            ENDIF
     1384
    10991385                call    PASSWORD_AskSystemPwd
    11001386                call    BOOTMENU_ResetTimedBoot
    11011387
    1102                 ;call    SOUND_Beep
    1103 
    11041388                call    BOOTMENU_Execute
    1105 
    1106                 ;call    SOUND_Beep
    11071389
    11081390                jc      MBR_Main_ReEnterSetup
    11091391                call    BOOTMENU_SetVarsAfterMenu
    11101392
    1111                 ;call    SOUND_Beep
    1112 
    11131393                ; ---------------------------------------------------- BOOTING
    11141394    MBR_Main_NoBootMenu:
     1395
     1396            IFDEF   FX_ENABLED
    11151397                call    FX_StartScreen
     1398            ENDIF
     1399
    11161400                call    BOOTMENU_BuildGoodBye
     1401
     1402            IFDEF   FX_ENABLED
    11171403                call    FX_EndScreenRight
     1404            ENDIF
     1405
    11181406                call    PASSWORD_AskChangeBootPwd
    11191407
     
    11211409                ; Debug Code to terminate DOS .COM program - used for
    11221410                ;  testing AiR-BOOT
     1411                ; Obsolete.
    11231412                int     3
    11241413                mov     ax, 6200h
     
    11361425                mov     dl, byte ptr [Menu_EntrySelected]
    11371426
     1427
     1428                ;
     1429                ; Prepare to start the partition.
     1430                ;
    11381431                jmp     MBR_Main_StartPartition
    11391432
    11401433
    11411434
     1435; -----------------------------------------------------------------------------
     1436;                                                              START PARTITION
     1437; -----------------------------------------------------------------------------
     1438
    11421439    MBR_Main_StartPartition:
    11431440
    1144 IFDEF   AUX_DEBUG
     1441            IFDEF   AUX_DEBUG
    11451442                ;~ call    DEBUG_DumpIPT
    11461443                ;~ call    DEBUG_DumpPartitionPointers
    11471444                ;~ call    DEBUG_DumpPartitionXref
    11481445                ;~ call    DEBUG_DumpNewPartTable
    1149 ENDIF
     1446            ENDIF
    11501447
    11511448
    11521449                ; -------------------------------------------- START PARTITION
     1450                ; THIS DOES NOT RETURN !
    11531451                call    PART_StartPartition
    11541452
    11551453
    11561454
     1455
     1456;
     1457; This entry-point restarts AiR-BOOT almost from scratch.
     1458; It skips the movement of the MBR but otherwise it is a functional restart.
     1459; The old BIOS SS:SP where the registers on entry are stored is passed along.
     1460;
     1461AirbootRestart:
     1462        mov     bx, [OldSP]     ; Old SP when BIOS transferred control to AB
     1463        mov     dx, [OldSS]     ; Old SS when BIOS transferred control to AB
     1464        jmp     MBR_RealStart
     1465
     1466
     1467;
     1468; This entry-point displays a popup that the system is halted
     1469; and then halts the system.
     1470; It is entered on severe error conditions.
     1471;
     1472HaltSystem:
     1473        call    VideoIO_ClearScreen
     1474        mov     ax,0ababh
     1475        mov     cx, 0C04h
     1476        mov     si, offset SystemHalted
     1477        call    SETUP_ShowErrorBox
     1478        ; Halt the system.
     1479        jmp     MBR_HaltSystem
     1480
     1481
     1482
     1483
     1484
     1485
     1486                ;
     1487                ; The following section includes various assembler
     1488                ; modules. These contain functionality for a multitude of
     1489                ; categories like disk-access, video-io, lvm, debugging, etc.
     1490                ;
     1491
     1492
     1493; -----------------------------------------------------------------------------
     1494;                                                        INCLUDED FILE SECTION
     1495; -----------------------------------------------------------------------------
     1496
    11571497;
    11581498; Include other code-modules here.
    1159 ; Because TASM is a multiple pass assembler, forward references
    1160 ; are possible.
    1161 ;
     1499;
     1500
    11621501b_std_txt:
    11631502Include REGULAR/STD_TEXT.ASM    ; Standard (non-translateable text)
     
    12041543size_main = $-b_main
    12051544
    1206 
    1207 
    1208 IFDEF TXT_IncludeCyrillic
     1545b_math:
     1546Include REGULAR/MATH.ASM        ; Math functions (like 32-bit multiply)
     1547size_math = $-b_math
     1548
     1549b_txtother:
     1550Include TEXT/TXTOTHER.ASM       ; All translateable Text-Strings
     1551size_txtother = $-b_txtother
     1552
     1553b_txtmenus:
     1554Include TEXT/TXTMENUS.ASM       ; All translateable Menu-text
     1555size_txtmenus = $-b_txtmenus
     1556
     1557b_charset:
     1558Include TEXT/CHARSET.ASM        ; Special Video Charsets (if needed)
     1559size_charset = $-b_charset
     1560
     1561b_conv:
     1562Include REGULAR/CONV.ASM        ; Various conversion routines
     1563size_conv = $-b_conv
     1564
     1565b_virus:
     1566Include SPECIAL/VIRUS.ASM       ; Virus Detection / Anti-Virus
     1567size_virus = $-b_virus
     1568
     1569; [Linux support removed since v1.02]
     1570;Include SPECIAL/FAT16.ASM       ; FAT-16 Support
     1571;Include SPECIAL/LINUX.ASM       ; Linux Kernel Support
     1572
     1573b_billsuxx:
     1574Include SPECIAL/F00K/BILLSUXX.ASM   ; Extended Partition - Microsoft-Hack
     1575size_billsuxx = $-b_billsuxx
     1576
     1577b_sound:
     1578Include SPECIAL/SOUND.ASM       ; Sound
     1579size_sound = $-b_sound
     1580
     1581b_apm:
     1582Include SPECIAL/APM.ASM         ; Power Managment Support
     1583size_apm = $-b_apm
     1584
     1585
     1586
     1587;
     1588; Cyrillic support.
     1589;
     1590IFDEF   TXT_IncludeCyrillic
    12091591b_ccharset:
    12101592   Include SPECIAL/CHARSET.ASM  ; Charset Support (e.g. Cyrillic)
     
    12121594ENDIF
    12131595
    1214 
    1215 b_math:
    1216 Include REGULAR/MATH.ASM        ; Math functions (like 32-bit multiply)
    1217 size_math = $-b_math
    1218 
    1219 
    1220 
    1221 
    12221596; Various debugging routines, uses AUXIO and CONV
    1223 IFDEF AUX_DEBUG
     1597IFDEF   AUX_DEBUG
    12241598b_debug:
    12251599Include REGULAR/DEBUG.ASM       ; Debug module
     
    12301604ENDIF
    12311605
    1232 
    1233 
    1234 
    1235 ;==============================================================================
    1236 
    1237                 ;
    1238                 ; Moved up.
    1239                 ;
    1240 
    1241                 ;
    1242                 ; This is the AiR-BOOT MBR-Protection Image.
    1243                 ; 04600 / 200h = 23h = 35d sectors are before this point.
    1244                 ; The stuff generated here gets overwritten when the
    1245                 ; MBR_PROT.ASM module, which is assembled separately,
    1246                 ; gets merged.
    1247                 ; So you won't find the string below in the generated binary.
    1248                 ;
    1249                 ; MOVED TO 6800h to create space and have a continuous
    1250                 ; code block.
    1251                 ; This makes the RU version buildable again with Tasm.
    1252                 ;
    1253                 ;org     04600h                                  ; Sector 36-37
    1254 
    1255 
    1256                 ; Rousseau: It needed a sector alignment, so moved it up to
    1257                 ;           have as much space as possible for the modules
    1258                 ;           included here.
    1259 
    1260 
    1261 ;==============================================================================
    1262                                                                  ; Sector 38-x
    1263                 ;
    1264                 ; This section contains translatable texts.
    1265                 ;
    1266                 ;org     04A00h
    1267 
    1268 
    1269 b_txtother:
    1270 Include TEXT/TXTOTHER.ASM       ; All translateable Text-Strings
    1271 size_txtother = $-b_txtother
    1272 
    1273 b_txtmenus:
    1274 Include TEXT/TXTMENUS.ASM       ; All translateable Menu-text
    1275 size_txtmenus = $-b_txtmenus
    1276 
    1277 b_charset:
    1278 Include TEXT/CHARSET.ASM        ; Special Video Charsets (if needed)
    1279 size_charset = $-b_charset
    1280 
    1281 b_conv:
    1282 Include REGULAR/CONV.ASM        ; Various conversion routines
    1283 size_conv = $-b_conv
    1284 
    1285 b_virus:
    1286 Include SPECIAL/VIRUS.ASM       ; Virus Detection / Anti-Virus
    1287 size_virus = $-b_virus
    1288 ; [Linux support removed since v1.02]
    1289 ;Include SPECIAL/FAT16.ASM       ; FAT-16 Support
    1290 ;Include SPECIAL/LINUX.ASM       ; Linux Kernel Support
    1291 b_billsuxx:
    1292 Include SPECIAL/F00K/BILLSUXX.ASM   ; Extended Partition - Microsoft-Hack
    1293 size_billsuxx = $-b_billsuxx
    1294 
    1295 
    1296 
    1297                 ;
    1298                 ; Critical end of code marker.
    1299                 ; Should always be in the image, otherwise something
    1300                 ; is very wrong.
    1301                 ;
    1302                 db      'DEAD'
    1303                 db      'FACE'
    1304 
    1305 ;
    1306 ; Keep these modules here at the end of the code section.
    1307 ; When debugging, extra code space is used and code will move up towards
    1308 ; the protection image that is 'orged' and will thus overlay.
    1309 ; The effects are turned off in debug mode, so it does not matter much that
    1310 ; this code get's lost.
    1311 ;
    1312 b_sound:
    1313 Include SPECIAL/SOUND.ASM       ; Sound
    1314 size_sound = $-b_sound
    1315 
    1316 b_apm:
    1317 Include SPECIAL/APM.ASM         ; Power Managment Support
    1318 size_apm = $-b_apm
    1319 
     1606;
     1607; We only include this if FX_ENABLED is defined.
     1608; FX is disabled when debugging to have more room for debug-code.
     1609; The module compiles to 50eh = 1294 bytes, so that is a lot.
     1610;
     1611IFDEF   FX_ENABLED
    13201612b_fx:
    13211613Include SPECIAL/FX.ASM          ; l33t Cooper-Bars/Scrolling <bg>
    13221614size_fx = $-b_fx
    1323 
    1324 
    1325 ; If we are debugging, we overwrite the FX code.
    1326 ; As long as FX is disabled this will do no harm.
    1327 IFDEF   AUX_DEBUG
    1328                 ORG     06780h
    13291615ENDIF
     1616
     1617
     1618                ;
     1619                ; End of code marker.
     1620                ;
     1621                db      'BABE'
     1622                db      'FACE'
     1623
     1624
     1625; -----------------------------------------------------------------------------
     1626;                                                                  END OF CODE
     1627; -----------------------------------------------------------------------------
     1628code_end:
     1629
     1630
     1631
     1632
     1633
     1634
     1635
     1636
     1637
     1638
     1639; -----------------------------------------------------------------------------
     1640;                                                         BLDLEVEL INFORMATION
     1641; -----------------------------------------------------------------------------
     1642
     1643                ORIGIN  068A0h
     1644
     1645;
     1646; The space between this offset and code_end is the space
     1647; available for code.
     1648;
     1649zzz_code_space = $ - code_end
    13301650
    13311651
     
    13341654                ; Here we insert the OS/2 BLDLEVEL Information.
    13351655                ; It is composed of the AiR-BOOT version-info and other
    1336                 ; information.
    1337                 ; It is unique for each release of AiR-BOOT.
     1656                ; information. It is unique for each release of AiR-BOOT.
     1657                ;
     1658
    13381659                ;
    13391660                ; ?? When AUX_DEBUG is enabled and the above org is active,
     
    13461667                InsertBuildLevel
    13471668
    1348                 ;bliep <>
    1349 
    1350                 ;
    1351                 ; End of code marker.
    1352                 ; If this one vanishes in the image, the FX code will not
    1353                 ; be operational.
    1354                 ; Will happen with debugging enabled.
    1355                 ;
    1356                 db      'BABE'
    1357                 db      'FACE'
    1358 
    1359 code_end:
    1360 
    1361 
    1362                 ;
    1363                 ; AiR-BOOT Protection Image.
    1364                 ; Moved from below to have it not break the included modules
    1365                 ; with it's sector alignment requirement.
    1366                 ;
    1367                 ORIGIN  06800h
    1368 
    1369 zzz_code_space = $ - code_end
     1669
     1670
     1671
     1672
     1673;==============================================================================
     1674;                                                                    Sector 53
     1675;==============================================================================
     1676
     1677                ;
     1678                ; From here on, the layout of the image consists of:
     1679                ; - AiR-BOOT Protection Image
     1680                ; - AiR-BOOT Configuration
     1681                ; - DriveLetters
     1682                ; - Install Volume
     1683                ; - Floppy/CDROM/BIOS BOOT ENTRIES
     1684                ; - Internal Partition Table (IPT)
     1685                ; - Hidden Partition Table (HPT)
     1686                ; - MBR Backup
     1687                ;
     1688
     1689                ;
     1690                ; After that, the BSS follows with several runtime
     1691                ; variables and structures.
     1692                ; The BSS is not part of the image on disk of course.
     1693                ;
     1694
     1695; -----------------------------------------------------------------------------
     1696;                                                             PROTECTION IMAGE
     1697; -----------------------------------------------------------------------------
     1698
    13701699                ;
    13711700                ; This is the AiR-BOOT MBR-Protection Image.
    1372                 ; 06800 / 200h = 34h = 52d sectors are before this point.
    13731701                ; The stuff generated here gets overwritten when the
    1374                 ; MBR_PROT.ASM module, which is assembled separately,
    1375                 ; gets merged.
     1702                ; MBR_PROT module, which is assembled separately,
     1703                ; gets binary merged.
    13761704                ; So you won't find the string below in the generated binary.
    13771705                ;
    1378 
    1379                 ; 06800-068FF
    1380                 ; 06900-069FF
    1381                 ; 06A00-06AFF
    1382                 ; 06B00-06BFF
    1383 
    1384 ;
    1385 ; Hardcoded to 1k (1024 bytes) (MBR_PROT.ASM)
     1706                ORIGIN  06900h
     1707
     1708
     1709
     1710
     1711;
     1712; Hardcoded to 768 bytes (MBR_PROT.ASM)
    13861713; The string below is searched for by the FIXCODE helper and *must* be
    1387 ; sector (512-bytes) aligned.
     1714; page (256 bytes) aligned.
     1715;
     1716; It seems to be possible to shrink the protection-image to 768 bytes.
     1717; That gives us an additional 256 bytes of code-space.
     1718; MBR-PROT.ASM,FIXCODE.C,PARTMAIN.ASM and AIR-BOOT.ASM need to be adjusted for that.
     1719; Also the granularity needs to change from 512 bytes to 256 bytes since
     1720; 6900h is not a 512-byte boundary.
     1721;
     1722; 20120908 - Done.
    13881723;
    13891724MBR_Protection  db 'AiR-BOOT MBR-Protection Image'
    13901725
    13911726                ; Just fill.
    1392                 db  1024-($-MBR_Protection)  dup('M')
     1727                ;~ db  1024-($-MBR_Protection)  dup('M')
     1728                db  768-($-MBR_Protection)  dup('M')
     1729
     1730
     1731
     1732
     1733
    13931734
    13941735
    13951736;==============================================================================
    1396                                                                    ; Sector 55
     1737;                                                                    Sector 55
     1738;==============================================================================
     1739; -----------------------------------------------------------------------------
     1740;                                                       AiR-BOOT CONFIGURATION
     1741; -----------------------------------------------------------------------------
    13971742
    13981743                ;
     
    14121757                ; AiR-BOOT will not function because it cannot
    14131758                ; find the config-signature which includes this
    1414                 ; invisible character. The code of the char is: 0x0ad.
     1759                ; invisible character. The code of the char is: 0adh.
    14151760                db  'AiRCFG-TABLE­'
    14161761                db  01h, 08h, 'U' ; "Compressed" ID String
     
    14381783
    14391784CFG_Partitions          db  0   ; Count of partitions in IPT
    1440                         db  0   ; Was BootParts - Removed since v0.28b
     1785CFG_MiscFlags           db  1   ; Miscellaneous Flags (See EQUates)
    14411786CFG_PartDefault         db  0   ; Default-Partition (Base=0)
    14421787
     
    14781823CFG_MakeSound           db  0   ; Should be clear ;)
    14791824CFG_FloppyBootGetTimer  db  0   ; Floppy Name will get updated every 2 secs
    1480 CFG_ResumeBIOSbootSeq   db  0   ; If BIOS Boot Sequence should be resumed
     1825CFG_ResumeBIOSbootSeq   db  1   ; If BIOS Boot Sequence should be resumed
    14811826                                    ; 0 - Disabled
    14821827                                    ; 1 - CD-ROM
     
    15061851
    15071852
     1853; -----------------------------------------------------------------------------
     1854;                                                                DRIVE LETTERS
     1855; -----------------------------------------------------------------------------
     1856
    15081857;
    15091858; Moved here to make room for packed hiddenparttable.
     1859; This gets filled when drive-letters that are assigned using the dl-feature.
    15101860;
    15111861DriveLetters            db  LocIPT_MaxPartitions dup (0)
     
    15141864                        ; Drive-Letter : BYTE (80h-C:, 81h-D:)
    15151865                        ; --------------------> 1 Byte * 45
     1866
     1867
     1868
     1869; -----------------------------------------------------------------------------
     1870;                                                               INSTALL VOLUME
     1871; -----------------------------------------------------------------------------
    15161872
    15171873                ;
     
    15301886;eCS_InstallVolume       db  'ECS-HIGH',0,0,0,0
    15311887;eCS_InstallVolume       db  'ECS-HIGH',0,'NO',0
    1532 eCS_InstallVolume       db  'KANWEG2',0
    1533 ;eCS_InstallVolume       db  0,'NOPHASEONE' ,0
     1888;eCS_InstallVolume       db  'KANWEG2',0
     1889eCS_InstallVolume       db  0,'NOPHASEONE' ,0
    15341890
    15351891;
    15361892; THERE IS ROOM RESERVED HERE FOR MORE VARIABLES
    15371893;
     1894
     1895
     1896; -----------------------------------------------------------------------------
     1897;                                               FLOPPY/CDROM/BIOS BOOT ENTRIES
     1898; -----------------------------------------------------------------------------
    15381899
    15391900                ;
     
    15841945                        db  0, 1, 0     ; Location of Partition/Boot Record
    15851946                        dd  0, 0
    1586 ;------------------------------------------------------------------------------
    1587 
    1588                 ;org 06E00h                                     ; Sector 56-57
     1947
     1948
     1949
     1950; -----------------------------------------------------------------------------
     1951;                                               INTERNAL PARTITION TABLE (IPT)
     1952; -----------------------------------------------------------------------------
    15891953
    15901954                ;
     
    15971961; Rousseau: This is the start of the AiR-BOOT IPT
    15981962;
    1599 
    1600 
    16011963PartitionTable  db  (LocIPT_MaxPartitions * LocIPT_LenOfIPT) dup (0)
    16021964; no-partitions detected... :]
     
    16321994
    16331995
    1634 ;------------------------------------------------------------------------------
    1635                             ;org 07400h                            ; Sector 58
    1636 
     1996
     1997; -----------------------------------------------------------------------------
     1998;                                                 HIDDEN PARTITION TABLE (HPT)
     1999; -----------------------------------------------------------------------------
    16372000
    16382001                ;
     
    16652028
    16662029
    1667 ;------------------------------------------------------------------------------
    1668                 ;org 07A00h
    1669                                                                 ; Sector 60
     2030;==============================================================================
     2031;                                                                    Sector 62
     2032;==============================================================================
     2033; -----------------------------------------------------------------------------
     2034;                                                                   MBR BACKUP
     2035; -----------------------------------------------------------------------------
    16702036
    16712037                ;
     
    16932059
    16942060
     2061
     2062;
     2063; Terminate LDRIMAGE segment.
     2064;
    16952065IFDEF   SEGMENTED
    1696 ;
    1697 ; End of AiR-BOOT code and data.
    1698 ;
    1699 
    17002066LDRIMAGE    ENDS
    1701 
    1702 ;DATA_SEG    ENDS
    1703 
    1704 ;
    1705 ; Uninitialized Data (BSS)
    1706 ;
     2067ENDIF
     2068
     2069
     2070
     2071
     2072
     2073
     2074
     2075;##############################################################################
     2076;                                                                  BSS SEGMENT
     2077;##############################################################################
     2078
     2079
     2080
     2081;
     2082; Open BSS segment.
     2083;
     2084IFDEF   SEGMENTED
    17072085VOLATILE        SEGMENT     USE16   PUBLIC  'BSS'
    1708 
    17092086ENDIF
    17102087
     
    17392116
    17402117
     2118; -----------------------------------------------------------------------------
     2119;                                                            START OF BSS DATA
     2120; -----------------------------------------------------------------------------
     2121
    17412122; This space actually gets initialized in PreCrap to NUL (till EndOfVariables)
    17422123BeginOfVariables:
     2124
     2125
     2126; -----------------------------------------------------------------------------
     2127;                                                               SECTOR BUFFERS
     2128; -----------------------------------------------------------------------------
    17432129PartitionSector     db  512 dup (?) ; Temporary Sector for Partition
    1744 JfsPBR              db  512 dup (?) ; Temporary Sector for JFS PBR writeback
     2130PBRSector           db  512 dup (?) ; Temporary Sector for JFS/HPFS writeback
    17452131LVMSector           db  512 dup (?) ; Temporary Sector for LVM
    17462132TmpSector           db  512 dup (?) ; Temporary Sector
    17472133Scratch             db  256 dup (?) ; Scratch buffer
    17482134
     2135; -----------------------------------------------------------------------------
     2136;                                                          NEW PARTITION TABLE
     2137; -----------------------------------------------------------------------------
    17492138; Everything used to build a new IPT and reference it to the old one
    1750 ; IETS OVERSCHRIJFT DIT !!
    17512139NewPartTable                db  1536 dup (?)    ; New Partition Table
    17522140
     2141
     2142; -----------------------------------------------------------------------------
     2143;                                                     NEW HIDE PARTITION TABLE
     2144; -----------------------------------------------------------------------------
    17532145; New Hide-Partition Table
    1754 NewHidePartTable            db  partition_count * LocHPT_LenOfHPT dup (?)
    1755 
     2146NewHidePartTable            db  LocIPT_MaxPartitions * LocHPT_LenOfHPT dup (?)
     2147
     2148    ;~ even
     2149
     2150; -----------------------------------------------------------------------------
     2151;                                                            NEW DRIVE LETTERS
     2152; -----------------------------------------------------------------------------
    17562153; Logical Drive-Letters
    1757 NewDriveLetters             db  partition_count dup (?)
    1758 
     2154NewDriveLetters             db  LocIPT_MaxPartitions dup (?)
     2155
     2156    ;~ even
     2157
     2158; -----------------------------------------------------------------------------
     2159;                                                         PARTITION SIZE TABLE
     2160; -----------------------------------------------------------------------------
    17592161; Size-Table (6 bytes per partition)
    1760 PartitionSizeTable          db  partition_count * 6 dup (?)
    1761 
     2162PartitionSizeTable          db  LocIPT_MaxPartitions * 6 dup (?)
     2163
     2164
     2165; -----------------------------------------------------------------------------
     2166;                                                           PARTITION POINTERS
     2167; -----------------------------------------------------------------------------
    17622168; Maximum is 52 word entries till now
    17632169PartitionPointers           dw  52 dup (?)
     
    17662172PartitionPointerCount       db  ?
    17672173
     2174; -----------------------------------------------------------------------------
     2175;                                                                   XREF TABLE
     2176; -----------------------------------------------------------------------------
     2177
    17682178; X-Reference Table (holds new partnr, index is old part nr)
    1769 PartitionXref               db  partition_count dup (?)
     2179PartitionXref               db  LocIPT_MaxPartitions dup (?)
     2180
     2181; -----------------------------------------------------------------------------
     2182;                                                               VOLUME LETTERS
     2183; -----------------------------------------------------------------------------
    17702184
    17712185; Volume-Letters
     
    17732187; 1 - LVM support, but no letter
    17742188; 'C'-'Z' - assigned drive letter
    1775 PartitionVolumeLetters      db  partition_count dup (?)
    1776 
    1777 
    1778 
    1779 
     2189PartitionVolumeLetters      db  LocIPT_MaxPartitions dup (?)
     2190
     2191
     2192
     2193; -----------------------------------------------------------------------------
     2194;                                                          MISC VARS AND FLAGS
     2195; -----------------------------------------------------------------------------
    17802196TotalHarddiscs          db  ?           ; Total harddrives (by POST)
    17812197LBASwitchTable          db  128 dup (?) ; Bit 25-18 for CHS/LBA Switching
     
    17982214;GotLinux                     db     ?    ; 1-Linux found
    17992215
     2216
     2217; -----------------------------------------------------------------------------
     2218;                                                            MENU RELATED VARS
     2219; -----------------------------------------------------------------------------
    18002220Menu_EntrySelected  db  ?   ; Which partition we boot this time...
    18012221Menu_UpperPart      db  ?   ; Which number (Base=0) is the partition upper pos
     
    18082228                                         ;  - All adjusted to menu locations
    18092229
     2230; -----------------------------------------------------------------------------
     2231;                                                       PARTITION RELATED VARS
     2232; -----------------------------------------------------------------------------
    18102233PartSetup_UpperPart     db  ?   ; Partition-Setup (like Menu_UpperPart)
    18112234PartSetup_ActivePart    db  ?   ; Active Partition
     
    18142237PartSetup_HiddenAdd     db  ?   ; Adjust for Hidden-Setup
    18152238
     2239; -----------------------------------------------------------------------------
     2240;                                                   TIMER / SETUP RELATED VARS
     2241; -----------------------------------------------------------------------------
    18162242TimedBootEnable     db  ?   ; Local Enable/Disable for timed boot
    18172243TimedTimeOut        dd  ?   ; TimeOut Timer for TimedBoot (too much time here;)
     
    18302256SyncLvmLabels       db  ?   ; Sync LVM labels after user-edit ?
    18312257
     2258
     2259; -----------------------------------------------------------------------------
     2260;                                                              FX RELATED VARS
     2261; -----------------------------------------------------------------------------
    18322262FX_UseCount                 dw  ?
    18332263FX_OverallTimer             dw  ?
     
    18402270FX_WideScrollerBounceSpeed  db  ?
    18412271FX_CooperBarsTimer          dw  ?
     2272
     2273; Dynamically Generated Tables - do not need to get initialized with NUL
     2274FX_CooperColors     db   672 dup (?) ; 7 cooper bars*96 - runtime calculated
     2275FX_CooperState      db     7 dup (?)
     2276FX_SinusPos         db     7 dup (?)
     2277FX_CooperPos        dw     7 dup (?)
     2278
     2279
     2280; -----------------------------------------------------------------------------
     2281;                                                               CHARSET BUFFER
     2282; -----------------------------------------------------------------------------
     2283CharsetTempBuffer   db  4096 dup (?) ; Uninitialized Charset buffer
     2284
     2285; -----------------------------------------------------------------------------
     2286;                                                                LVM CRC TABLE
     2287; -----------------------------------------------------------------------------
     2288LVM_CRCTable        dd   256 dup (?) ; LVM-CRC (->SPECiAL\LVM.asm)
    18422289
    18432290;~ ; [Linux support removed since v1.02]
     
    18562303;~ LINUX_KernelSizeTable   db   120 dup (?) ; Size-Table (6 bytes per kernel)
    18572304
    1858 ; Dynamically Generated Tables - do not need to get initialized with NUL
    1859 FX_CooperColors     db   672 dup (?) ; 7 cooper bars*96 - runtime calculated
    1860 FX_CooperState      db     7 dup (?)
    1861 FX_SinusPos         db     7 dup (?)
    1862 FX_CooperPos        dw     7 dup (?)
    1863 CharsetTempBuffer   db  4096 dup (?) ; Uninitialized Charset buffer
    1864 LVM_CRCTable        dd   256 dup (?) ; LVM-CRC (->SPECiAL\LVM.asm)
    1865 
    1866 
    1867 
    18682305
    18692306;
    18702307; Rousseau: added some stuff.
    18712308;
    1872 
     2309; -----------------------------------------------------------------------------
     2310;                                                           ECS PHASE1 RELATED
     2311; -----------------------------------------------------------------------------
    18732312Phase1Active                db      ?
    18742313OldPartitionCount           db      ?
    18752314
     2315
     2316; -----------------------------------------------------------------------------
     2317;                                                              DISK PARAMETERS
     2318; -----------------------------------------------------------------------------
    18762319                              ;EVEN
    18772320HugeDisk                    db      MaxDisks  dup(?)
     
    19032346LOG_TotalSecs               dq      MaxDisks  dup(?)
    19042347
    1905 ; End of transient variables.
    1906 EndOfVariables:
    1907 
    1908 
     2348; Get's initialized at startup to: 00000011111111111111111111111100b
     2349; Meaning A,B not free; C-Z free, rest unused. (right to left)
     2350; Each partition with an assigned drive-letter clears a bit in this map.
     2351FreeDriveletterMap          dd      ?
     2352
     2353; LBA address of master LVM sector, zero if non-existant
     2354MasterLVMLBA                dd      ?
     2355
     2356
     2357; -----------------------------------------------------------------------------
     2358;                                                                  I13X BUFFER
     2359; -----------------------------------------------------------------------------
    19092360;
    19102361; Temporary buffer for 48h INT13X bios call.
     
    19262377ott         db  512 dup(?)
    19272378
     2379
     2380; End of transient variables.
     2381EndOfVariables:
     2382
     2383
     2384
     2385
     2386; -----------------------------------------------------------------------------
     2387;                                                           OLD AND NEW STACKS
     2388; -----------------------------------------------------------------------------
     2389
     2390;
     2391; These need to be outside the variable section because AiR-BOOT can restart
     2392; itself in debug-mode. If the OldSP and OldSS would be in the variable area,
     2393; they would be cleared on AiR-BOOT restart.
     2394;
     2395
     2396; The variable section is cleared word-wise, so it could clear one byte extra
     2397; depending on the alignment and size. This DD prevents the OldSP and OldSS
     2398; to be partly overwritten by the clearing routine.
     2399                            dd      ?
     2400
     2401; SS:SP from before our relocation.
     2402; The registers values when the BIOS transferred control to us were pushed
     2403; on this stack.
     2404
     2405OldSP                       dw      ?
     2406OldSS                       dw      ?
     2407
     2408; SS:SP currently in use.
     2409; They are temporarily dumped here so we can pop the resgisters from
     2410; the old stack to display them in debug mode.
     2411CurrentSP                   dw      ?
     2412CurrentSS                   dw      ?
     2413
     2414
     2415
     2416;
     2417; End of BSS segment.
     2418;
    19282419eobss:
    19292420
     2421;
     2422; Close BSS segment.
     2423;
    19302424IFDEF   SEGMENTED
    19312425    VOLATILE    ENDS
  • trunk/BOOTCODE/AIR-BOOT.HIS

    r50 r51  
    2121
    2222
    23 ; ---------------------------------
    24 ; Rousseau: Fixes and Enhancements
    25 ; ---------------------------------
    26 ;
    27 ; v1.0.8-rc3-bld201205nn
     23; ------------------------------------------------
     24; Rousseau: Fixes, Enhancements and fresh bugs :-)
     25; ------------------------------------------------
     26;
     27; v1.0.8-rc3-bld20120909
    2828; ----------------------
     29; # Added Show LVM Drive Letters in SETUP/BASIC #
     30;   This will toggle the display of LVM drive-letters in the main menu.
     31;   By default this option is enabled.
     32;
     33; # Reduced MBR Protection Image from 1024 bytes to 768 bytes #
     34;   The fight for code-space continues...
     35;   Luckily the MBR Protection Image code does not exceed 768 bytes,
     36;   so that gives us another 256 bytes of precious code-space.
     37;   Now the non-EN versions are happy again.
     38;   Note that the alignment for the image changed from 512 to 256 bytes.
     39;   MBR-PROT.ASM, FIXCODE.C, PARTMAIN.ASM and AIR-BOOT.ASM have been
     40;   adjusted for this change.
     41;
     42; # Updating from v1.06 now also copies over drive-letters #
     43;   When the user has forced drive-letters in v1.06 these will be copied over
     44;   to the v1.0.8 configuration when upgrading.
     45;   Because the drive-letter feature is broken in v1.07, the drive-letter
     46;   table does not get copied over when upgrading from v1.07.
     47;
     48; # Fixed a minor bug with displaying LVM drive-letters #
     49;   When more partitions that can be displayed were present, scrolling the
     50;   menu would not scroll the drive-letter. Fixed.
     51;
     52; # Added DOCU directory for documentation #
     53;   This contains the AiR-BOOT User Manual in Open Office .odt-format.
     54;   To also have OS/2 INF format, a transformation script and sheet have been
     55;   created to convert the .odt document to an ipf-source that can be compiled
     56;   with Watcoms wipfc ipf compiler. (IBM ipfc does not work correctly)
     57;   This makes it possible to write documentation in OOo Writer and export that
     58;   to PDF and INF format.
     59;
     60; # Fixed a bug with regard to the drive-letter feature #
     61;   When partitions were deleted, and some partitions above the deleted
     62;   partition(s) had a drive-letter forced, these partitions would lose this
     63;   assignment. This bug is also present in v1.06.
     64;
     65; # Implemented a very simple interactive debugger #
     66;   Making use of the main menu-loop, pressing a digit or a letter activates
     67;   some debugging routine. Mostly such a routine dumps a part of the internal
     68;   state to the com-port. Other purposes are the interrogation of certain
     69;   BIOS functions, as these can differ substantially between machines.
     70;
     71; # Made FX-code optional to compile in #
     72;   The FX-code supplies the shifting screen-effects when 'Cooper Bars' is
     73;   enabled in the setup. With the current enhancements made however,
     74;   there is a continuous lack of code-space, especially when debug-code is
     75;   included during development. The FX-code occupies some 1200 bytes, a space
     76;   that can be put to better use. Therefore inclusion the FX-code has been
     77;   made conditional to make room for either debugging or future new features.
     78;
     79; # Also write PBR to HPFS #
     80;   Earlier, a fix was made to write a modified PBR back in case JFS was used.
     81;   This was done to enable the drive-letter feature on JFS, since the PBR
     82;   JFS-bootcode does not use the supplied PBR in memory.
     83;   With the enhancements in the drive-letter feature, the HPFS PBR needs to
     84;   be updated on disk also, to cope with zero drive-letters in the HPFS PBR.
     85;
     86; # Added drive-letters in display for LVM volumes #
     87;   A populair request was to show drive-letter information in the menu.
     88;   Drive-letters however, are OS specific and AiR-BOOT cannot accurately
     89;   predict what drive-letter DOS would assign to what partition.
     90;   eCS LVM drive-letters however are stored in the LVM-record and can thus
     91;   be displayed. This has been implemented.
     92;
     93; # Enhanced drive-letter feature #
     94;   Enable multiple eComStation installations using the same drive-letter
     95;   This makes it possible to clone a system with XCOPY /h /e /s /t /r /v
     96;   to another drive and have that boot from the same drive-letter.
     97;   (Or installing to the same drive by hiding the other system)
     98;
    2999; # Removed Force LBA Usage from Setup #
    30100;   When AiR-BOOT is installed on an USB-stick, there is a possibility that
    31101;   the CHS-geometry varies between different machines where the stick is
    32 ;   booted. This would invalidate any CHS-values that were stored in the IPT.
     102;   booted. This would invalidate the CHS-values in the partition table
     103;   and also the values that were stored in the AiR-BOOT's internal partition
     104;   table, the IPT.
    33105;   To prevent more nasty things like below from happening, LBA-addressing
    34 ;   is now always used.
     106;   is now always used and the setting has been removed from the setup-menu.
     107;   While this may prevent AiR-BOOT from running on very old systems,
     108;   the focus of AiR-BOOT development is geared towards the future.
     109;   Such old systems can use v1.06.
     110;
     111; # Added extra MBR protection #
     112;   When AiR-BOOT is active, it is only AiR-BOOT that writes to the MBR.
     113;   To protect the MBR from programming errors, like the one below,
     114;   any write to the MBR is now checked for validity.
     115;   In essence this is protecting your MBR from bad programming done by me...
    35116;
    36117;!## Fixed a very very nasty bug that can destroy the MBR on multiple disks ##!
     
    48129;   would be auto-booted instead of the newly installed system.
    49130;   This has been fixed.
    50 ;   This bug is also present in v1.07.
     131;   This bug is also present in v1.07 and does not apply to previous versions.
    51132;
    52133; v1.0.8-rc2-bld20120423
  • trunk/BOOTCODE/BLDLEVEL.INC

    r47 r51  
     1;
     2; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
     3;
     4; This file is part of AiR-BOOT
     5;
     6; AiR-BOOT is free software: you can redistribute it and/or modify it under
     7;  the terms of the GNU General Public License as published by the Free
     8;  Software Foundation, either version 3 of the License, or (at your option)
     9;  any later version.
     10;
     11; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
     12;  WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
     13;  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
     14;  details.
     15;
     16; You should have received a copy of the GNU General Public License along with
     17;  AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
     18;
     19
     20
     21
     22
    123;
    224; OS/2 BLDLEVEL Information.
     
    3254BLDLVL_MINUTES          EQU     (AB_MINUTES SHR 4)+'0',(AB_MINUTES AND 0Fh)+'0'
    3355BLDLVL_SECONDS          EQU     (AB_SECONDS SHR 4)+'0',(AB_SECONDS AND 0Fh)+'0'
    34 ; Build machine
     56; Build machine (16 chars max ?)
    3557;BLDLVL_MACHINE          EQU     'ecs-devbox'
    3658BLDLVL_MACHINE          EQU     '*UNKNOWN*'
     
    7597    ;~ db  BLDLVL_MACHINE
    7698    ;~ db  '::'
    77     ;~ ; Wasm can only process the reference to 'lang' in pass 2 because it comes
    78     ;~ ; from an included file which it has not processed yet at pass 1.
     99    ;~ ; Wasm can only process the reference to 'lang' in pass 2 because it
     100    ;~ ;comes from an included file which it has not processed yet at pass 1.
    79101    ;~ IFDEF   WASM
    80102        ;~ IF2
  • trunk/BOOTCODE/MBR-PROT/MBR-PROT.ASM

    r46 r51  
    179179xxx:
    180180
    181 org             1023
    182                 db 0
     181;~ org             1019
     182org             763
     183
     184                ;
     185                ; MBR-PROT signature at end.
     186                ;
     187                db  'MBRPI'
    183188
    184189CODE_SEG        ENDS
  • trunk/BOOTCODE/MBR-PROT/Makefile

    r46 r51  
    5454#
    5555# This is a list of the Targets to be built.
    56 # For MBR_PROT there is only one real target: MBR_PROT.BIN.
     56# For MBR_PROT there is only one real target: MBR-PROT.BIN.
    5757#
    5858TARGET=$(MODULE).BIN
     
    6363#ASM=masm
    6464#ASM=alp
    65 ASM=tasm
     65#ASM=tasm
    6666#ASM=wasm
    67 #ASM=jwasm
     67ASM=jwasm
    6868
    6969#
  • trunk/BOOTCODE/Makefile

    r49 r51  
    395395# This gives problems when building in an OS/2 DOS-Box on a (samba) network
    396396# share with a case-sensitive file-system where also a Linux build-environment
    397 # is active. The Linux build-environment is will not find the lowercase files.
     397# is active. The Linux build-environment will not find the lowercase files.
    398398# For example, a clean from Linux will not work properly in that case.
    399399# This does not influence building DOS targets on Linux.
    400400# It can be circumvented by using a case-insensitive file-system for the
    401401# network share, like OS/2 JFS for instance.
    402 # Linux can use OS/2 JFS and will recognize it's case insensitivity.
     402# Linux can use OS/2 JFS and will honor it's case insensitivity.
    403403# Or you could loop-mount the samba share either with the usual cifs tools
    404404# or fuse-smb.
     
    513513        $(ASM) $(ASM_FLAGS) $(BASENAME).ASM
    514514!ifndef __MSDOS__
     515        @wdis -fi $^. > $^..WDA
     516!endif
    515517        @wdis -a -p -fi $^. > $^&.WDA
    516 !endif
    517         @wdis -fi $^. > $^..WDA
    518518
    519519
     
    544544        @echo.
    545545        @bldlevel $(TARGET)
     546!endif
     547!ifdef  __LINUX__
     548        @echo.
     549        @if exist AIR-BOOT.LST @grep ^zzz_code_space AIR-BOOT.LST
     550        @echo.
    546551!endif
    547552
  • trunk/BOOTCODE/REGULAR/AUXIO.ASM

    r46 r51  
    2929; High byte is initialization; see below. (0e3h)
    3030
    31 IFDEF ModuleNames
     31IFDEF   MODULE_NAMES
    3232DB 'AUXIO',0
    3333ENDIF
     
    9393
    9494        ; Copy assembler specification.
    95 IFDEF   JWASM
     95    IFDEF       JWASM
    9696        mov     al,'['
    9797        stosb
    9898        mov     si,offset jwasm_txt
    99 ENDIF
    100 IFDEF   TASM
     99    ELSEIFDEF   TASM
    101100        mov     al,' '
    102101        stosb
     
    104103        stosb
    105104        mov     si,offset tasm_txt
    106 ENDIF
    107 IFDEF   WASM
     105
     106    ELSEIFDEF   WASM
    108107        mov     al,' '
    109108        stosb
     
    111110        stosb
    112111        mov     si,offset wasm_txt
    113 ENDIF
    114 IFDEF   MASM
     112    ELSEIFDEF   MASM
    115113        mov     al,' '
    116114        stosb
     
    118116        stosb
    119117        mov     si,offset masm_txt
    120 ELSE
     118    ELSE
    121119        mov     al,' '
    122120        stosb
     
    124122        stosb
    125123        mov     si,offset unknown_txt
    126 ENDIF
     124    ENDIF
     125
    127126    AuxIO_PrintBuildInfo_a1:
    128127        lodsb
     
    143142        call    AuxIO_Print
    144143        call    AuxIO_TeletypeNL
     144
     145        ; OS/2 BLDLEVEL information.
     146        mov     si, offset bld_level
     147        call    AuxIO_Print
     148        call    AuxIO_TeletypeNL
     149
    145150        ret
    146151AuxIO_PrintBuildInfo    EndP
     
    149154; Print char to com-port (teletype style)
    150155AuxIO_Teletype  Proc     Near  Uses  ax dx
     156
     157
     158    ;~ pusha
     159    ;~ xor     dx,dx
     160    ;~ mov     ah,03h
     161    ;~ mov     al,00h
     162    ;~ int     14h
     163    ;~ mov     ah,al
     164    ;~ shr     al,4
     165    ;~ and     al,0fh
     166    ;~ add     al,'0'
     167    ;~ cmp     al,'9'
     168    ;~ jbe     @F
     169    ;~ add     al,7
     170;~ @@: push    ax
     171    ;~ xor     dx,dx
     172    ;~ mov     ah,01h
     173    ;~ int     14h
     174    ;~ pop     ax
     175    ;~ mov     al,ah
     176    ;~ and     al,0fh
     177    ;~ add     al,'0'
     178    ;~ cmp     al,'9'
     179    ;~ jbe     @F
     180    ;~ add     al,7
     181;~ @@: xor     dx,dx
     182    ;~ mov     ah,01h
     183    ;~ int     14h
     184    ;~ popa
     185
     186        ;~ pusha
     187;~ @@:
     188        ;~ xor     dx,dx
     189        ;~ mov     ah,03h
     190        ;~ mov     al,00h
     191        ;~ int     14h
     192        ;~ and     al,20h
     193        ;~ cmp     al,20h
     194        ;~ jnz     @B
     195        ;~ popa
     196
     197
    151198        mov     dx,[BIOS_AuxParms]            ; get port and parameters
    152199        xor     dh,dh                         ; we don't need the parameters
     
    170217
    171218
     219; Print Bin-byte to com-port (teletype style)
     220; This outputs 8 characters ('0' or '1' for each bit)
     221; In:          AL - byte to send
     222; Out:         AL - byte sent
     223; Destroyed:   None
     224AuxIO_TeletypeBinByte   Proc    Near Uses   ax cx
     225        mov     ah,al
     226        mov     cx,8
     227    AuxIO_TeletypeBinByte_nextchar:
     228        xor     al,al
     229        rcl     ah,1
     230        rcl     al,1
     231        add     al,'0'
     232        call    AuxIO_Teletype
     233        loop    AuxIO_TeletypeBinByte_nextchar
     234        ret
     235AuxIO_TeletypeBinByte   EndP
     236
     237; Print Bin-word to com-port (teletype style)
     238; This outputs 16 characters ('0' or '1' for each bit)
     239; In:          AX - byte to send
     240; Out:         AX - byte sent
     241; Destroyed:   None
     242AuxIO_TeletypeBinWord   Proc
     243        xchg    al,ah                      ; High byte first
     244        call    AuxIO_TeletypeBinByte      ; Output to com-port
     245        xchg    al,ah                      ; low byte next
     246        call    AuxIO_TeletypeBinByte      ; Output to com-port
     247        ret
     248AuxIO_TeletypeBinWord   EndP
     249
     250; Print Bin-dword to com-port (teletype style)
     251; This outputs 32 characters ('0' or '1' for each bit)
     252; In:          DX:AX - dword to send
     253; Out:         DX:AX - dword sent
     254; Destroyed:   None
     255AuxIO_TeletypeBinDWord  Proc     Near
     256        xchg    ax,dx
     257        call    AuxIO_TeletypeBinWord      ; High word first
     258        xchg    ax,dx
     259        call    AuxIO_TeletypeBinWord      ; Low word next
     260        ret
     261AuxIO_TeletypeBinDWord  EndP
     262
     263; Print Bin-qword to com-port (teletype style)
     264; This outputs 64 characters ('0' or '1' for each bit)
     265; In:          BX:CX:DX:AX - qword to send
     266; Out:         BX:CX:DX:AX - qword sent
     267; Destroyed:   None
     268AuxIO_TeletypeBinQWord  Proc     Near
     269        xchg    dx,bx
     270        xchg    ax,cx
     271        call    AuxIO_TeletypeBinDWord     ; High dword first
     272        xchg    dx,bx
     273        xchg    ax,cx
     274        call    AuxIO_TeletypeBinDWord     ; Low dword next
     275        ret
     276AuxIO_TeletypeBinQWord  EndP
     277
     278
    172279; Print hex-byte to com-port (teletype style)
    173280; This outputs two characters
     
    325432    AuxIO_DumpParagraph_Next_2:
    326433        mov     ah,'.'                              ; char to use ufnot printable
    327         lodsb                                        ; load byte
     434        lodsb                                       ; load byte
    328435        call    CONV_ConvertToPrintable             ; use dot's if not printable
    329436        call    AuxIO_Teletype                      ; print it
     
    337444        mov     cx,32                      ; Number of paragraphs in a sector
    338445    AuxIO_DumpSector_Next:
    339         call    AuxIO_DumpParagraph        ; Dump te paragraph
     446        call    AuxIO_DumpParagraph        ; Dump the paragraph
    340447        add     si,16                      ; Advance pointer
    341448        call    AuxIO_TeletypeNL
     
    345452
    346453
    347 AuxIOHello  db 'AiR-BOOT com-port debugging',10,0
    348 
    349 
    350 
     454AuxIOHello  db 10,10,10,10,10,'AiR-BOOT com-port debugging',10,0
     455
     456
  • trunk/BOOTCODE/REGULAR/BOOTMENU.ASM

    r46 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'BOOTMENU',0
    2424ENDIF
     
    227227   call    VideoIO_Color
    228228
     229   ; Additional message how to power off system
     230   mov     si, offset TXT_BootMenuPowerOff
     231   call    GetLenOfString
     232   mov     dx, 1902h
     233   ;~ sub     dl, cl
     234   mov     cx, dx
     235   call    VideoIO_Locate
     236   mov     al, TextChar_WinRep4
     237   call    VideoIO_PrintSingleChar
     238   call    VideoIO_Print
     239   mov     al, TextChar_WinRep5
     240   call    VideoIO_PrintSingleChar
     241
     242
    229243   ; Additional message how to enter setup
    230244   mov     si, offset TXT_BootMenuEnterSetup
     
    507521CLR_FS_NAME_BM =  0701h
    508522
     523; Color for drive-letter
     524CLR_DL_BM   = 0f01h
     525
    509526   mov     cx, CLR_FS_NAME_BM
    510527   call    VideoIO_Color                 ; Hrot, Blau
    511528   mov     cl, 8
    512529   call    VideoIO_FixedPrint
     530
     531
     532
     533DRIVELETTERS_ENABLE     EQU
     534
     535    IFDEF   DRIVELETTERS_ENABLE
     536
     537        ;
     538        ; THIS IS WHERE WE CAN SHOW DRIVE-LETTERS !
     539        ;
     540
     541        pusha
     542
     543        mov     al,[CFG_MiscFlags]
     544        and     al,00000001b
     545        jz      skip_show_dl
     546
     547
     548        ; Dirty hack to clear remaining line when menu is scrolled.
     549        ; Padd with spaces.
     550        ; Should be implemented in scrolling routine.
     551        push    word ptr [TextPosX]
     552        mov     si, offset spaces
     553        mov     cl,24
     554        call    VideoIO_FixedPrint
     555        pop     word ptr [TextPosX]
     556
     557        mov     si, [PartPointer]
     558        mov     ah, [si+LocIPT_SystemID]
     559
     560    IFDEF   AUX_DEBUG
     561        mov     al, ' '
     562        call    VideoIO_PrintSingleChar
     563        mov     al, ah
     564        call    VideoIO_PrintHexByte
     565        mov     al, ' '
     566        call    VideoIO_PrintSingleChar
     567    ENDIF
     568
     569        mov     al, ah
     570
     571        cmp     al, 07h
     572        je      show_dl
     573        cmp     al, 0fch
     574        je      show_dl
     575
     576        jmp     skip_show_dl
     577
     578    show_dl:
     579
     580        ;~ mov     al, ' '
     581        ;~ call    VideoIO_PrintSingleChar
     582
     583        mov     dl, byte ptr [si+LocIPT_Drive]
     584        mov     cx, [si+LocIPT_AbsoluteBegin+00h]
     585        mov     bx, [si+LocIPT_AbsoluteBegin+02h]
     586
     587        mov     si, offset [TmpSector]
     588        mov     di,ds
     589        call    DriveIO_LoadSectorLBA
     590        mov     al, [si+25h]
     591
     592    IFDEF   AUX_DEBUG
     593        call    VideoIO_PrintHexByte
     594    ENDIF
     595
     596        mov     dh,al
     597        sub     dh,3dh
     598
     599        call    LVM_GetDriveLetter
     600
     601        test    al,al
     602        jnz     show_dl2
     603
     604
     605
     606        mov     si, offset [dl_hidden]
     607        mov     cx, CLR_DL_BM
     608        call    VideoIO_Color
     609        call    VideoIO_Print
     610
     611        mov     cx, 0701h
     612        call    VideoIO_Color
     613
     614        mov     al, dh
     615        call    VideoIO_PrintSingleChar
     616        mov     al, ':'
     617        call    VideoIO_PrintSingleChar
     618
     619        jmp     skip_show_dl
     620
     621    show_dl2:
     622
     623        mov     si, offset [dl_text]
     624
     625        call    VideoIO_Print
     626
     627        mov     cx, CLR_DL_BM
     628        call    VideoIO_Color
     629
     630        call    VideoIO_PrintSingleChar
     631        mov     al,':'
     632        call    VideoIO_PrintSingleChar
     633
     634    skip_show_dl:
     635        popa
     636
     637    ENDIF
     638
     639
    513640   ret
    514641BOOTMENU_BuildPartitionText     EndP
     642
     643dl_text     db  '   on drive ',0
     644dl_hidden   db  '   hidden   ',0
     645spaces      db  '                        ',0
    515646
    516647;        In: DL - Active Partition
     
    825956        push    dx
    826957        call    TIMER_GetTicCount
    827         cmp     dx, wptr [FloppyGetNameTimer+2]
     958        cmp     dx, word ptr [FloppyGetNameTimer+2]
    828959        ja      BME_ExpiredGetFloppy
    829         cmp     ax, wptr [FloppyGetNameTimer+0]
     960        cmp     ax, word ptr [FloppyGetNameTimer+0]
    830961        jb      BME_NoFloppyNameExpired
    831962    BME_ExpiredGetFloppy:
     
    862993        int     16h
    863994        pop     dx
    864         cmp     ah, Keys_ENTER
     995
     996    ;!
     997    ;! DEBUG_BLOCK
     998    ;! Handle keys to activate debugging routines.
     999    ;!
     1000    IFDEF   AUX_DEBUG
     1001        call    DEBUG_HandleKeypress
     1002    ENDIF
     1003
     1004      cmp     ah, Keys_ENTER
    8651005        je      BME_KeyEnter
    8661006        cmp     ah, Keys_F10
     
    9501090        mov     dx, 160
    9511091        xor     di, di
     1092
     1093    IFDEF   FX_ENABLED
    9521094        call    FX_InterleaveCopy
    9531095        call    FX_ScrollScreenLeft
     1096    ENDIF
     1097
    9541098        mov     ah, 0
    9551099        int     16h                        ; Wait for any key
    9561100        call    BOOTMENU_ResetTimedBoot     ; Reset Timer
    9571101        call    BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
     1102
     1103    IFDEF   FX_ENABLED
    9581104        call    FX_ScrollScreenRight
    9591105        call    FX_EndScreenInternalCleanUp
     1106    ENDIF
     1107
    9601108        call    BOOTMENU_ResetTimedBoot    ; Reset Timer again...
    9611109        popa
     
    9831131        ret
    9841132BOOTMENU_ResetGetFloppy     EndP
     1133
     1134
     1135
  • trunk/BOOTCODE/REGULAR/CONV.ASM

    r46 r51  
    2828
    2929
    30 IFDEF ModuleNames
     30IFDEF   MODULE_NAMES
    3131DB 'CONV',0
    3232ENDIF
  • trunk/BOOTCODE/REGULAR/DEBUG.ASM

    r50 r51  
    2626; This module contains functions for debugging AiR-BOOT.
    2727; It is only included in debug builds and the codesize of AiR-BOOT increases
    28 ; in that case.
    29 ;
    30 ; Had problems with RU language version because it includes cyrillic charset.
    31 ; Parts disabled for now.
    32 
    33 
    34 IFDEF ModuleNames
     28; in that case. To compensate for that, the FX code is disabled when debugging
     29; is active. Also, most of the debug-routines can selectively be disabled
     30; by commenting-out the define above it.
     31
     32
     33
     34IFDEF   MODULE_NAMES
    3535DB 'DEBUG',0
    3636ENDIF
    3737
    38 DEBUG_CheckMath Proc    Near
    39         ;~ pushf
    40         ;~ pusha
    41 ;~
    42         ;~ ; Msg check math-module
    43         ;~ mov     si,offset db_checkmath
    44         ;~ call    AuxIO_Print
    45 ;~
    46         ;~ ; Output hex-word
    47         ;~ mov     ax,0BABEh
    48         ;~ call    AuxIO_TeletypeHexWord
    49 ;~
    50         ;~ mov     al,' '
    51         ;~ call    AuxIO_Teletype
    52         ;~ mov     al,'*'
    53         ;~ call    AuxIO_Teletype
    54         ;~ mov     al,' '
    55         ;~ call    AuxIO_Teletype
    56 ;~
    57         ;~ ; Output hex-word
    58         ;~ mov     ax,0BABEh
    59         ;~ call    AuxIO_TeletypeHexWord
    60 ;~
    61         ;~ mov     al,' '
    62         ;~ call    AuxIO_Teletype
    63         ;~ mov     al,'='
    64         ;~ call    AuxIO_Teletype
    65         ;~ mov     al,' '
    66         ;~ call    AuxIO_Teletype
    67 ;~
    68         ;~ mov     ax,0BABEh
    69         ;~ mul     ax
    70         ;~ call    AuxIO_TeletypeHexDWord
    71 ;~
    72         ;~ ; Start new line
    73         ;~ call    AuxIO_TeletypeNL
    74 ;~
    75         ;~ ; Output hex-dword
    76         ;~ mov     dx,0DEADh
    77         ;~ mov     ax,0FACEh
    78         ;~ call    AuxIO_TeletypeHexDWord
    79 ;~
    80         ;~ mov     al,' '
    81         ;~ call    AuxIO_Teletype
    82         ;~ mov     al,'*'
    83         ;~ call    AuxIO_Teletype
    84         ;~ mov     al,' '
    85         ;~ call     AuxIO_Teletype
    86 ;~
    87         ;~ ; Output hex-dword
    88         ;~ mov     dx,0DEADh
    89         ;~ mov     ax,0FACEh
    90         ;~ call    AuxIO_TeletypeHexDWord
    91 ;~
    92         ;~ mov     al,' '
    93         ;~ call    AuxIO_Teletype
    94         ;~ mov     al,'='
    95         ;~ call    AuxIO_Teletype
    96         ;~ mov     al,' '
    97         ;~ call    AuxIO_Teletype
    98 ;~
    99         ;~ mov     bx,0DEADh
    100         ;~ mov     cx,0FACEh
    101         ;~ mov     dx,0DEADh
    102         ;~ mov     ax,0FACEh
    103         ;~ call    MATH_Mul32
    104         ;~ call    AuxIO_TeletypeHexQWord
    105 ;~
    106         ;~ call    AuxIO_TeletypeNL
    107         ;~ call    AuxIO_TeletypeNL
    108 ;~
    109         ;~ popa
    110         ;~ popf
    111 
    112         ret
    113 DEBUG_CheckMath EndP
    114 
    115 
    116 DEBUG_DumpGeo   Proc
    117         ;~ pushf
    118         ;~ pusha
    119 ;~
    120         ;~ ; BIOS cyls
    121         ;~ mov     dx,word ptr [BIOS_Cyls+02]
    122         ;~ mov     ax,word ptr [BIOS_Cyls+00]
    123         ;~ call    AuxIO_TeletypeHexDWord
    124         ;~ call    AuxIO_TeletypeNL
    125 ;~
    126         ;~ ; BIOS heads
    127         ;~ mov     dx,word ptr [BIOS_Heads+02]
    128         ;~ mov     ax,word ptr [BIOS_Heads+00]
    129         ;~ call    AuxIO_TeletypeHexDWord
    130         ;~ call    AuxIO_TeletypeNL
    131 ;~
    132         ;~ ; BIOS secs
    133         ;~ mov     dx,word ptr [BIOS_Secs+02]
    134         ;~ mov     ax,word ptr [BIOS_Secs+00]
    135         ;~ call    AuxIO_TeletypeHexDWord
    136         ;~ call    AuxIO_TeletypeNL
    137 ;~
    138         ;~ ; Bytes per sector
    139         ;~ mov     ax,[BIOS_Bytes]
    140         ;~ call    AuxIO_TeletypeHexWord
    141         ;~ call    AuxIO_TeletypeNL
    142 ;~
    143         ;~ ; Total secs
    144         ;~ mov     bx, word ptr [BIOS_TotalSecs+06]
    145         ;~ mov     cx, word ptr [BIOS_TotalSecs+04]
    146         ;~ mov     dx, word ptr [BIOS_TotalSecs+02]
    147         ;~ mov     ax, word ptr [BIOS_TotalSecs+00]
    148         ;~ call    AuxIO_TeletypeHexDWord
    149         ;~ call    AuxIO_TeletypeNL
    150 ;~
    151         ;~ ; CHS to LBA
    152         ;~ mov     dx,1
    153         ;~ mov     ax,29e5h
    154         ;~ mov     bx,23h
    155         ;~ mov     cx,9h
    156         ;~ call    CONV_CHS2LBA
    157         ;~ call     AuxIO_TeletypeHexDWord
    158         ;~ call     AuxIO_TeletypeNL
    159 ;~
    160         ;~ popa
    161         ;~ popf
    162 
    163         ret
    164 DEBUG_DumpGeo   Endp
    165 
    166 
    167 
    168 DEBUG_DumpIPT   Proc
    169         pushf
    170         pusha
    171 
    172         call    AuxIO_TeletypeNL
    173 
    174         mov     si,offset [PartitionTable]
    175         call    AuxIO_DumpSector
    176 
    177         popa
    178         popf
    179         ret
    180 DEBUG_DumpIPT   EndP
    181 
    182 DEBUG_DumpNewPartTable  Proc
    183         pushf
    184         pusha
    185 
    186         call    AuxIO_TeletypeNL
    187 
    188         mov     si,offset [NewPartTable]
    189         call    AuxIO_DumpSector
    190 
    191         popa
    192         popf
    193         ret
    194 DEBUG_DumpNewPartTable  EndP
    195 
    196 DEBUG_DumpPartitionPointers     Proc
    197         pushf
    198         pusha
    199 
    200         call    AuxIO_TeletypeNL
    201 
    202         mov     si,offset [PartitionPointers]
    203         mov     cx,7
    204 
    205     DEBUG_DumpPartitionPointers_next:
    206         call    AuxIO_DumpParagraph
    207         add     si,16
    208         call    AuxIO_TeletypeNL
    209         loop    DEBUG_DumpPartitionPointers_next
    210 
    211         popa
    212         popf
    213         ret
    214 DEBUG_DumpPartitionPointers     EndP
    215 
    216 
    217 DEBUG_DumpPartitionXref     Proc
    218         pushf
    219         pusha
    220 
    221         call    AuxIO_TeletypeNL
    222 
    223         mov     si,offset [PartitionXref]
    224         mov     cx,3
    225 
    226     DEBUG_DumpPartitionXref_next:
    227         call    AuxIO_DumpParagraph
    228         add     si,16
    229         call    AuxIO_TeletypeNL
    230         loop    DEBUG_DumpPartitionXref_next
    231 
    232         popa
    233         popf
    234         ret
    235 DEBUG_DumpPartitionXref     EndP
    236 
    237 
    238 
    239 DEBUG_DumpDriveLetters      Proc
    240         pushf
    241         pusha
    242 
    243         call    AuxIO_TeletypeNL
    244 
    245         mov     si,offset [DriveLetters]
    246         mov     cx,2
    247 
    248     DEBUG_DumpDriveLetters_next:
    249         call    AuxIO_DumpParagraph
    250         add     si,16
    251         call    AuxIO_TeletypeNL
    252         loop    DEBUG_DumpDriveLetters_next
    253 
    254         popa
    255         popf
    256         ret
    257 DEBUG_DumpDriveLetters      EndP
    258 
    259 
    260 DEBUG_DumpRegisters     Proc
    261         pushf
    262         pusha
    263 
    264         call    AuxIO_TeletypeHexWord
    265         call    AuxIO_TeletypeNL
    266 
    267         mov     ax,bx
    268         call    AuxIO_TeletypeHexWord
    269         call    AuxIO_TeletypeNL
    270 
    271         mov     ax,cx
    272         call    AuxIO_TeletypeHexWord
    273         call    AuxIO_TeletypeNL
    274 
    275         mov     ax,dx
    276         call    AuxIO_TeletypeHexWord
    277         call    AuxIO_TeletypeNL
    278 
    279         mov     ax,si
    280         call    AuxIO_TeletypeHexWord
    281         call    AuxIO_TeletypeNL
    282 
    283         mov     ax,di
    284         call    AuxIO_TeletypeHexWord
    285         call    AuxIO_TeletypeNL
    286 
    287         mov     ax,ds
    288         call    AuxIO_TeletypeHexWord
    289         call    AuxIO_TeletypeNL
    290 
    291         mov     ax,es
    292         call    AuxIO_TeletypeHexWord
    293         call    AuxIO_TeletypeNL
    294 
    295         call    AuxIO_TeletypeNL
    296 
    297         popa
    298         popf
    299         ret
    300 DEBUG_DumpRegisters     EndP
     38;
     39; Display a number that was put on the stack.
     40; Used to track code-flow.
     41;
     42dbp     db  '>---------->> DebugProbe: ',0
     43DEBUG_Probe     Proc
     44        push    bp
     45        mov     bp,sp
     46        pushf
     47        pusha
     48
     49        mov     si,offset [dbp]         ; Default probe-text.
     50        call    AuxIO_Print
     51        mov     ax,[bp+04]              ; Get probe-number from stack.
     52        call    AuxIO_TeletypeHexWord
     53        call    AuxIO_TeletypeNL
     54
     55        ; Also display registers.
     56        popa
     57        pusha
     58        call    DEBUG_DumpRegisters
     59
     60        popa
     61        popf
     62        pop     bp
     63        ret     2
     64DEBUG_Probe     Endp
     65
     66
     67
     68;
     69; Show help on keys.
     70;
     71dbh     db  10,'h=HELP, d=DRIVE-LETTERS, g=GEO, i=IPT, r=RESTART, v=VOL-LETTERS, x=XREF',10,10,0
     72DEBUG_ShowHelp      Proc
     73        pushf
     74        pusha
     75        mov     si, offset dbh
     76        call    AuxIO_Print
     77        popa
     78        popf
     79        ret
     80DEBUG_ShowHelp      EndP
     81
     82
     83;
     84; Call list for debug hot-keys.
     85;
     86dbg_call_list:
     87        db      'd'
     88        dw      offset  DEBUG_DumpDriveLetters
     89        db      'g'
     90        dw      offset  DEBUG_DumpGeo
     91        db      'h'
     92        dw      offset  DEBUG_ShowHelp
     93        db      'i'
     94        dw      offset  DEBUG_DumpIPT
     95        db      'r'
     96        dw      offset  AirbootRestart
     97        db      'v'
     98        dw      offset  DEBUG_DumpVolumeLetters
     99        db      'x'
     100        dw      offset  DEBUG_DumpPartitionXref
     101        db      'R'
     102        dw      offset  AirbootRestart
     103        db      0
     104
     105;
     106; Handle keypresses when the main menu is active.
     107;
     108DEBUG_HandleKeypress    Proc
     109        pushf
     110        pusha
     111
     112        ; Save hot-key
     113        mov     dl,al
     114
     115        ; Check for digit.
     116        cmp     al,'0'
     117        jb      DEBUG_HandleKeypress_exit
     118        cmp     al,'9'
     119        ja      DEBUG_HandleKeypress_try_alpha
     120        ; It was a digit.
     121        jmp     DEBUG_HandleKeypress_check_it
     122
     123        ; Check for alpha.
     124    DEBUG_HandleKeypress_try_alpha:
     125        ; Force upper-case.
     126        and     al,11011111b
     127        cmp     al,'A'
     128        jb      DEBUG_HandleKeypress_exit
     129        cmp     al,'Z'
     130        ja      DEBUG_HandleKeypress_exit
     131        ; It was an alpha.
     132        jmp     DEBUG_HandleKeypress_check_it
     133
     134
     135        ; Check if the key is a hot-key.
     136    DEBUG_HandleKeypress_check_it:
     137        cld
     138        mov     si,offset dbg_call_list
     139
     140        ; Loop over jump-list.
     141    DEBUG_HandleKeypress_next_entry:
     142
     143        ; Load the hot-key.
     144        lodsb
     145        ; No hot-key (not implemented) if end-of-list.
     146        test    al,al
     147        jz      DEBUG_HandleKeypress_ni
     148
     149        ; Compare hot-key and iterate if not the same.
     150        cmp     dl,al
     151        lodsw
     152        jne     DEBUG_HandleKeypress_next_entry
     153
     154        ; Entry found, call corresponding routine.
     155        mov     bx,ax
     156        call    bx
     157
     158        ; Done.
     159        jmp     DEBUG_HandleKeypress_exit
     160
     161        ; Call not-assigned routine.
     162    DEBUG_HandleKeypress_ni:
     163        call    DEBUG_NotAssigned
     164        jmp     DEBUG_HandleKeypress_exit
     165
     166        ; Return to caller.
     167    DEBUG_HandleKeypress_exit:
     168        popa
     169        popf
     170        ret
     171DEBUG_HandleKeypress    Endp
     172
     173
     174
     175;
     176; Show not assigned message.
     177;
     178dbg_na  db  'This key is not assigned, press ''h'' for Help.',10,0
     179DEBUG_NotAssigned       Proc
     180        pushf
     181        pusha
     182        mov     si,offset dbg_na
     183        call    AuxIO_Print
     184        popa
     185        popf
     186        ret
     187DEBUG_NotAssigned       Endp
     188
     189
    301190
    302191;
     
    318207        ; Start new line
    319208        call    AuxIO_TeletypeNL
    320         call    AuxIO_TeletypeNL
     209        ;~ call    AuxIO_TeletypeNL
    321210
    322211        ;~ call    DEBUG_DumpHidePartTables
    323 
    324212        ;~ call    DEBUG_CheckMath
    325 
    326213        ;~ call    DEBUG_DumpGeo
    327 
    328214        ;~ call    DEBUG_CheckBitFields
    329215
     
    334220
    335221
     222;
     223; Check the simple 32-bit math functions.
     224;
     225;~ __CHECK_MATH__  EQU
     226DEBUG_CheckMath Proc    Near
     227    IFDEF   __CHECK_MATH__
     228        pushf
     229        pusha
     230
     231        ; Msg check math-module
     232        mov     si,offset db_checkmath
     233        call    AuxIO_Print
     234
     235        ; Output hex-word
     236        mov     ax,0BABEh
     237        call    AuxIO_TeletypeHexWord
     238
     239        mov     al,' '
     240        call    AuxIO_Teletype
     241        mov     al,'*'
     242        call    AuxIO_Teletype
     243        mov     al,' '
     244        call    AuxIO_Teletype
     245
     246        ; Output hex-word
     247        mov     ax,0BABEh
     248        call    AuxIO_TeletypeHexWord
     249
     250        mov     al,' '
     251        call    AuxIO_Teletype
     252        mov     al,'='
     253        call    AuxIO_Teletype
     254        mov     al,' '
     255        call    AuxIO_Teletype
     256
     257        mov     ax,0BABEh
     258        mul     ax
     259        call    AuxIO_TeletypeHexDWord
     260
     261        ; Start new line
     262        call    AuxIO_TeletypeNL
     263
     264        ; Output hex-dword
     265        mov     dx,0DEADh
     266        mov     ax,0FACEh
     267        call    AuxIO_TeletypeHexDWord
     268
     269        mov     al,' '
     270        call    AuxIO_Teletype
     271        mov     al,'*'
     272        call    AuxIO_Teletype
     273        mov     al,' '
     274        call     AuxIO_Teletype
     275
     276        ; Output hex-dword
     277        mov     dx,0DEADh
     278        mov     ax,0FACEh
     279        call    AuxIO_TeletypeHexDWord
     280
     281        mov     al,' '
     282        call    AuxIO_Teletype
     283        mov     al,'='
     284        call    AuxIO_Teletype
     285        mov     al,' '
     286        call    AuxIO_Teletype
     287
     288        mov     bx,0DEADh
     289        mov     cx,0FACEh
     290        mov     dx,0DEADh
     291        mov     ax,0FACEh
     292        call    MATH_Mul32
     293        call    AuxIO_TeletypeHexQWord
     294
     295        call    AuxIO_TeletypeNL
     296        call    AuxIO_TeletypeNL
     297
     298        popa
     299        popf
     300    ENDIF
     301        ret
     302DEBUG_CheckMath EndP
     303
     304
     305;
     306; Dump the geometry.
     307;
     308__DUMP_GEO__    EQU
     309DEBUG_DumpGeo   Proc
     310    IFDEF   __DUMP_GEO__
     311        pushf
     312        pusha
     313
     314        ; BIOS cyls
     315        mov     dx,word ptr [BIOS_Cyls+02]
     316        mov     ax,word ptr [BIOS_Cyls+00]
     317        call    AuxIO_TeletypeHexDWord
     318        call    AuxIO_TeletypeNL
     319
     320        ; BIOS heads
     321        mov     dx,word ptr [BIOS_Heads+02]
     322        mov     ax,word ptr [BIOS_Heads+00]
     323        call    AuxIO_TeletypeHexDWord
     324        call    AuxIO_TeletypeNL
     325
     326        ; BIOS secs
     327        mov     dx,word ptr [BIOS_Secs+02]
     328        mov     ax,word ptr [BIOS_Secs+00]
     329        call    AuxIO_TeletypeHexDWord
     330        call    AuxIO_TeletypeNL
     331
     332        ; Bytes per sector
     333        mov     ax,[BIOS_Bytes]
     334        call    AuxIO_TeletypeHexWord
     335        call    AuxIO_TeletypeNL
     336
     337        ; Total secs
     338        mov     bx, word ptr [BIOS_TotalSecs+06]
     339        mov     cx, word ptr [BIOS_TotalSecs+04]
     340        mov     dx, word ptr [BIOS_TotalSecs+02]
     341        mov     ax, word ptr [BIOS_TotalSecs+00]
     342        call    AuxIO_TeletypeHexDWord
     343        call    AuxIO_TeletypeNL
     344
     345        ; CHS to LBA
     346        mov     dx,1
     347        mov     ax,29e5h
     348        mov     bx,23h
     349        mov     cx,9h
     350        call    CONV_CHS2LBA
     351        call     AuxIO_TeletypeHexDWord
     352        call     AuxIO_TeletypeNL
     353
     354        popa
     355        popf
     356    ENDIF
     357
     358        ret
     359DEBUG_DumpGeo   Endp
     360
     361
     362;
     363; Dump the internal partition table.
     364;
     365__DUMP_IPT__    EQU
     366DEBUG_DumpIPT   Proc
     367    IFDEF   __DUMP_IPT__
     368        pushf
     369        pusha
     370
     371        call    AuxIO_TeletypeNL
     372
     373        mov     si,offset [BIOScontIPTentry]
     374        ;~ mov     si,offset [PartitionTable]
     375        call    AuxIO_DumpSector
     376
     377        popa
     378        popf
     379    ENDIF
     380        ret
     381DEBUG_DumpIPT   EndP
     382
     383
     384;
     385; Dump the new  partitions table.
     386;
     387;~ __DUMP_NPT__    EQU
     388DEBUG_DumpNewPartTable  Proc
     389    IFDEF   __DUMP_NPT__
     390        pushf
     391        pusha
     392
     393        call    AuxIO_TeletypeNL
     394
     395        mov     si,offset [NewPartTable]
     396        call    AuxIO_DumpSector
     397
     398        popa
     399        popf
     400    ENDIF
     401        ret
     402DEBUG_DumpNewPartTable  EndP
     403
     404
     405;
     406; Dump the partition pointers table.
     407;
     408;~ __DUMP_PP__     EQU
     409DEBUG_DumpPartitionPointers     Proc
     410    IFDEF   __DUMP_PP__
     411        pushf
     412        pusha
     413
     414        call    AuxIO_TeletypeNL
     415
     416        mov     si,offset [PartitionPointers]
     417        mov     cx,7
     418
     419    DEBUG_DumpPartitionPointers_next:
     420        call    AuxIO_DumpParagraph
     421        add     si,16
     422        call    AuxIO_TeletypeNL
     423        loop    DEBUG_DumpPartitionPointers_next
     424
     425        popa
     426        popf
     427    ENDIF
     428        ret
     429DEBUG_DumpPartitionPointers     EndP
     430
     431
     432;
     433; Dump the partition x-ref table.
     434;
     435__DUMP_PX__     EQU
     436DEBUG_DumpPartitionXref     Proc
     437    IFDEF   __DUMP_PX__
     438        pushf
     439        pusha
     440
     441        mov     si, offset [xrt]
     442        call    AuxIO_Print
     443        ;~ call    AuxIO_TeletypeNL
     444
     445        mov     si,offset [PartitionXref]
     446        mov     cx,3
     447
     448    DEBUG_DumpPartitionXref_next:
     449        call    AuxIO_DumpParagraph
     450        add     si,16
     451        call    AuxIO_TeletypeNL
     452        loop    DEBUG_DumpPartitionXref_next
     453
     454        popa
     455        popf
     456    ENDIF
     457        ret
     458DEBUG_DumpPartitionXref     EndP
     459
     460
     461;
     462; Dump the dl-feature drive-letters.
     463;
     464__DUMP_DL__     EQU
     465DEBUG_DumpDriveLetters      Proc
     466    IFDEF   __DUMP_DL__
     467        pushf
     468        pusha
     469
     470        mov     si, offset [ddl]
     471        call    AuxIO_Print
     472
     473        ; Dump the old drive-letters as set with the dl-feature.
     474        mov     si,offset [DriveLetters]
     475        mov     cx,3
     476    DEBUG_DumpDriveLetters_next_1:
     477        call    AuxIO_DumpParagraph
     478        add     si,16
     479        call    AuxIO_TeletypeNL
     480        loop    DEBUG_DumpDriveLetters_next_1
     481
     482        ; Dump the new drive-letters as composed when scanning partitions
     483        ; and partitions were added or removed.
     484        mov     si,offset [NewDriveLetters]
     485        mov     cx,3
     486    DEBUG_DumpDriveLetters_next_2:
     487        call    AuxIO_DumpParagraph
     488        add     si,16
     489        call    AuxIO_TeletypeNL
     490        loop    DEBUG_DumpDriveLetters_next_2
     491
     492        popa
     493        popf
     494    ENDIF
     495        ret
     496DEBUG_DumpDriveLetters      EndP
     497
     498
     499;
     500; Dump the lvm volume drive-letters.
     501;
     502__DUMP_VL__     EQU
     503DEBUG_DumpVolumeLetters     Proc
     504    IFDEF   __DUMP_VL__
     505        pushf
     506        pusha
     507
     508        mov     si, offset [dvl]
     509        call    AuxIO_Print
     510
     511        mov     si,offset [PartitionVolumeLetters]
     512        mov     cx,3
     513
     514    DEBUG_DumpVolumeLetters_next:
     515        call    AuxIO_DumpParagraph
     516        add     si,16
     517        call    AuxIO_TeletypeNL
     518        loop    DEBUG_DumpVolumeLetters_next
     519
     520        popa
     521        popf
     522    ENDIF
     523        ret
     524DEBUG_DumpVolumeLetters     EndP
     525
     526
     527
     528
     529;
     530; Dump the registers.
     531;
     532__DUMP_REG__    EQU
     533IFDEF   __DUMP_REG__
     534regAX   db  'AX:',0
     535regBX   db  ' BX:',0
     536regCX   db  ' CX:',0
     537regDX   db  ' DX:',0
     538regSI   db  ' SI:',0
     539regDI   db  ' DI:',0
     540
     541regBP   db  'CS:',0
     542regSP   db  ' DS:',0
     543regCS   db  ' ES:',0
     544regSS   db  ' SS:',0
     545regDS   db  ' SP:',0
     546regES   db  ' BP:',0
     547
     548;~ regFS   db  'FS:',0
     549;~ regGS   db  ' GS:',0
     550ENDIF
     551DEBUG_DumpRegisters     Proc
     552    IFDEF   __DUMP_REG__
     553        pushf
     554        pusha
     555
     556        push    si
     557        mov     si, offset regAX
     558        call    AuxIO_Print
     559        call    AuxIO_TeletypeHexWord
     560        ;~ call    AuxIO_TeletypeNL
     561
     562        call    AuxIO_Print
     563        mov     ax,bx
     564        call    AuxIO_TeletypeHexWord
     565        ;~ call    AuxIO_TeletypeNL
     566
     567        call    AuxIO_Print
     568        mov     ax,cx
     569        call    AuxIO_TeletypeHexWord
     570        ;~ call    AuxIO_TeletypeNL
     571
     572        call    AuxIO_Print
     573        mov     ax,dx
     574        call    AuxIO_TeletypeHexWord
     575        ;~ call    AuxIO_TeletypeNL
     576
     577        call    AuxIO_Print
     578        pop     ax
     579        call    AuxIO_TeletypeHexWord
     580        ;~ call    AuxIO_TeletypeNL
     581
     582        call    AuxIO_Print
     583        mov     ax,di
     584        call    AuxIO_TeletypeHexWord
     585        call    AuxIO_TeletypeNL
     586
     587
     588
     589        call    AuxIO_Print
     590        mov     ax,cs
     591        call    AuxIO_TeletypeHexWord
     592        ;~ call    AuxIO_TeletypeNL
     593
     594        call    AuxIO_Print
     595        mov     ax,ds
     596        call    AuxIO_TeletypeHexWord
     597        ;~ call    AuxIO_TeletypeNL
     598
     599        call    AuxIO_Print
     600        mov     ax,es
     601        call    AuxIO_TeletypeHexWord
     602        ;~ call    AuxIO_TeletypeNL
     603
     604        call    AuxIO_Print
     605        mov     ax,ss
     606        call    AuxIO_TeletypeHexWord
     607        ;~ call    AuxIO_TeletypeNL
     608
     609        call    AuxIO_Print
     610        mov     ax,sp
     611        call    AuxIO_TeletypeHexWord
     612        ;~ call    AuxIO_TeletypeNL
     613
     614        call    AuxIO_Print
     615        mov     ax,bp
     616        call    AuxIO_TeletypeHexWord
     617        call    AuxIO_TeletypeNL
     618
     619        ;~ call    AuxIO_Print
     620        ;~ mov     ax,fs
     621        ;~ call    AuxIO_TeletypeHexWord
     622        ;~ call    AuxIO_TeletypeNL
     623
     624        ;~ call    AuxIO_Print
     625        ;~ mov     ax,gs
     626        ;~ call    AuxIO_TeletypeHexWord
     627        ;~ call    AuxIO_TeletypeNL
     628
     629        call    AuxIO_TeletypeNL
     630
     631        popa
     632        popf
     633    ENDIF
     634        ret
     635DEBUG_DumpRegisters     EndP
     636
     637
     638;
     639; Dump CHS values.
     640;
     641__DUMP_CHS__    EQU
     642DEBUG_DumpCHS   Proc    Near
     643    IFDEF   __DUMP_CHS__
     644        pushf
     645        pusha
     646        mov     al,'C'
     647        call    AuxIO_Teletype
     648        mov     al,':'
     649        call    AuxIO_Teletype
     650        mov     ah,cl
     651        shr     ah,6
     652        mov     al,ch
     653        call    AuxIO_TeletypeHexWord
     654        mov     al,' '
     655        call    AuxIO_Teletype
     656        mov     al,'H'
     657        call    AuxIO_Teletype
     658        mov     al,':'
     659        call    AuxIO_Teletype
     660        mov     al,dh
     661        call    AuxIO_TeletypeHexByte
     662        mov     al,' '
     663        call    AuxIO_Teletype
     664        mov     al,'S'
     665        call    AuxIO_Teletype
     666        mov     al,':'
     667        call    AuxIO_Teletype
     668        mov     al,cl
     669        and     al,00111111b
     670        call    AuxIO_TeletypeHexByte
     671        call    AuxIO_TeletypeNL
     672        popa
     673        popf
     674    ENDIF
     675        ret
     676DEBUG_DumpCHS   EndP
     677
     678
     679;
     680; Dump BSS.
     681;
     682;~ __DUMP_BSS__    EQU
    336683DEBUG_DumpBSSSectors    Proc    Near
    337         ;~ pushf
    338         ;~ pusha
    339 ;~
    340         ;~ mov     si, offset [PartitionSector]
    341         ;~ call    AuxIO_DumpSector
    342         ;~ call    AuxIO_TeletypeNL
    343 ;~
    344         ;~ mov     si, offset [JfsPBR]
    345         ;~ call    AuxIO_DumpSector
    346         ;~ call    AuxIO_TeletypeNL
    347 ;~
    348         ;~ mov     si, offset [LVMSector]
    349         ;~ call    AuxIO_DumpSector
    350         ;~ call    AuxIO_TeletypeNL
    351 ;~
    352         ;~ mov     si, offset [TmpSector]
    353         ;~ call    AuxIO_DumpSector
    354         ;~ call    AuxIO_TeletypeNL
    355 ;~
    356         ;~ mov     si, offset [NewPartTable]
    357         ;~ call    AuxIO_DumpSector
    358         ;~ call    AuxIO_TeletypeNL
    359         ;~ call    AuxIO_TeletypeNL
    360 ;~
    361         ;~ popa
    362         ;~ popf
     684    IFDEF   __DUMP_BSS__
     685        pushf
     686        pusha
     687
     688        mov     si, offset [PartitionSector]
     689        call    AuxIO_DumpSector
     690        call    AuxIO_TeletypeNL
     691
     692        mov     si, offset [PBRSector]
     693        call    AuxIO_DumpSector
     694        call    AuxIO_TeletypeNL
     695
     696        mov     si, offset [LVMSector]
     697        call    AuxIO_DumpSector
     698        call    AuxIO_TeletypeNL
     699
     700        mov     si, offset [TmpSector]
     701        call    AuxIO_DumpSector
     702        call    AuxIO_TeletypeNL
     703
     704        mov     si, offset [NewPartTable]
     705        call    AuxIO_DumpSector
     706        call    AuxIO_TeletypeNL
     707        call    AuxIO_TeletypeNL
     708
     709        popa
     710        popf
     711    ENDIF
    363712        ret
    364713DEBUG_DumpBSSSectors    EndP
    365714
    366715
     716;
     717; Dump 6-bit packed hide partition table.
     718;
     719;~ __DUMP_HPT__    EQU
    367720DEBUG_DumpHidePartTables    Proc    Near
    368         ;~ pushf
    369         ;~ pusha
    370 ;~
    371         ;~ mov     cx,3
    372         ;~ mov     si, offset [HidePartitionTable]
    373     ;~ again1:
    374         ;~ call    AuxIO_DumpSector
    375         ;~ add     si,512
    376         ;~ loop    again1
    377         ;~ call    AuxIO_TeletypeNL
    378 ;~
    379         ;~ mov     cx,3
    380         ;~ mov     si, offset [PartitionXref]
    381     ;~ again2:
    382         ;~ call    AuxIO_DumpParagraph
    383         ;~ call    AuxIO_TeletypeNL
    384         ;~ add     si,16
    385         ;~ loop    again2
    386         ;~ call    AuxIO_TeletypeNL
    387 ;~
    388         ;~ mov     cx,3
    389         ;~ mov     si, offset [NewHidePartTable]
    390     ;~ again3:
    391         ;~ call    AuxIO_DumpSector
    392         ;~ add     si,512
    393         ;~ loop    again3
    394         ;~ call    AuxIO_TeletypeNL
    395 ;~
    396         ;~ popa
    397         ;~ popf
     721    IFDEF   __DUMP_HPT__
     722        pushf
     723        pusha
     724
     725        mov     cx,3
     726        mov     si, offset [HidePartitionTable]
     727    again1:
     728        call    AuxIO_DumpSector
     729        add     si,512
     730        loop    again1
     731        call    AuxIO_TeletypeNL
     732
     733        mov     cx,3
     734        mov     si, offset [PartitionXref]
     735    again2:
     736        call    AuxIO_DumpParagraph
     737        call    AuxIO_TeletypeNL
     738        add     si,16
     739        loop    again2
     740        call    AuxIO_TeletypeNL
     741
     742        mov     cx,3
     743        mov     si, offset [NewHidePartTable]
     744    again3:
     745        call    AuxIO_DumpSector
     746        add     si,512
     747        loop    again3
     748        call    AuxIO_TeletypeNL
     749
     750        popa
     751        popf
     752    ENDIF
    398753        ret
    399754DEBUG_DumpHidePartTables    EndP
    400755
    401756
     757;
     758; Check the bitfield routines.
     759;
     760;~ __CBF__     EQU
    402761DEBUG_CheckBitFields    Proc
    403         ;~ pushf
    404         ;~ pusha
    405 ;~
    406         ;~ mov     bx,offset [ott]
    407 ;~
    408         ;~ mov     al,0
    409         ;~ mov     dl,0
    410         ;~ mov     dh,6
    411     ;~ DEBUG_CheckBitFields_next_write:
    412         ;~ call    CONV_SetBitfieldValue
    413         ;~ inc     al
    414         ;~ inc     dl
    415         ;~ jnz     DEBUG_CheckBitFields_next_write
    416 ;~
    417         ;~ mov     dl,0
    418         ;~ mov     dh,6
    419     ;~ DEBUG_CheckBitFields_next_read:
    420         ;~ mov     al,dl
    421         ;~ call    AuxIO_TeletypeHexByte
    422         ;~ mov     al,':'
    423         ;~ call    AuxIO_Teletype
    424         ;~ call    CONV_GetBitfieldValue
    425         ;~ call    AuxIO_TeletypeHexWord
    426         ;~ call    AuxIO_TeletypeNL
    427         ;~ inc     dl
    428         ;~ jnz     DEBUG_CheckBitFields_next_read
    429 ;~
    430         ;~ popa
    431         ;~ popf
     762    IFDEF   __CBF__
     763        pushf
     764        pusha
     765
     766        mov     bx,offset [ott]
     767
     768        mov     al,0
     769        mov     dl,0
     770        mov     dh,6
     771    DEBUG_CheckBitFields_next_write:
     772        call    CONV_SetBitfieldValue
     773        inc     al
     774        inc     dl
     775        jnz     DEBUG_CheckBitFields_next_write
     776
     777        mov     dl,0
     778        mov     dh,6
     779    DEBUG_CheckBitFields_next_read:
     780        mov     al,dl
     781        call    AuxIO_TeletypeHexByte
     782        mov     al,':'
     783        call    AuxIO_Teletype
     784        call    CONV_GetBitfieldValue
     785        call    AuxIO_TeletypeHexWord
     786        call    AuxIO_TeletypeNL
     787        inc     dl
     788        jnz     DEBUG_CheckBitFields_next_read
     789
     790        popa
     791        popf
     792    ENDIF
    432793        ret
    433794DEBUG_CheckBitFields    EndP
    434795
     796
     797
     798
    435799;
    436800; Dump information before the partition is booted.
    437801;
     802;~ __DMP2__    EQU
    438803DEBUG_Dump2     Proc  Near
    439         ;~ pushf
    440         ;~ pusha
    441 ;~
    442 ;~
    443         ;~ call    AuxIO_TeletypeNL
    444         ;~ call    AuxIO_TeletypeNL
    445 ;~
    446 ;~
    447         ;~ mov     si,offset db_config
    448         ;~ call    AuxIO_Print
    449 ;~
    450         ;~ mov     si,offset db_cfgparts
    451         ;~ call    AuxIO_Print
    452         ;~ mov     al,[CFG_Partitions]
    453         ;~ call    AuxIO_TeletypeHexByte
    454         ;~ call    AuxIO_TeletypeNL
    455 ;~
    456         ;~ mov     si,offset db_cfgpartdef
    457         ;~ call    AuxIO_Print
    458         ;~ mov     al,[CFG_PartDefault]
    459         ;~ call    AuxIO_TeletypeHexByte
    460         ;~ call    AuxIO_TeletypeNL
    461 ;~
    462         ;~ mov     si,offset db_cfgpartlast
    463         ;~ call    AuxIO_Print
    464         ;~ mov     al,[CFG_PartLast]
    465         ;~ call    AuxIO_TeletypeHexByte
    466         ;~ call    AuxIO_TeletypeNL
    467         ;~ call    AuxIO_TeletypeNL
    468 ;~
    469 ;~
    470 ;~
    471         ;~ mov     si,offset db_vars
    472         ;~ call    AuxIO_Print
    473 ;~
    474         ;~ mov     si,offset db_newpart
    475         ;~ call    AuxIO_Print
    476         ;~ mov     si,offset NewPartTable
    477         ;~ call    AuxIO_DumpSector
    478         ;~ call    AuxIO_TeletypeNL
    479         ;~ add     si,512
    480         ;~ call    AuxIO_DumpSector
    481         ;~ call    AuxIO_TeletypeNL
    482         ;~ call    AuxIO_TeletypeNL
    483 ;~
    484         ;~ mov     si,offset db_newhide
    485         ;~ call    AuxIO_Print
    486         ;~ mov     si,offset NewHidePartTable
    487         ;~ call    AuxIO_DumpSector
    488         ;~ call    AuxIO_TeletypeNL
    489         ;~ add     si,512
    490         ;~ call    AuxIO_DumpSector
    491         ;~ call    AuxIO_TeletypeNL
    492         ;~ call    AuxIO_TeletypeNL
    493 ;~
    494         ;~ mov     si,offset db_dletters
    495         ;~ call    AuxIO_Print
    496         ;~ mov     si,offset NewDriveLetters
    497         ;~ call    AuxIO_DumpParagraph
    498         ;~ call    AuxIO_TeletypeNL
    499         ;~ add     si,16
    500         ;~ call    AuxIO_DumpParagraph
    501         ;~ call    AuxIO_TeletypeNL
    502         ;~ call    AuxIO_TeletypeNL
    503 ;~
    504         ;~ mov     si,offset db_tmpec
    505         ;~ call    AuxIO_Print
    506         ;~ mov     si,offset TmpSector
    507         ;~ call    AuxIO_DumpSector
    508         ;~ call    AuxIO_TeletypeNL
    509         ;~ call    AuxIO_TeletypeNL
    510 ;~
    511         ;~ mov     si,offset db_partsec
    512         ;~ call    AuxIO_Print
    513         ;~ mov     si,offset PartitionSector
    514         ;~ call    AuxIO_DumpSector
    515         ;~ call    AuxIO_TeletypeNL
    516         ;~ call    AuxIO_TeletypeNL
    517 ;~
    518         ;~ popa
    519         ;~ popf
     804    IFDEF   __DMP2__
     805        pushf
     806        pusha
     807
     808        call    AuxIO_TeletypeNL
     809        call    AuxIO_TeletypeNL
     810
     811        mov     si,offset db_config
     812        call    AuxIO_Print
     813
     814        mov     si,offset db_cfgparts
     815        call    AuxIO_Print
     816        mov     al,[CFG_Partitions]
     817        call    AuxIO_TeletypeHexByte
     818        call    AuxIO_TeletypeNL
     819
     820        mov     si,offset db_cfgpartdef
     821        call    AuxIO_Print
     822        mov     al,[CFG_PartDefault]
     823        call    AuxIO_TeletypeHexByte
     824        call    AuxIO_TeletypeNL
     825
     826        mov     si,offset db_cfgpartlast
     827        call    AuxIO_Print
     828        mov     al,[CFG_PartLast]
     829        call    AuxIO_TeletypeHexByte
     830        call    AuxIO_TeletypeNL
     831        call    AuxIO_TeletypeNL
     832
     833        mov     si,offset db_vars
     834        call    AuxIO_Print
     835
     836        mov     si,offset db_newpart
     837        call    AuxIO_Print
     838        mov     si,offset NewPartTable
     839        call    AuxIO_DumpSector
     840        call    AuxIO_TeletypeNL
     841        add     si,512
     842        call    AuxIO_DumpSector
     843        call    AuxIO_TeletypeNL
     844        call    AuxIO_TeletypeNL
     845
     846        mov     si,offset db_newhide
     847        call    AuxIO_Print
     848        mov     si,offset NewHidePartTable
     849        call    AuxIO_DumpSector
     850        call    AuxIO_TeletypeNL
     851        add     si,512
     852        call    AuxIO_DumpSector
     853        call    AuxIO_TeletypeNL
     854        call    AuxIO_TeletypeNL
     855
     856        mov     si,offset db_dletters
     857        call    AuxIO_Print
     858        mov     si,offset NewDriveLetters
     859        call    AuxIO_DumpParagraph
     860        call    AuxIO_TeletypeNL
     861        add     si,16
     862        call    AuxIO_DumpParagraph
     863        call    AuxIO_TeletypeNL
     864        call    AuxIO_TeletypeNL
     865
     866        mov     si,offset db_tmpec
     867        call    AuxIO_Print
     868        mov     si,offset TmpSector
     869        call    AuxIO_DumpSector
     870        call    AuxIO_TeletypeNL
     871        call    AuxIO_TeletypeNL
     872
     873        mov     si,offset db_partsec
     874        call    AuxIO_Print
     875        mov     si,offset PartitionSector
     876        call    AuxIO_DumpSector
     877        call    AuxIO_TeletypeNL
     878        call    AuxIO_TeletypeNL
     879
     880        popa
     881        popf
     882    ENDIF
    520883        ret
    521884DEBUG_Dump2     EndP
     
    523886
    524887
    525 db_mbr              db "## MBR ##",10,0
    526 db_masterlvm        db "## MLVMR ##",10,0
    527 
    528 db_checkmath        db "## CHK MATH ##",10,0
    529 
    530 
    531 db_config           db '## CFG (DMP2) ##',10,0
    532 db_cfgparts         db 'CFG_Partitions:',0
    533 db_cfgpartdef       db 'CFG_PartDefault:',0
    534 db_cfgpartlast      db 'CFG_PartLast:',0
    535 
    536 
    537 db_vars             db '## VARS ##',10,0
    538 db_partsec          db 'PartitionSector:',10,0
    539 ;db_lvmsec           db 'LVMSector :',10,0
    540 db_tmpec            db 'TmpSector :',10,0
    541 
    542 db_newpart          db 'NewPartTable :',10,0
    543 db_newhide          db 'NewHideTable:',10,0
    544 db_dletters         db 'NewDriveLetters:',10,0
    545 
    546 ;db_partsize         db 'PartitionSizeTable:',10,0
    547 ;db_partpoint        db 'PartitionPointers:',10,0
    548 ;db_partpointcnt     db 'PartitionPointerCount:',0
    549 ;db_partxref         db 'PartitionXref:',10,0
    550 ;db_partvoldl        db 'PartitionVolumeLetters:',10,0
    551 
    552 ;db_totaldisks       db 'TotalHarddiscs:',0
    553 ;db_lbaswitchtab     db 'LBASwitchTable:',10,0
    554 ;db_newparts         db 'NewPartitions:',0
    555 
    556 ;db_exabspos         db 'ExtendedAbsPos:',0
    557 ;db_exabsposset      db 'ExtendedAbsPosSet:',0
    558 
    559 db_curpartloc       db 'CurPartition_Location:',0
    560 ;db_curiox           db 'CurIO_UseExtension:',0
    561 
    562 db_curlvmsec        db 'Current LVM Sector:',0
    563 
    564 
    565 drive                   db 'drive                    : ',0
    566 before_lvm_adjust       db 'before lvm adjust        : ',0
    567 after_lvm_adjust        db 'after lvm adjust         : ',0
    568 before_lvm_adjust_log   db 'before lvm logical adjust: ',0
    569 after_lvm_adjust_log    db 'after lvm logical adjust : ',0
    570 spt_used                db 'spt used                 : ',0
     888xrt     db  10,'XrefTable:',10,0
     889ddl     db  10,'Driveletters:',10,0
     890dvl     db  10,'VolumeLetters:',10,0
     891dlra    db  10,'LVM_DoLetterReassignment: ',0
     892ptetb   db  10,'Partition Table Entry to boot',10,0
     893bios_reg    db  10,'Registers passed by BIOS:',10,0
     894;~ diopmbr db  10,'DriveIO_ProtectMBR',10,0
     895dioss   db  10,'DriveIO_SaveSector',10,0
     896
     897
     898;~ db_mbr              db "## MBR ##",10,0
     899;~ db_masterlvm        db "## MLVMR ##",10,0
     900
     901;~ db_checkmath        db "## CHK MATH ##",10,0
     902
     903
     904;~ db_config           db '## CFG (DMP2) ##',10,0
     905;~ db_cfgparts         db 'CFG_Partitions:',0
     906;~ db_cfgpartdef       db 'CFG_PartDefault:',0
     907;~ db_cfgpartlast      db 'CFG_PartLast:',0
     908
     909
     910;~ db_vars             db '## VARS ##',10,0
     911;~ db_partsec          db 'PartitionSector:',10,0
     912;~ db_lvmsec           db 'LVMSector :',10,0
     913;~ db_tmpec            db 'TmpSector :',10,0
     914
     915;~ db_newpart          db 'NewPartTable :',10,0
     916;~ db_newhide          db 'NewHideTable:',10,0
     917;~ db_dletters         db 'NewDriveLetters:',10,0
     918
     919;~ db_partsize         db 'PartitionSizeTable:',10,0
     920;~ db_partpoint        db 'PartitionPointers:',10,0
     921;~ db_partpointcnt     db 'PartitionPointerCount:',0
     922;~ db_partxref         db 'PartitionXref:',10,0
     923;~ db_partvoldl        db 'PartitionVolumeLetters:',10,0
     924
     925;~ db_totaldisks       db 'TotalHarddiscs:',0
     926;~ db_lbaswitchtab     db 'LBASwitchTable:',10,0
     927;~ db_newparts         db 'NewPartitions:',0
     928
     929;~ db_exabspos         db 'ExtendedAbsPos:',0
     930;~ db_exabsposset      db 'ExtendedAbsPosSet:',0
     931
     932;~ db_curpartloc       db 'CurPartition_Location:',0
     933;~ db_curiox           db 'CurIO_UseExtension:',0
     934
     935;~ db_curlvmsec        db 'Current LVM Sector:',0
     936
     937
     938;~ drive                   db 'drive                    : ',0
     939;~ before_lvm_adjust       db 'before lvm adjust        : ',0
     940;~ after_lvm_adjust        db 'after lvm adjust         : ',0
     941;~ before_lvm_adjust_log   db 'before lvm logical adjust: ',0
     942;~ after_lvm_adjust_log    db 'after lvm logical adjust : ',0
     943;~ spt_used                db 'spt used                 : ',0
  • trunk/BOOTCODE/REGULAR/DRIVEIO.ASM

    r50 r51  
    2222
    2323
    24 IFDEF ModuleNames
     24IFDEF   MODULE_NAMES
    2525DB 'DRIVEIO',0
    2626ENDIF
     
    161161        pop     si
    162162        pop     ds
    163         mov     TotalHarddiscs, dh
     163        mov     [TotalHarddiscs], dh
    164164        ret
    165165DriveIO_GetHardDriveCount   EndP
     
    172172DriveIO_InitLBASwitchTable  Proc Near   Uses es di
    173173        mov     di, offset LBASwitchTable
    174         mov     dh, TotalHarddiscs
     174        mov     dh, [TotalHarddiscs]
    175175        mov     dl, 80h
    176176    DIOILUT_DriveLoop:
     
    206206
    207207
     208
     209
    208210; Adjusts BX:AX / CX:DX to meet LVM sector location
     211; BX:AX / CX:DX point to MBR or EBR !
    209212;  Destroys SI
    210213; Rousseau: Enhanced to handle sector-numbers 127 and 255 besides 63 for LVM-info sectors.
    211214;           Ugly, need to cleanup.
    212215DriveIO_LVMAdjustToInfoSector   Proc Near
    213 
    214         ;~ pusha
    215         ;~ call    AuxIO_TeletypeNL
    216 ;~
    217         ;~ ; LBA
    218         ;~ xchg    dx,bx
    219         ;~ call    AuxIO_TeletypeHexDWord
    220         ;~ call    AuxIO_TeletypeNL
    221         ;~ xchg    bx,dx
    222 ;~
    223         ;~ ; CYL
    224         ;~ mov     al,ch
    225         ;~ call    AuxIO_TeletypeHexByte
    226         ;~ call    AuxIO_TeletypeNL
    227 ;~
    228         ;~ ; HEAD
    229         ;~ mov     al,dh
    230         ;~ call    AuxIO_TeletypeHexByte
    231         ;~ call    AuxIO_TeletypeNL
    232 ;~
    233         ;~ ; SEC
    234         ;~ mov     al,cl
    235         ;~ call    AuxIO_TeletypeHexByte
    236         ;~ call    AuxIO_TeletypeNL
    237 ;~
    238         ;~ ; DRIVE
    239         ;~ mov     al,dl
    240         ;~ call    AuxIO_TeletypeHexByte
    241         ;~ call    AuxIO_TeletypeNL
    242         ;~ popa
    243 ;~
    244         ;~ ;local   ts:word
    245         ;~ ;local   ts2:word
    246 
    247         pusha
    248 
    249             ; Dump drive
    250             ;mov      si,offset drive
    251             ;call     AuxIO_Print
    252             ;xchg     al,dl
    253             ;call     AuxIO_TeletypeHexByte
    254             ;call     AuxIO_TeletypeNL
    255             ;xchg     dl,al
    256 
    257             ; Dump SPT
    258             ;mov      si,offset spt_used
    259             ;call     AuxIO_Print
    260             push     dx
    261             push     bx
    262                 xor      dh,dh
    263                 and      dl,01111111b
    264                 shl      dx,1
    265                 shl      dx,1
    266                 mov      bx, offset TrueSecs
    267                 add      bx,dx
    268                 mov      ax,word ptr [bx]
    269                 ;mov      [ts],ax
    270                 ;call     AuxIO_TeletypeHexWord
    271                 ;call     AuxIO_TeletypeNL
    272             pop      bx
    273             pop      dx
    274 
    275             pusha
    276                 push    dx
    277                 ; Location of extended position
    278                 mov     dx,word ptr [ExtendedAbsPos+02]
    279                 mov     ax,word ptr [ExtendedAbsPos+00]
    280                 ;call    AuxIO_TeletypeHexDWord
    281                 ;call    AuxIO_TeletypeNL
    282                 pop     dx
    283 
    284                 xor     dh,dh
    285                 and     dl,01111111b
    286                 shl     dx,1
    287                 shl     dx,1
    288                 mov     bx, offset TrueSecs
    289                 add     bx,dx
    290 
    291                 mov     ax, word ptr[bx]
     216        push    cx                      ; Save Cyl/Sec part
     217        xor     ch,ch                   ; Clear low Cyl part
     218        and     cl,63                   ; Clear high Cyl part
     219        push    bx                      ; We need BX...
     220        push    dx                      ; and DX temoraily
     221        mov     bx,offset [TrueSecs]    ; Offset of sector table
     222        xor     dh,dh                   ; Clear DH because we use DL as index
     223        and     dl,01111111b            ; Remove high bit of BIOS disk-nr
     224        shl     dx,2                    ; Index to DWORD table
     225        add     bx,dx                   ; Point to TrueSecs for this disk
     226        mov     si,[bx]                 ; Get SPT for this disk
     227        pop     dx                      ; Restore DX...
     228        pop     bx                      ; and BX
     229        ;~ sub     si,cx                   ; Adjust offset                      !! INCORRECT FOR LBA (TP CX != 0 !!)
     230        dec     si
     231        pop     cx                      ; Restore Cyl/Sec part
     232        add     ax,si                   ; Add offset to low part...
     233        adc     bx,0                    ; and high part of LBA address
     234        or      cl,63                   ; Adjust CHS part   !FIX ME for > 63!   !! FIX HUGE DRIVE !!
     235        ret
     236
     237
     238;;jmp bliep
     239;;        pusha
     240
     241;;            push     dx
     242;;            push     bx
     243;;                xor      dh,dh
     244;;                and      dl,01111111b
     245;;                shl      dx,1
     246;;                shl      dx,1
     247;;                mov      bx, offset [TrueSecs]
     248;;                add      bx,dx
     249;;                mov      ax,word ptr [bx]
     250;;            pop      bx
     251;;            pop      dx
     252
     253
     254            ;
     255            ; AX now contains LVM secs
     256            ;
     257
     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;;                mov     ax, word ptr[bx]
     275
    292276                ;call    AuxIO_TeletypeHexWord
    293277                ;call    AuxIO_TeletypeNL
    294                 mov     al,[ExtendedAbsPosSet]           ; if true -> 1st sector of extpart (EBR), not logpart(BPB)
     278;;                mov     al,[ExtendedAbsPosSet]           ; if true -> 1st sector of extpart (EBR), not logpart(BPB)
    295279                ;call    AuxIO_TeletypeHexByte
    296280                ;call    AuxIO_TeletypeNL
    297281                ;mov     si,offset PartitionSector
    298282                ;call    AuxIO_DumpSector
    299             popa
     283;;            popa
    300284
    301285            ; LBA
     
    307291            ;call    AuxIO_TeletypeNL
    308292            ;xchg    bx,dx
    309         popa
    310 
     293;;        popa
     294
     295
     296;;bliep:
    311297
    312298      ;or       bx,ax
    313       test     byte ptr [ExtendedAbsPosSet],1
    314       jz       pri
    315 
    316 
    317 
    318 
    319         ;pusha
    320             ;mov      si,offset before_lvm_adjust_log
    321             ;call     AuxIO_Print
    322             ; LBA
    323             ;xchg     dx,bx
    324             ;call     AuxIO_TeletypeHexDWord
    325             ;call     AuxIO_TeletypeNL
    326             ;xchg     bx,dx
    327         ;popa
    328 
    329 
    330         push     dx
    331         push     bx
    332 
    333             xor      dh,dh
    334             and      dl,01111111b
    335             shl      dx,1
    336             shl      dx,1
    337             mov      bx,offset TrueSecs
    338             add      bx,dx
    339             mov      dx,[bx]
    340             dec      dx
    341             add      ax,dx
    342 
    343         pop      bx
    344         pop      dx
    345         adc      bx,0
    346 
    347 
    348         ;pusha
    349             ;mov     si,offset after_lvm_adjust_log
    350             ;call    AuxIO_Print
    351             ; LBA
    352             ;xchg    dx,bx
    353             ;call    AuxIO_TeletypeHexDWord
    354             ;call    AuxIO_TeletypeNL
    355             ;xchg    bx,dx
    356         ;popa
    357 
    358         jmp      done
    359 
    360 
    361 
    362 
    363     pri:
    364 
    365 
    366         push    ax
    367         push    cx
    368             xor     ch, ch                           ; Zero out upper-byte
    369 
    370             push    dx
    371                 xor     dh,dh
    372                 and     dl,01111111b
    373                 shl     dx,1
    374                 shl     dx,1
    375 
    376                 push    bx
    377                     mov     bx,offset TrueSecs
    378                     add     bx,dx
    379                     mov     ax,[bx]
     299;;      test     byte ptr [ExtendedAbsPosSet],1
     300;;      jz       pri
     301
     302
     303;;        push     dx
     304;;        push     bx
     305
     306;;            xor      dh,dh
     307;;            and      dl,01111111b           ; Strip high bit from disk
     308;;            shl      dx,1                   ; Convert to index
     309;;            shl      dx,1                   ; into TrueSecs table
     310;;            mov      bx,offset [TrueSecs]   ; Base of table
     311;;            add      bx,dx                  ; Point to entry for disk
     312;;            mov      dx,[bx]                ; Get TrueSecs (LVM)
     313;;            dec      dx
     314;;            add      ax,dx
     315
     316;;        pop      bx
     317;;        pop      dx
     318;;        adc      bx,0
     319
     320
     321;;        jmp      done
     322
     323
     324
     325;;    pri:
     326
     327
     328;;        push    ax
     329;;        push    cx
     330;;            xor     ch, ch                           ; Zero out upper-byte
     331
     332;;            push    dx
     333;;                xor     dh,dh
     334;;                and     dl,01111111b
     335;;                shl     dx,1
     336;;                shl     dx,1
     337
     338;;                push    bx
     339;;                    mov     bx,offset [TrueSecs]
     340;;                    add     bx,dx
     341;;                    mov     ax,[bx]
    380342                    ;mov     [ts2],ax
    381                 pop     bx
    382             pop     dx
     343;;                pop     bx
     344;;            pop     dx
    383345
    384346
     
    394356            ; ALLEEN TOEPASSEN ALS INT13X NIET ACTIEF !
    395357
    396             and     cl, al                           ; Isolate lower bits, because upper
    397             mov     ah, 0
    398             mov     si, ax                           ;  ones may be used for cylinder
    399             sub     si, cx
    400 
    401         pop     cx
    402         pop     ax
    403 
    404         or      cl, al                           ; Set sector to last sector
    405         add     ax, si                           ; Adjust lower LBA
    406         adc     bx, 0                            ; Adjust LBA Sector (BX:AX)
     358;;            and     cl, al                           ; Isolate lower bits, because upper
     359;;            mov     ah, 0
     360;;            mov     si, ax                           ;  ones may be used for cylinder
     361;;            sub     si, cx
     362
     363;;        pop     cx
     364;;        pop     ax
     365
     366;;        or      cl, al                           ; Set sector to last sector
     367;;        add     ax, si                           ; Adjust lower LBA
     368;;        adc     bx, 0                            ; Adjust LBA Sector (BX:AX)
    407369
    408370
     
    421383        ;~ and      ax,[ts]
    422384
    423       jmp done
    424 
    425 
    426 
    427     done:
     385;;      jmp done
     386
     387
     388
     389;;    done:
    428390
    429391        ;pusha
     
    461423        ;~ popa
    462424
    463       ret
     425;;      ret
    464426DriveIO_LVMAdjustToInfoSector   EndP
    465427
     
    496458    DIOLP_Success:
    497459
    498     IFDEF AUX_DEBUG
     460    IFDEF   AUX_DEBUG
    499461        ; show current partition location
    500462        ;~ pushf
     
    553515DriveIO_SaveTmpSector   EndP
    554516
     517
     518
    555519; Keeps DS:SI for caller, sets carry if valid LVM sector encountered
    556520DriveIO_LoadLVMSector   Proc Near  Uses ax bx cx dx
     
    567531        call    DriveIO_LoadSector
    568532
    569     IFDEF AUX_DEBUG
     533    IFDEF   AUX_DEBUG
    570534        ; show current partition location
    571535        ;~ pushf
     
    597561DriveIO_LoadLVMSector   EndP
    598562
     563
     564
    599565; Keeps DS:SI for caller, saves at anytime w/o checks (!)
    600566DriveIO_SaveLVMSector   Proc Near  Uses ax bx cx dx
     
    608574        jnc     DIOSLVMS_SevereError                  ; LVM Signature must be there
    609575
    610 IFDEF   AUX_DEBUG
    611         ;~ call    DEBUG_DumpRegisters
    612 ENDIF
     576    IFDEF   AUX_DEBUG
     577;~ dioatlvm    db 'DriveIO_LVMAdjustToInfoSector',10,0
     578        ;~ pushf
     579        ;~ pusha
     580        ;~ mov     si,offset dioatlvm
     581        ;~ call    AuxIO_Print
     582        ;~ popa
     583        ;~ popf
     584        call    DEBUG_DumpRegisters
     585        call    DEBUG_DumpCHS
     586    ENDIF
    613587
    614588        call    DriveIO_LVMAdjustToInfoSector
    615589
    616 IFDEF   AUX_DEBUG
    617         ;~ call    DEBUG_DumpRegisters
    618 ENDIF
     590    IFDEF   AUX_DEBUG
     591        call    DEBUG_DumpRegisters
     592        call    DEBUG_DumpCHS
     593    ENDIF
    619594
    620595        mov     si, offset LVMSector
     
    670645; Preserve: all registers
    671646; #########################################################################
    672 DriveIO_LoadSector      Proc Near  Uses ax bx ds si es di
     647DriveIO_LoadSector      Proc Near  Uses ax bx cx dx ds si es di
    673648        ; Is the drive not a harddrive?
    674649        cmp     dl, 80h
     
    680655        jnz     DIOLS_UseExtension
    681656
    682         ; Upper 8 bits of LBA-address set? -> Use LBA (maximum boundary is FB0400h)
     657        ; Upper 8 bits of LBA-address set?
     658        ; Then use LBA (maximum boundary is 16320x16x63 = FB0400h)
    683659        or      bh, bh
    684660        jnz     DIOLS_UseExtension
     
    787763
    788764
     765;
     766; ############################################################
     767; # Check for a valid MBR-sector to be written to disk       #
     768; ############################################################
     769;
     770; In
     771; --
     772; DL     = Physical Disk
     773; BX:CX  = LBA sector
     774; DI:SI  = Source buffer
     775;
     776; Out
     777; ---
     778; CY     = 1 if invalid MBR in source buffer, 0 if valid
     779;
     780; This routine is called when DriveIO_SaveSector attempts to write to the MBR.
     781; It checks if the sector to be written has some sensible values in certain
     782; places. In fact, if the sector is written to the boot-disk, the AiR-BOOT
     783; signature should be present and the partition table should be the same
     784; as the one at the start of the AiR-BOOT code in memory, except maybe for the
     785; active flags.
     786; For other disks, only the active flags are checked to be 00h or 80h and
     787; the AA55h MBR signature.
     788;
     789DriveIO_ProtectMBR  Proc Near
     790        pusha           ; Push all registers
     791        push    es      ; Push ES because we need it for string instructions
     792        push    cs      ; Make ES point...
     793        pop     es      ; to CS
     794
     795        ; Save the pointer to the sector to write in BX
     796        mov     bx,si
     797
     798        ;
     799        ; If the sector to be written is not the boot-disk, then skip
     800        ; checking the AiR-BOOT MBR.
     801        ;
     802        cmp     dl,80h
     803        ja      DriveIO_ProtectMBR_is_not_bootdisk
     804
     805        ;
     806        ; The boot-disk is accessed so the sector to be written must be
     807        ; the AiR-BOOT MBR. This is the same as the first 512 bytes
     808        ; relocated to 8000:0000 and this the start of the AB-code.
     809        ;
     810        mov     si,bx                       ; Get pointer to sector to write
     811        xor     di,di                       ; Point DI to start of AB-code (MBR)
     812        mov     cx, offset [MBR_PartTable]  ; Bytes upto P-table must be same
     813        cld                                 ; Compare upwards
     814        repe    cmpsb                       ; Compare upto P-table
     815
     816        ; If not the same this is not the an AiR-BOOT boot-disk MBR !
     817        jne     DriveIO_ProtectMBR_not_valid_MBR            ; SEVERE ERROR !
     818
     819        ; Continue with signature check
     820        jmp     DriveIO_ProtectMBR_check_signature
     821
     822
     823    ;
     824    ; The disk is not the boot-disk so we don't know what kind of MBR is on it.
     825    ; Some sanity checks should be here.
     826    ;
     827    DriveIO_ProtectMBR_is_not_bootdisk:
     828
     829        ;
     830        ; sanity checks...
     831        ;
     832
     833        ; Continue with signature check
     834        jmp     DriveIO_ProtectMBR_check_signature
     835
     836
     837    DriveIO_ProtectMBR_check_signature:
     838        ; See if the sector to write contains a valid signature
     839        mov     si,bx                   ; Get pointer to sector to write
     840        mov     di, offset [MBR_Sig]    ; Offset to MBR signature
     841        add     si,di                   ; Make SI point to it in sec to write
     842        lodsw                           ; Load it
     843        cmp     ax,0aa55h               ; See if it is valid
     844
     845        ; If no signature this cannot be a valid MBR !
     846        jne     DriveIO_ProtectMBR_not_valid_MBR            ; SEVERE ERROR !
     847
     848
     849    ;
     850    ; The sector to be written seems to be valid.
     851    ; Set CY=0 to indicate a valid MBR.
     852    ;
     853    DriveIO_ProtectMBR_is_valid_MBR:
     854        clc
     855        jmp     DriveIO_ProtectMBR_end
     856
     857    ;
     858    ; Something is terribly wrong; a non-MBR sector seems about to be written.
     859    ; Set CY=1 and let the calling code handle this situation.
     860    ;
     861    DriveIO_ProtectMBR_not_valid_MBR:
     862        stc
     863        jmp     DriveIO_ProtectMBR_end
     864
     865    ;
     866    ; Return to the caller with no registers modyfied except FLAGS.
     867    ;
     868    DriveIO_ProtectMBR_end:
     869        pop     es
     870        popa
     871        ret
     872DriveIO_ProtectMBR  Endp
     873
     874
     875
     876; #########################################################################
     877; Routine: Checks if the MBR is addressed by either CHS or LBA
     878; #########################################################################
     879; Calling : bx:ax - Absolute sector
     880;           cx:dx - Cylinder/Sector, Side/Drive (hi/lo-byte)
     881; Returns : ZF=1 if MBR is addressed, else ZF=0
     882; Preserve: all registers
     883; #########################################################################
     884DriveIO_MBR_Addressed   Proc
     885        push    ax
     886        push    bx
     887
     888        or      bx,ax   ; Results in 0 in BX if MBR is addressed by LBA
     889        jz      DriveIO_MBR_Addressed_done
     890
     891        mov     ax,cx   ; Results in 1 in AX if CYL 0, SEC 1 is addressed
     892        add     al,dh   ; Results in 1 in AX if HEAD 0 is addressed
     893        dec     ax      ; Results in 0 in AX if MBR is addressed by CHS
     894
     895    DriveIO_MBR_Addressed_done:
     896        pop     bx
     897        pop     ax
     898        ret
     899DriveIO_MBR_Addressed   EndP
     900
     901
     902
    789903
    790904; #########################################################################
     
    797911; Preserve: all registers
    798912; #########################################################################
    799 DriveIO_SaveSector              Proc Near  Uses ax bx cx ds si es di
    800 
    801 IFDEF   AUX_DEBUG
     913DriveIO_SaveSector              Proc Near  Uses ax bx cx dx ds si es di
     914
     915
     916    ;!
     917    ;! DEBUG_BLOCK
     918    ;! Force write to LBA0 to test interception routine.
     919    ;! Do *NOT* enable unless you are debugging, will overwrite MBR !
     920    ;!
     921    ;~ __DIO_FORCE_LBA0_WRITE__    EQU
     922    IFDEF   AUX_DEBUG
     923        IFDEF   __DIO_FORCE_LBA0_WRITE__
     924        xor ax,ax
     925        xor bx,bx
     926        xor cx,cx
     927        inc cx
     928        xor dh,dh
     929        ENDIF
     930    ENDIF
     931
     932
     933    ;!
     934    ;! DEBUG_BLOCK
     935    ;! Check what is being written to disk.
     936    ;! Uncomment below to activate.
     937    ;!
     938    __DIO_SS_DMP__  EQU
     939    IFDEF   AUX_DEBUG
     940        IFDEF   __DIO_SS_DMP__
     941        pusha
     942        push    si
     943        mov     si,offset dioss
     944        call    AuxIO_Print
     945        pop     si
    802946        call    DEBUG_DumpRegisters
    803947        call    AuxIO_DumpSector
    804948        call    AuxIO_TeletypeNL
    805 ENDIF
    806 
     949        popa
     950        ENDIF
     951    ENDIF
     952
     953        ;
     954        ; Check if the MBR is the destination for the write.
     955        ; ZF=1 if so.
     956        ;
     957        call    DriveIO_MBR_Addressed
     958        jnz     DriveIO_SaveSector_continue_write
     959
     960
     961        ; MBR is addressed, check the sector that is requested to be written.
     962        ; For the bootdisk it should contain the AiR-BOOT signature, valid
     963        ; partition-table entries and the AA55h signature.
     964        ; If not, something is terribly wrong in some piece of the AB code.
     965        ; For any other disk (80h+) at least a valid partition table should
     966        ; be present together with the AA55h signature.
     967        call    DriveIO_ProtectMBR
     968        jnc     DriveIO_SaveSector_continue_write
     969
     970
     971        ;
     972        ; WE HAVE A SEVERE ERROR CONDITION !
     973        ; SOME AB CODE TRIES TO WRITE A NON-MBR TO THE DISK !
     974        ; ASK THE USER TO REPORT THIS !
     975        ; HALT THE SYSTEM !
     976        ;
     977
     978        ; Show error-box
     979        mov     cx, 0C04h
     980        mov     si, offset NonMBRwrite
     981        call    SETUP_ShowErrorBox
     982        mov     cx, 0C04h
     983        mov     si, offset NonMBRwrite_rep
     984        call    SETUP_ShowErrorBox
     985
     986
     987    IFDEF   AUX_DEBUG
     988        pusha
     989        mov     si, offset NonMBRwrite
     990        call    AuxIO_TeletypeNL
     991        call    AuxIO_Print
     992        call    AuxIO_TeletypeNL
     993        popa
     994    ENDIF
     995
     996        ; Show popup and halt the system.
     997        jmp    HaltSystem
     998
     999
     1000
     1001    ;
     1002    ; Continue the write if not MBR sector or MBR to write is validated.
     1003    ;
     1004    DriveIO_SaveSector_continue_write:
    8071005        test    byte ptr cs:[CurIO_UseExtension], 1
    8081006        jz      DIOSS_UseNormal
     
    8801078; Rousseau: # Load the master LVM-sector if one exists #
    8811079; ------------------------------------------------------
    882 ; Load the master LVM-sector to get the number of sectors per track as eCS views the drive.
    883 ; If no master LVM-sector is found it is assumed eCS is not installed.
    884 ; The master LVM-sector can be located at three different places according to drive size
    885 ; and partitioning scheme and driver used.
    886 ; When DANIS506.ADD is used, the eCS extended geometry will be 255/127 for drives >502GiB but <1TiB.
    887 ; Then the location will be sector 127 which is LBA 126 (7Eh).
     1080; Load the master LVM-sector to get the number of sectors per track as
     1081; eCS views the drive. If no master LVM-sector is found it is assumed eCS
     1082; is not installed. The master LVM-sector can be located at three different
     1083; places depending on drive size and partitioning scheme and driver used.
     1084; When DANIS506.ADD is used, the eCS extended geometry will be 255/127 for
     1085; drives >502GiB but <1TiB. Then the location will be sector 127 which
     1086; is LBA 126 (7Eh).
    8881087; IBM1S506.ADD will always use 255/255 for the extended eCS geometry.
    8891088; DANIS506.ADD will use 255/255 for drives >1TiB.
    8901089; Then the location of the master LVM-sector will be 255 which is LBA 254 (FEh).
    891 ; When eCS is installed on a huge drive that alread had a system on it, eCS will be confined to the
    892 ; lower 502GiB of the drive. In this case the normal geometry from Int13X will be used.
     1090; When eCS is installed on a huge drive that alread had a system on it, eCS
     1091; will be confined to the lower 502GiB of the drive.
     1092; In this case the normal geometry from Int13X will be used.
    8931093; This is also the case when no valid master LVM-sector can be found.
    8941094;
     
    9141114
    9151115        ; Loop over the sector-translation table,
    916         ; process the first three values from high (255) to low (bios spt, most likely 63)
     1116        ; process the first three values from high (255) to low.
     1117        ; (bios spt, most likely 63)
    9171118        mov     cx,3
    9181119    DriveIO_LoadMasterLVMSector_NextTry:
     
    9211122
    9221123        ; Setup destination address
    923         mov     si, offset LVMSector
    924         mov     wptr [DriveIO_DAP_Transfer+0],si
     1124        mov     si, offset [LVMSector]
     1125        mov     word ptr [DriveIO_DAP_Transfer+0],si
    9251126        mov     ax, ds
    926         mov     wptr [DriveIO_DAP_Transfer+2],ax
     1127        mov     word ptr [DriveIO_DAP_Transfer+2],ax
    9271128
    9281129        ; Get the sector-number of the next possible LVM sector (255,127,63)
     
    9501151        ;~ pop     ax
    9511152
    952 IFDEF AUX_DEBUG
     1153    IFDEF  AUX_DEBUG
    9531154        ; Dump the value
    9541155        ;~ call     AuxIO_TeletypeHexByte
    9551156        ;~ call     AuxIO_TeletypeNL
    956 ENDIF
     1157    ENDIF
    9571158
    9581159        ; Setup the requested LBA sector number
    959         mov     wptr [DriveIO_DAP_Absolute+0],ax       ; LBA low
    960         mov     wptr [DriveIO_DAP_Absolute+2],00h      ; LBA high
    961         mov     si, offset DriveIO_DAP                 ; address request packet
     1160        mov     word ptr [DriveIO_DAP_Absolute+0],ax    ; LBA low                   NORMAL I/O GEBRUIKEN !
     1161        mov     word ptr [DriveIO_DAP_Absolute+2],00h   ; LBA high
     1162        mov     si, offset DriveIO_DAP                  ; address request packet
    9621163        mov     ah, 42h
    963         int     13h                                    ; do the i/o
     1164        int     13h                                     ; do the i/o
    9641165        cmc     ; Complement carry so we can exit imm. on error
    9651166        jnc     DriveIO_LoadMasterLVMSector_End  ; oops, return with NC
    9661167
    9671168
    968         mov     si,offset LVMSector
     1169        mov     si,offset [LVMSector]
    9691170
    9701171        ; See if this is a valid LVM-sector
     1172        ; CY=1 if valid
    9711173        call    DriveIO_LVMSectorValid
    9721174
     
    9921194
    9931195    DriveIO_LoadMasterLVMSector_Found:
     1196        ; Store the address for later use.
     1197        mov     ax, word ptr [DriveIO_DAP_Absolute]
     1198        mov     word ptr [MasterLVMLBA], ax
     1199
    9941200    DriveIO_LoadMasterLVMSector_End:
    9951201        popa
     
    10111217; There are a few boundaries that are of importance.
    10121218; Note that these are disk-boundaries and not partition boundaries.
    1013 ; Even with a small partition, like <502GiB, OS/2 will use extended geometry on an
    1014 ; empty huge disk.
     1219; Even with a small partition, like <502GiB, OS/2 will use extended geometry on
     1220; an empty huge disk.
    10151221; These boundaries are (from high to low):
    10161222
     
    10401246; (code 1)
    10411247; 65536*255*63  = 1052835840 = 3EC10000 sectors ~ 502 GiB
    1042 ;   This is the current OS/2 limit using this geometry because OS/2 can currently
    1043 ;   not address more than 65536 cylinders.
    1044 ;   DANI will address space above with 255/127 extended geometry up until the DANI 1TiB boundary (code 2)
     1248;   This is the current OS/2 limit using this geometry because OS/2 can
     1249;   currently not address more than 65536 cylinders.
     1250;   DANI will address space above with 255/127 extended geometry up until
     1251;   the DANI 1TiB boundary (code 2)
    10451252
    10461253; (code 0)
     
    10521259;
    10531260
    1054 ; 5 = This drive is above the 2^32 LBA32 (2TB) boundary and has more than 4294967296 sectors.
     1261; 5 = This drive is above the 2^32 LBA32 (2TB) boundary and has more
     1262;     than 4294967296 sectors.
    10551263;     LBA48 addressing is needed to access the complete capacity of the drive.
    10561264;     OS/2 is currently unable to do so.
    10571265
    10581266; 4 = This drive is above the 65536*255*255 (4261478400) boundary but below 2^32.
    1059 ;     This is an OS/2 boundary and OS/2 is not able to access the drive above this boundary.
    1060 
    1061 ; 3 = This drive is above the 2^31 (1TB) boundary and has more than 2147483648 sectors.
     1267;     This is an OS/2 boundary and OS/2 is not able to access the drive above
     1268;     this boundary.
     1269
     1270; 3 = This drive is above the 2^31 (1TB) boundary and has more than
     1271;     2147483648 sectors.
    10621272;     OS/2 is able to access the drive using it's extended geometry.
    10631273;     Both DANIS506 and IBM1S506 will use the 255/255 scheme.
     
    10671277;     Both DANIS506 and IBM1S506 will use the 255/255 scheme.
    10681278
    1069 ; 1 = This drive is above the 65536*255*63 (1052835840) boundary but below 65536*255*127.
     1279; 1 = This drive is above the 65536*255*63 (1052835840) boundary but
     1280;     below 65536*255*127.
    10701281;     OS/2 is able to access the drive using it's extended geometry.
    10711282;     Note that DANIS506 will use 255/127 and IBM1S506 will use 255/255 geometry !
  • trunk/BOOTCODE/REGULAR/MATH.ASM

    r30 r51  
    2828
    2929
    30 IFDEF ModuleNames
     30IFDEF   MODULE_NAMES
    3131DB 'MATH',0
    3232ENDIF
  • trunk/BOOTCODE/REGULAR/OTHER.ASM

    r50 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'OTHER',0
    2424ENDIF
     
    8282GetLenOfStrings     EndP
    8383
     84
     85
     86
     87;
     88; DO PREPARING STUFF.
     89;
    8490PRECRAP_Main    Proc Near
    8591        ; First initialize Variable-Area (everything with NUL)
     
    8793        ; to an offset. We want everything after the code to be nullified.
    8894        mov     di, offset sobss
    89         mov     cx, offset EndOfVariables-offset BeginOfVariables
     95        mov     cx, offset EndOfVariables - offset sobss
    9096        xor     ax, ax
    9197        shr     cx, 1
     
    9399        rep     stosw
    94100
     101
     102    ;
     103    ; Tasm needs .386 to handle 32-bit constants so we push the current
     104    ; operating state and switch temporarily to handle
     105    ; InitialFreeDriveletterMap.
     106    ;
     107    IFDEF   TASM
     108        pushstate
     109        .386
     110    ENDIF
     111        ; Initialize the FreeDriveletterMap.
     112        ; This is used by driveletter reassignment functions.
     113        mov     di, offset [FreeDriveletterMap]
     114        mov     ax, InitialFreeDriveletterMap AND 0ffffh
     115        cld
     116        stosw
     117        mov     ax, InitialFreeDriveletterMap SHR 16
     118        stosw
     119    ;
     120    ; Restore Tasm operating state.
     121    ;
     122    IFDEF   TASM
     123        popstate
     124    ENDIF
     125
     126
     127        ; Use video page 0 for screen output
    95128        mov     word ptr [VideoIO_Segment], VideoIO_Page0
    96129
     
    134167
    135168
    136         ; This sets [CurIO_UseExtension] flag
     169        ; This sets [CurIO_UseExtension] flag.
    137170        call    PRECRAP_CheckFor13extensions
    138171        mov     al,[CurIO_UseExtension]
    139172        test    al,al
    140         jnz     INT13X_Present
    141 
    142 ;
    143 ; Change this to a popup.
    144 ;
    145 INT13X_Missing db '!! NO INT13X !!',0
    146         mov     si, offset INT13X_Missing
    147         call    MBR_Teletype
    148         jmp     MBR_HaltSystem
    149 
    150 INT13X_Present:
     173        jnz     INT13X_Supported
     174
     175        ;
     176        ; Show Message that BIOS INT13X is not supported
     177        ; and Halt the System.
     178        ;
     179        mov     cx, 0C04h
     180        mov     si, offset TXT_NoINT13XSupport
     181        call    SETUP_ShowErrorBox
     182
     183        ; Halt the system.
     184        jmp     HaltSystem
     185
     186
     187    ;
     188    ; INT13X Supported so continue.
     189    ;
     190    INT13X_Supported:
     191
    151192        xor     cx,cx
    152193    PRECRAP_Main_next_disk:
     
    160201        call     DriveIO_GatherDiskInfo              ; Also used to fill the geo, should be separate function
    161202
    162         mov      bx,offset HugeDisk
     203        mov      bx,offset [HugeDisk]
    163204        add      bx,cx
    164205        mov      [bx], al
     
    178219        ;~ call    VideoIO_PrintSingleChar
    179220
    180         mov      bx, offset TrueSecs
     221        mov      bx, offset [TrueSecs]
    181222        add      bx,cx
    182223        add      bx,cx
     
    190231
    191232        ; ?? 3f bij disk 80h maar 0 bij disk 81h
    192         mov     si,offset LVMSector
     233        mov     si,offset [LVMSector]
    193234        mov     ax,[si+LocLVM_Secs]
    194235
     
    209250    NoValidMasterLVM:
    210251        push    bx                   ; push truesecs pointer
    211         mov     bx, offset BIOS_Secs
     252        mov     bx, offset [BIOS_Secs]
    212253        add     bx,cx
    213254        add     bx,cx
     
    227268
    228269
    229     IFDEF AUX_DEBUG
     270    IFDEF   AUX_DEBUG
    230271        ; Write some debug-info to the com-port
    231272        call     DEBUG_Dump1
     
    253294
    254295        ; Huge Disk indicator
    255         mov     si, offset HugeBootDisk
     296        mov     si, offset [HugeBootDisk]
    256297        call    MBR_Teletype
    257298        mov     al,[HugeDisk]
    258         mov     si, offset No
     299        mov     si, offset [No]
    259300        test    al,al
    260301        jz      MBR_HugeDriveIndicator
    261         mov     si, offset Yes
     302        mov     si, offset [Yes]
    262303
    263304    MBR_HugeDriveIndicator:
     
    270311        ; Phase 1 Indicator
    271312        ;
    272         mov     si, offset Phase1
     313        mov     si, offset [Phase1]
    273314        call    MBR_Teletype
    274315
     
    286327
    287328        ; Calculate Cooper-Bar Tables
     329    IFDEF   FX_ENABLED
    288330        call    FX_CalculateTables
     331    ENDIF
    289332
    290333        ; Calculate LVM-CRC-Table
     
    312355
    313356
    314     call    PRECRAP_CheckConfiguration
     357        ;
     358        ; Check valididy of the AiR-BOOT Configuration.
     359        ;
     360        call    PRECRAP_CheckConfiguration
    315361
    316362
     
    366412        ret
    367413PRECRAP_Main    EndP
     414
     415
     416
    368417
    369418AFTERCRAP_Main  Proc Near
     
    381430        ret
    382431AFTERCRAP_Main  EndP
     432
     433
     434
    383435
    384436PRECRAP_CheckFor13extensions    Proc Near
  • trunk/BOOTCODE/REGULAR/PARTMAIN.ASM

    r50 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'PARTMAIN',0
    2424ENDIF
    2525
    2626PART_FixUpDefaultPartitionValues Proc Near  Uses dx si di
    27    ; Fix-Up Default and Last Partition - If lost, search for Bootable
    28    xor     bl, bl
    29    mov     dl, CFG_PartDefault
    30    call    PART_FixUpSelectionNumber
    31    mov     CFG_PartDefault, dl
    32    mov     dl, CFG_PartLast
    33    call    PART_FixUpSelectionNumber
    34    mov     CFG_PartLast, dl
    35    mov     dl, CFG_PartAutomatic
    36    call    PART_FixUpSelectionNumber
    37    mov     CFG_PartAutomatic, dl
     27    ; Fix-Up Default and Last Partition - If lost, search for Bootable
     28    xor     bl, bl
     29    mov     dl, CFG_PartDefault
     30    call    PART_FixUpSelectionNumber
     31    mov     CFG_PartDefault, dl
     32    mov     dl, CFG_PartLast
     33    call    PART_FixUpSelectionNumber
     34    mov     CFG_PartLast, dl
     35    mov     dl, CFG_PartAutomatic
     36    call    PART_FixUpSelectionNumber
     37    mov     CFG_PartAutomatic, dl
    3838
    3939; [Linux support removed since v1.02]
     
    6868;       Out: DL - New number of partition (guessed normally ;)
    6969PART_FixUpSelectionNumber       Proc Near Uses ax cx
    70    cmp     dl, 080h
    71    je      PFUPN_SelectionDisabled
    72    ja      PFUPN_SpecialSelection
    73    call    PARTSCAN_GetXref              ; DL - PartitionNo prev IPT
    74    cmp     dh, 0FFh                      ; DH -> Partition No in new IPT
    75    je      PFUPN_SelectionGone
    76    mov     dl, dh
    77   PFUPN_SelectionDisabled:
    78    ret
    79 
    80   PFUPN_SpecialSelection:
    81    cmp     dl, 0FEh                      ; Resume-BIOS?
    82    ja      PFUPN_SpecialSelectionFloppy
    83    cmp     byte ptr [CFG_ResumeBIOSbootSeq], 0
    84    je      PFUPN_SelectionGone
    85    jmp     PFUPN_Found
    86   PFUPN_SpecialSelectionFloppy:
    87    cmp     byte ptr [CFG_IncludeFloppy], 0
    88    je      PFUPN_SelectionGone
    89    jmp     PFUPN_Found
    90 
    91    ; Partition is not referenced in New-IPT or Resume-BIOS/Floppy selected, but
    92    ;  actual media is disabled...so dig for requested partition
    93   PFUPN_SelectionGone:
    94    mov     cl, CFG_Partitions
    95    or      cl, cl
    96    jz      PFUPN_NothingFound            ; No partitions available -> so fail
    97    or      bl, bl
    98    jz      PFUPN_BootableSearchLoop
    99    ; Search for Partition ID "BL"
    100   PFUPN_PartIDsearchLoop:
    101       call    PART_GetPartitionPointer   ; Gets SI for partition DL
    102       cmp     bptr ds:[si+LocIPT_SystemID], bl
    103       je      PFUPN_Found
    104       dec     cl
    105       jz      PFUPN_NothingFound
    106    inc     dl                            ; Increase
    107    cmp     CFG_Partitions, dl
    108    ja      PFUPN_PartIDsearchLoop
    109    xor     dl, dl
    110    jmp     PFUPN_PartIDsearchLoop
    111 
    112    ; Search for Partition ID "BL"
    113   PFUPN_BootableSearchLoop:
    114       call    PART_GetPartitionPointer   ; Gets SI for partition DL
    115       mov     al, ds:[si+LocIPT_Flags]
    116       and     al, Flags_Bootable
    117       jnz     PFUPN_Found
    118       dec     cl
    119       jz      PFUPN_NothingFound
    120    inc     dl                         ; Increase
    121    cmp     CFG_Partitions, dl
    122    ja      PFUPN_PartIDsearchLoop
    123    xor     dl, dl
    124    jmp     PFUPN_PartIDsearchLoop
    125 
    126   PFUPN_NothingFound:
    127    mov     dl, 080h                      ; Now being Disabled
    128   PFUPN_Found:
    129    ret
     70        cmp     dl, 080h
     71        je      PFUPN_SelectionDisabled
     72        ja      PFUPN_SpecialSelection
     73        call    PARTSCAN_GetXref              ; DL - PartitionNo prev IPT
     74        cmp     dh, 0FFh                      ; DH -> Partition No in new IPT
     75        je      PFUPN_SelectionGone
     76        mov     dl, dh
     77    PFUPN_SelectionDisabled:
     78        ret
     79
     80    PFUPN_SpecialSelection:
     81        cmp     dl, 0FEh                      ; Resume-BIOS?
     82        ja      PFUPN_SpecialSelectionFloppy
     83        cmp     byte ptr [CFG_ResumeBIOSbootSeq], 0
     84        je      PFUPN_SelectionGone
     85        jmp     PFUPN_Found
     86    PFUPN_SpecialSelectionFloppy:
     87        cmp     byte ptr [CFG_IncludeFloppy], 0
     88        je      PFUPN_SelectionGone
     89        jmp     PFUPN_Found
     90
     91    ; Partition is not referenced in New-IPT or Resume-BIOS/Floppy selected, but
     92    ;  actual media is disabled...so dig for requested partition
     93    PFUPN_SelectionGone:
     94        mov     cl, CFG_Partitions
     95        or      cl, cl
     96        jz      PFUPN_NothingFound            ; No partitions available -> so fail
     97        or      bl, bl
     98        jz      PFUPN_BootableSearchLoop
     99    ; Search for Partition ID "BL"
     100    PFUPN_PartIDsearchLoop:
     101        call    PART_GetPartitionPointer   ; Gets SI for partition DL
     102        cmp     bptr ds:[si+LocIPT_SystemID], bl
     103        je      PFUPN_Found
     104        dec     cl
     105        jz      PFUPN_NothingFound
     106        inc     dl                            ; Increase
     107        cmp     CFG_Partitions, dl
     108        ja      PFUPN_PartIDsearchLoop
     109        xor     dl, dl
     110        jmp     PFUPN_PartIDsearchLoop
     111
     112    ; Search for Partition ID "BL"
     113    PFUPN_BootableSearchLoop:
     114        call    PART_GetPartitionPointer   ; Gets SI for partition DL
     115        mov     al, ds:[si+LocIPT_Flags]
     116        and     al, Flags_Bootable
     117        jnz     PFUPN_Found
     118        dec     cl
     119        jz      PFUPN_NothingFound
     120
     121        inc     dl                         ; Increase
     122        cmp     CFG_Partitions, dl
     123        ja      PFUPN_PartIDsearchLoop
     124        xor     dl, dl
     125        jmp     PFUPN_PartIDsearchLoop
     126
     127    PFUPN_NothingFound:
     128        mov     dl, 080h                      ; Now being Disabled
     129    PFUPN_Found:
     130        ret
    130131PART_FixUpSelectionNumber       EndP
    131132
     
    135136;       Out: *none* (BootRecordCRD updated)
    136137PART_UpdateBootRecordCRC        Proc Near Uses bx
    137    mov     si, offset PartitionSector
    138    mov     bx, 4B4Dh            ; Magic: 'MK'
    139    call    MBR_GetCheckOfSector
    140    mov     [si+LocIPT_BootRecordCRC], bx
    141    ret
     138        mov     si, offset PartitionSector
     139        mov     bx, 4B4Dh            ; Magic: 'MK'
     140        call    MBR_GetCheckOfSector
     141        mov     [si+LocIPT_BootRecordCRC], bx
     142        ret
    142143PART_UpdateBootRecordCRC        EndP
     144
     145
     146;
     147; What happens here ?
     148;
     149
     150; Rousseau:
     151; ---------
     152; Bug:
     153; When ResumeBIOSbootSeq is zero, BX still gets decremented and shifted left.
     154; Then when used as an index into ContinueBIOSbootTable to get the address
     155; of the device-name, the index is two bytes too low, and SI get's loaded
     156; with whatever is before the ContinueBIOSbootTable.
     157; Then when SI is used to copy a null-terminated string, it depends on the
     158; bogus location SI points to where a null-byte will appear.
     159; Since I placed some text before the ContinueBIOSbootTable, the bogus pointer
     160; SI obtained pointed to an area where there was no null-byte in sight for
     161; more than 11 bytes, causing SI to overwrite the CD-ROM IPT entry with
     162; garbage. It took me a while to tackle this one because I was baffled why
     163; moving text around in STD_TEXT.ASM, where ContinueBIOSbootTable resides,
     164; mattered while the offset of ContinueBIOSbootTable did not change.
     165; This bug is also present in v1.06 but never surfaced because STD_TEXT.ASM
     166; is kinda static and luck has it that the word preceding ContinueBIOSbootTable
     167; presumably pointed to an area where a null byte was near.
     168;
     169; Fix:
     170; Test BX for zero and if so, skip the
     171
    143172
    144173; Copies the device-name to the Resume-BIOS IPT entry
    145174PART_UpdateResumeBIOSName       Proc Near Uses ax bx cx si di
    146    ;movzx   bx, CFG_ResumeBIOSbootSeq
    147    mov   bl,CFG_ResumeBIOSbootSeq
    148    mov   bh,0
    149 
    150    dec     bx
    151    shl     bx, 1
    152    mov     si, wptr [ContinueBIOSbootTable+bx]
    153    mov     di, offset BIOScontIPTentry+LocIPT_Name
    154    push    di
    155       mov     cx, 11
    156       mov     al, ' '
    157       rep     stosb
    158    pop     di
    159   PURBN_BootDeviceCopyLoop:
    160       lodsb
    161       or      al, al
    162       jz      PURBN_NoResumeBootSeq
    163       stosb
    164       jmp     PURBN_BootDeviceCopyLoop
    165   PURBN_NoResumeBootSeq:
    166    ret
     175
     176        ; Get BIOS resume indicator.
     177        ;movzx   bx, CFG_ResumeBIOSbootSeq
     178        mov     bl,CFG_ResumeBIOSbootSeq
     179        mov     bh,0
     180
     181        ; Clear name of IPT-entry.
     182        mov     di, offset BIOScontIPTentry+LocIPT_Name
     183        push    di
     184            mov     cx, 11
     185            mov     al, ' '
     186            rep     stosb
     187        pop     di
     188
     189        ; If no resume then exit.
     190        test    bx,bx
     191        jz      PURBN_NoResumeBootSeq
     192
     193        ; Convert to index in name-table.
     194        dec     bx
     195        shl     bx, 1
     196
     197        ; Put the pointer to the name in SI.
     198        mov     si, word ptr [ContinueBIOSbootTable+bx]
     199
     200        ; Copy the name to the IPT-entry.
     201    PURBN_BootDeviceCopyLoop:
     202        lodsb
     203         or     al, al
     204        jz      PURBN_NoResumeBootSeq
     205        stosb
     206        jmp     PURBN_BootDeviceCopyLoop
     207
     208        ; We're done.
     209    PURBN_NoResumeBootSeq:
     210
     211        ret
    167212PART_UpdateResumeBIOSName       EndP
     213
     214
    168215
    169216; ============================================================================
     
    173220; Builds Pointer-Table straight (without filtering, w/o Floppy/CD-ROM/Kernels)
    174221PART_CalculateStraightPartPointers Proc Near
    175    mov     ax, offset PartitionTable
    176    mov     bx, offset PartitionPointers
    177    mov     cx, LocIPT_MaxPartitions
    178   PCSPP_Loop:
    179       mov     ds:[bx], ax
    180       add     bx, 2
    181       add     ax, LocIPT_LenOfIPT
    182    dec     cx
    183    jnz     PCSPP_Loop
    184    mov     al, ds:[CFG_Partitions]
    185    mov     ds:[PartitionPointerCount], al
    186    ret
     222        mov     ax, offset PartitionTable
     223        mov     bx, offset PartitionPointers
     224        mov     cx, LocIPT_MaxPartitions
     225
     226    PCSPP_Loop:
     227        mov     ds:[bx], ax                     ; Move address IPT entry to PPT
     228        add     bx, 2                           ; Advance pointer to PPT entry
     229        add     ax, LocIPT_LenOfIPT             ; Advance pointer to IPT entry
     230        dec     cx                              ; Decrement counter
     231        jnz     PCSPP_Loop                      ; Next iteration
     232
     233        mov     al, ds:[CFG_Partitions]         ; Get number of partitions
     234        mov     ds:[PartitionPointerCount], al  ; Update number for PPT
     235        ret
    187236PART_CalculateStraightPartPointers EndP
    188237
     
    190239; [this means filtering and including Floppy/CD-ROM/Kernels, if wanted]
    191240PART_CalculateMenuPartPointers Proc Near Uses si
    192    mov     si, offset PartitionTable
    193    mov     bx, offset PartitionPointers
    194    test    byte ptr [CFG_IncludeFloppy], 1
    195    jz      PCMPP_NoFloppyInclude
    196    mov     ax, offset FloppyIPTentry
    197    mov     ds:[bx], ax
    198    add     bx, 2
    199   PCMPP_NoFloppyInclude:
    200 
    201    test    byte ptr [CFG_ResumeBIOSbootSeq], 0FFh
    202    jz      PCMPP_NoResumeBootSeqInclude
    203    mov     ax, offset BIOScontIPTentry
    204    mov     ds:[bx], ax
    205    add     bx, 2
    206   PCMPP_NoResumeBootSeqInclude:
     241
     242;!
     243;! DEBUG_PROBE
     244;!
     245IFDEF   AUX_DEBUGx
     246    push    1241h
     247    call    DEBUG_Probe
     248ENDIF
     249
     250        mov     si, offset PartitionTable
     251        mov     bx, offset PartitionPointers
     252        test    byte ptr [CFG_IncludeFloppy], 1
     253        jz      PCMPP_NoFloppyInclude
     254        mov     ax, offset FloppyIPTentry
     255        mov     ds:[bx], ax
     256        add     bx, 2
     257    PCMPP_NoFloppyInclude:
     258
     259        test    byte ptr [CFG_ResumeBIOSbootSeq], 0FFh
     260        jz      PCMPP_NoResumeBootSeqInclude
     261        mov     ax, offset BIOScontIPTentry
     262        mov     ds:[bx], ax
     263        add     bx, 2
     264    PCMPP_NoResumeBootSeqInclude:
    207265
    208266; [Linux support removed since v1.02]
     
    220278;  PCMPP_NoLinuxKernels:
    221279
    222    ;movzx   cx, CFG_Partitions ; LocIPT_MaxPartitions
    223    mov   cl,CFG_Partitions ; LocIPT_MaxPartitions
    224    mov   ch,0
    225 
    226    or      cx, cx
    227    jz      PCMPP_NoPartitions
    228   PCMPP_Loop:
    229       mov     al, ds:[si+LocIPT_Flags]
    230       and     al, Flags_Bootable
    231       jz      PCMPP_IsNotBootable
    232       mov     ds:[bx], si
    233       add     bx, 2
    234      PCMPP_IsNotBootable:
    235       add     si, LocIPT_LenOfIPT
    236    dec     cx
    237    jnz     PCMPP_Loop
    238   PCMPP_NoPartitions:
    239    sub     bx, offset PartitionPointers
    240    shr     bx, 1
    241    mov     ds:[PartitionPointerCount], bl
    242    ret
     280        ;movzx   cx, CFG_Partitions ; LocIPT_MaxPartitions
     281        mov   cl,CFG_Partitions ; LocIPT_MaxPartitions
     282        mov   ch,0
     283
     284        or      cx, cx
     285        jz      PCMPP_NoPartitions
     286    PCMPP_Loop:
     287        mov     al, ds:[si+LocIPT_Flags]
     288        and     al, Flags_Bootable
     289        jz      PCMPP_IsNotBootable
     290        mov     ds:[bx], si
     291        add     bx, 2
     292    PCMPP_IsNotBootable:
     293        add     si, LocIPT_LenOfIPT
     294        dec     cx
     295        jnz     PCMPP_Loop
     296    PCMPP_NoPartitions:
     297        sub     bx, offset PartitionPointers
     298        shr     bx, 1
     299        mov     ds:[PartitionPointerCount], bl
     300        ret
    243301PART_CalculateMenuPartPointers EndP
    244302
     
    247305;       Out: SI - Pointer to it
    248306PART_GetPartitionPointer        Proc Near   Uses bx
    249    cmp     dl, 0FEh
    250    je      PGPP_IsBIOSbootSeq            ; FEh -> Resume BIOS boot Sequence
    251    ja      PGPP_IsFloppy                 ; FFh -> Floppy
    252    ;movzx   bx, dl
    253    mov   bl,dl
    254    mov   bh,0
    255 
    256    shl     bx, 1
    257    mov     si, wptr [PartitionPointers+bx]
    258    ret
    259   PGPP_IsBIOSbootSeq:
    260    mov     si, offset BIOScontIPTentry
    261    ret
    262   PGPP_IsFloppy:
    263    mov     si, offset FloppyIPTentry     ; PartitionTable-LocIPT_LenOfIPT
    264    ret
     307        cmp     dl, 0FEh
     308        je      PGPP_IsBIOSbootSeq            ; FEh -> Resume BIOS boot Sequence
     309        ja      PGPP_IsFloppy                 ; FFh -> Floppy
     310        ;movzx   bx, dl
     311        mov   bl,dl
     312        mov   bh,0
     313
     314        shl     bx, 1
     315        mov     si, word ptr [PartitionPointers+bx]
     316        ret
     317
     318    PGPP_IsBIOSbootSeq:
     319;!
     320;! DEBUG_PROBE
     321;!
     322IFDEF   AUX_DEBUGx
     323    push    1242h
     324    call    DEBUG_Probe
     325ENDIF
     326
     327        mov     si, offset BIOScontIPTentry
     328        ret
     329
     330    PGPP_IsFloppy:
     331        mov     si, offset FloppyIPTentry     ; PartitionTable-LocIPT_LenOfIPT
     332        ret
    265333PART_GetPartitionPointer        EndP
    266334
     
    269337;       Out: DL - Number of partition
    270338PART_GetPartitionNumber         Proc Near   Uses bx
    271    mov     dl, ds:[PartitionPointerCount]
    272    mov     bx, offset PartitionPointers
    273   PGPN_SearchLoop:
    274       cmp     wptr ds:[bx], si
    275       je      PGPN_Found
    276       add     bx, 2
    277    dec     dl
    278    jnz     PGPN_SearchLoop
    279    mov     dl, 0FFh
    280    ret
    281   PGPN_Found:
    282    sub     dl, ds:[PartitionPointerCount]
    283    dec     dl
    284    not     dl
    285    ret
     339        mov     dl, ds:[PartitionPointerCount]
     340        mov     bx, offset PartitionPointers
     341    PGPN_SearchLoop:
     342        cmp     word ptr ds:[bx], si
     343        je      PGPN_Found
     344        add     bx, 2
     345        dec     dl
     346        jnz     PGPN_SearchLoop
     347        mov     dl, 0FFh
     348        ret
     349
     350    PGPN_Found:
     351        sub     dl, ds:[PartitionPointerCount]
     352        dec     dl
     353        not     dl
     354        ret
    286355PART_GetPartitionNumber         EndP
    287356
     357
     358;
    288359; Following functions are only usable, when Partition-Pointer-View is filtered
     360;
     361
    289362; They will convert from and to unfiltered view (used in Boot-Menu)
    290363;        In: DL - Number of partition in filtered view
    291364;       Out: DL - Number of partition in straight view
     365;
     366; This gets the address of the IPT-entry from the Partition Pointer Table and
     367; converts that to an index into the IPT; the straight view.
     368;
    292369PART_ConvertToStraight          Proc Near
    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
    299    cmp     ax, offset FloppyIPTentry
    300    jb      PCTS_IsBIOSbootSeq
    301    je      PCTS_IsFloppy
     370        ;movzx   bx, dl
     371        mov   bl,dl                                 ; Partition number to BX
     372        mov   bh,0
     373
     374        shl     bx, 1                               ; Convert to word index
     375        mov     ax, word ptr cs:[PartitionPointers+bx]  ; Get the partition pointer
     376        cmp     ax, offset FloppyIPTentry           ; Check for Floppy
     377        jb      PCTS_IsBIOSbootSeq                  ; Nope, is BIOS-bootseq
     378        je      PCTS_IsFloppy                       ; Is Floppy
     379
    302380; [Linux support removed since v1.02]
    303381;   cmp     ax, offset LINUX_KernelEntries
    304382;   jae     PCTS_IsKernelEntry
    305    sub     ax, offset PartitionTable
    306    mov     bl, LocIPT_LenOfIPT
    307    div     bl                      ; Divide with IPTlength
    308    mov     dl, al
    309    ret
     383
     384        ;
     385        ; Is partition, AX contains pointer to IPT entry
     386        ;
     387        sub     ax, offset PartitionTable       ; Make relative
     388        mov     bl, LocIPT_LenOfIPT             ; Length of IPT entry
     389        div     bl                              ; Divide with IPTlength
     390        mov     dl, al                          ; Index in IPT
     391        ret
     392
    310393; [Linux support removed since v1.02]
    311394;  PCTS_IsKernelEntry:
    312395;   mov     dl, 0FDh
    313396;   ret
    314   PCTS_IsBIOSbootSeq:
    315    mov     dl, 0FEh
    316    ret
    317   PCTS_IsFloppy:
    318    mov     dl, 0FFh
    319    ret
     397
     398    PCTS_IsBIOSbootSeq:
     399        mov     dl, 0FEh
     400        ret
     401    PCTS_IsFloppy:
     402        mov     dl, 0FFh
     403        ret
    320404PART_ConvertToStraight          EndP
     405
     406
    321407
    322408;        In: DL - Number of partition in straight view
    323409;       Out: DL - Number of partition in filtered view
     410;
     411; This searches for the absolute offset of an IPT-entry in the
     412; PartitionPointers table.
     413; This table holds the offsets of IPT partition entries that are in the Menu ?
     414; If the offset/entry is found it's index, the filtered number, is returned.
     415;
    324416PART_ConvertFromStraight        Proc Near    Uses es di
    325    cmp     dl, 0FEh
    326    jb      PCFS_IsPartition
    327    mov     ax, offset BIOScontIPTentry
    328    je      PCFS_DoSearch
    329    mov     ax, offset FloppyIPTentry
    330    jmp     PCFS_DoSearch
    331   PCFS_IsPartition:
    332    ; First we get Partition-Offset in AX
    333    ;movzx   ax, dl
    334    mov   al,dl
    335    mov   ah,0
    336 
    337    mov     bl, LocIPT_LenOfIPT
    338    mul     bl
    339    add     ax, offset PartitionTable
    340   PCFS_DoSearch:
    341    ; Now search for this offset in our filtered Partition-Pointer-Table
    342    push    cs
    343    pop     es
    344    mov     di, offset PartitionPointers
    345    mov     cx, LocIPT_MaxPartitions
    346    xor     dl, dl                        ; Reply on Not-Found = Partition==0
    347    repne   scasw  ; Compare-Loop
    348    jne     PCFS_NotFound
    349    sub     di, 2                         ; One Back, so point to compared value
    350    mov     dx, di
    351    sub     dx, offset PartitionPointers
    352    shr     dx, 1
    353    ; Adjust for IncludeFloppy/etc. is automatically done, due Pointer-LookUp
    354   PCFS_NotFound:
    355    ret
     417;!
     418;! DEBUG_PROBE
     419;!
     420IFDEF   AUX_DEBUGx
     421    push    1243h
     422    call    DEBUG_Probe
     423ENDIF
     424
     425        cmp     dl, 0FEh
     426        jb      PCFS_IsPartition
     427        mov     ax, offset BIOScontIPTentry
     428        je      PCFS_DoSearch
     429        mov     ax, offset FloppyIPTentry
     430        jmp     PCFS_DoSearch
     431
     432
     433    PCFS_IsPartition:
     434        ; First we get Partition-Offset in AX
     435        ;movzx   ax, dl
     436        mov   al,dl                         ; Index in IPT to AX
     437        mov   ah,0
     438        mov     bl, LocIPT_LenOfIPT         ; Length of an IPT entry
     439        mul     bl                          ; Mul to get relative offset
     440        add     ax, offset PartitionTable   ; Add to get absolute offset
     441
     442        ;
     443        ; AX now points to the IPT entry of the partition.
     444        ; This address is searched for in the Partition Pointer Table.
     445        ;
     446
     447    PCFS_DoSearch:
     448        ; Now search for this offset in our filtered Partition-Pointer-Table
     449        push    cs
     450        pop     es
     451        mov     di, offset PartitionPointers    ; Point to table
     452        mov     cx, LocIPT_MaxPartitions        ; Max number of entries to search
     453        xor     dl, dl                          ; Reply on Not-Found = Partition==0
     454        repne   scasw                           ; Compare-Loop
     455        jne     PCFS_NotFound
     456        sub     di, 2                           ; One Back, so point to compared value
     457        mov     dx, di                          ; Offset in DX
     458        sub     dx, offset PartitionPointers    ; Make relative
     459        shr     dx, 1                           ; Convert to Index
     460    ; Adjust for IncludeFloppy/etc. is automatically done, due Pointer-LookUp
     461    PCFS_NotFound:
     462        ret
    356463PART_ConvertFromStraight        EndP
     464
     465
    357466
    358467;        In: AX - Pointer to IPT Entry
     
    363472;   cmp     ax, offset LINUX_KernelEntries
    364473;   jae     PGSEP_IsKernelEntry
    365    mov     si, offset PartitionSizeTable
    366    sub     ax, offset PartitionTable
     474        mov     si, offset PartitionSizeTable
     475        sub     ax, offset PartitionTable
    367476;   jmp     PGSEP_Continue
    368477; [Linux support removed since v1.02]
     
    371480;   sub     ax, offset LINUX_KernelEntries
    372481;  PGSEP_Continue:
    373    mov     bl, LocIPT_LenOfIPT
    374    div     bl                            ; Divide with IPTlength
    375    ;movzx   bx, al
    376    mov   bl,al
    377    mov   bh,0
    378 
    379    shl     ax, 1
    380    shl     bx, 2
    381    add     ax, bx                        ; My way of multiplying with 6
    382    add     si, ax                        ; SI - Partition Size-Element
    383    ret
     482        mov     bl, LocIPT_LenOfIPT
     483        div     bl                            ; Divide with IPTlength
     484        ;movzx   bx, al
     485        mov   bl,al
     486        mov   bh,0
     487
     488        shl     ax, 1
     489        shl     bx, 2
     490        add     ax, bx                        ; My way of multiplying with 6
     491        add     si, ax                        ; SI - Partition Size-Element
     492        ret
    384493PART_GetSizeElementPointer      EndP
    385494
     
    389498; Destroyed: AX, BX, DI
    390499PART_FillOutSizeElement         Proc Near   Uses cx dx
    391    add     di, 3                         ; ES:DI - Last Digit of Size Digits
    392    shr     bx, 1
    393    rcr     ax, 1                         ; /2 -> Sector Size is now KByte Size
    394    xor     cl, cl                        ; 0 - KByte, 1 - MByte, 2 - GByte
    395   PFOSE_MakeSmallerLoop:
    396       or      bx, bx
    397       jnz     PFOSE_MakeSmaller
    398       cmp     ax, 9999
    399       jbe     PFOSE_IsSmallEnough
    400      PFOSE_MakeSmaller:
    401       mov     dx, bx
    402       and     dx, 1023                   ; My crazy way of dividing a 32-bit
    403       shr     ax, 10                     ; value through 1024 using 16-bit
    404       shr     bx, 10                     ; instructions...
    405       shl     dx, 6
    406       or      ax, dx
    407       inc     cl                         ; Value got smaller...
    408       jmp     PFOSE_MakeSmallerLoop
    409 
    410   PFOSE_IsSmallEnough:
    411    ; First write the type of this Size-Element (KB/MB/GB)
    412    mov     bx, 'BK'
    413    cmp     cl, 1
    414    jb      PFOSE_WriteType
    415    je      PFOSE_IsMBtype
    416    mov     bx, 'BG'
    417    jmp     PFOSE_WriteType
    418   PFOSE_IsMBtype:
    419    mov     bx, 'BM'
    420   PFOSE_WriteType:
    421    mov     wptr es:[di+1], bx
    422    mov     bx, 10                        ; Digits are 10-Based
    423    xor     dx, dx
    424   PFOSE_DigitLoop:
    425       xor     dx, dx
    426       div     bx                         ; AX - Digit, DX - Remainder
    427       add     dl, '0'                    ; Convert digit to ASCII digit
    428       mov     es:[di], dl
    429       or      ax, ax
    430       jz      PFOSE_EndOfDigitLoop
    431       dec     di                         ; Go to previous char
    432       jmp     PFOSE_DigitLoop
    433 
    434   PFOSE_EndOfDigitLoop:
    435    ret
     500        add     di, 3                         ; ES:DI - Last Digit of Size Digits
     501        shr     bx, 1
     502        rcr     ax, 1                         ; /2 -> Sector Size is now KByte Size
     503        xor     cl, cl                        ; 0 - KByte, 1 - MByte, 2 - GByte
     504    PFOSE_MakeSmallerLoop:
     505        or      bx, bx
     506        jnz     PFOSE_MakeSmaller
     507        cmp     ax, 9999
     508        jbe     PFOSE_IsSmallEnough
     509    PFOSE_MakeSmaller:
     510        mov     dx, bx
     511        and     dx, 1023                   ; My crazy way of dividing a 32-bit
     512        shr     ax, 10                     ; value through 1024 using 16-bit
     513        shr     bx, 10                     ; instructions...
     514        shl     dx, 6
     515        or      ax, dx
     516        inc     cl                         ; Value got smaller...
     517        jmp     PFOSE_MakeSmallerLoop
     518
     519    PFOSE_IsSmallEnough:
     520        ; First write the type of this Size-Element (KB/MB/GB)
     521        mov     bx, 'BK'
     522        cmp     cl, 1
     523        jb      PFOSE_WriteType
     524        je      PFOSE_IsMBtype
     525        mov     bx, 'BG'
     526        jmp     PFOSE_WriteType
     527    PFOSE_IsMBtype:
     528        mov     bx, 'BM'
     529    PFOSE_WriteType:
     530        mov     word ptr es:[di+1], bx
     531        mov     bx, 10                        ; Digits are 10-Based
     532        xor     dx, dx
     533    PFOSE_DigitLoop:
     534        xor     dx, dx
     535        div     bx                         ; AX - Digit, DX - Remainder
     536        add     dl, '0'                    ; Convert digit to ASCII digit
     537        mov     es:[di], dl
     538        or      ax, ax
     539        jz      PFOSE_EndOfDigitLoop
     540        dec     di                         ; Go to previous char
     541        jmp     PFOSE_DigitLoop
     542
     543    PFOSE_EndOfDigitLoop:
     544        ret
    436545PART_FillOutSizeElement         EndP
    437546
     
    450559; Destroyed: None
    451560PART_HidePartition              Proc Near   Uses ax bx cx dx si di
    452    call    PART_GetPartitionPointer      ; Pointer to partition (DL) -> SI
    453 
    454    ; First load the partition table of that partition...
    455    mov     ax, wptr [si+LocIPT_AbsolutePartTable+0]
    456    mov     bx, wptr [si+LocIPT_AbsolutePartTable+2]
    457    mov     cx, wptr [si+LocIPT_LocationPartTable+1]
    458    mov     dh, bptr [si+LocIPT_LocationPartTable+0]
    459    mov     dl, [si+LocIPT_Drive]
    460    call    DriveIO_LoadPartition
    461    ; Partition-Table now LOADED
    462    mov     di, offset PartitionSector+446 ; ES:DI - 1st partitionentry...
    463 
    464    ; Put our partition's location into registers...
    465    mov     ax, wptr [si+LocIPT_AbsoluteBegin+0]
    466    mov     bx, wptr [si+LocIPT_AbsoluteBegin+2]
    467    sub     ax, wptr [si+LocIPT_AbsolutePartTable+0]
    468    sbb     bx, wptr [si+LocIPT_AbsolutePartTable+2]
    469    ; BX:AX - absolute position of partition relative to partition table
    470    ; ...and search for it...
    471   PHP_SearchLoop:
    472       cmp     ax, wptr es:[di+LocBRPT_RelativeBegin]
    473       jne     PHP_SearchMismatch
    474       cmp     bx, wptr es:[di+LocBRPT_RelativeBegin+2]
    475       jne     PHP_SearchMismatch
    476       jmp     PHP_SearchMatch
    477      PHP_SearchMismatch:
    478       add     di, LocBRPT_LenOfEntry     ; 16 Bytes per partition entry
    479    cmp     di, 500+offset PartitionSector
    480    jb      PHP_SearchLoop
    481    jmp     MBR_HaltSystem                ; not found, something is wrong here
    482 
    483    ; Found entry...
    484   PHP_SearchMatch:
    485    mov     al, bptr es:[di+LocBRPT_SystemID] ; Partition-ID into AL
    486    call    PART_SearchFileSysHiddenID    ; Put on =STEALTH=
    487    mov     bptr es:[di+LocBRPT_SystemID], al
    488    IFDEF ReleaseCode
    489       call    DriveIO_SavePartition      ; Saves Partition-Table
    490    ENDIF
    491    ret
     561        call    PART_GetPartitionPointer      ; Pointer to partition (DL) -> SI
     562
     563        ; First load the partition table of that partition...
     564        mov     ax, wptr [si+LocIPT_AbsolutePartTable+0]
     565        mov     bx, wptr [si+LocIPT_AbsolutePartTable+2]
     566        mov     cx, wptr [si+LocIPT_LocationPartTable+1]
     567        mov     dh, bptr [si+LocIPT_LocationPartTable+0]
     568        mov     dl, [si+LocIPT_Drive]
     569        call    DriveIO_LoadPartition
     570        ; Partition-Table now LOADED
     571        mov     di, offset PartitionSector+446 ; ES:DI - 1st partitionentry...
     572
     573        ; Put our partition's location into registers...
     574        mov     ax, wptr [si+LocIPT_AbsoluteBegin+0]
     575        mov     bx, wptr [si+LocIPT_AbsoluteBegin+2]
     576        sub     ax, wptr [si+LocIPT_AbsolutePartTable+0]
     577        sbb     bx, wptr [si+LocIPT_AbsolutePartTable+2]
     578        ; BX:AX - absolute position of partition relative to partition table
     579        ; ...and search for it...
     580    PHP_SearchLoop:
     581        cmp     ax, wptr es:[di+LocBRPT_RelativeBegin]
     582        jne     PHP_SearchMismatch
     583        cmp     bx, wptr es:[di+LocBRPT_RelativeBegin+2]
     584        jne     PHP_SearchMismatch
     585        jmp     PHP_SearchMatch
     586    PHP_SearchMismatch:
     587        add     di, LocBRPT_LenOfEntry     ; 16 Bytes per partition entry
     588        cmp     di, 500+offset PartitionSector
     589        jb      PHP_SearchLoop
     590        jmp     MBR_HaltSystem                ; not found, something is wrong here
     591
     592    ; Found entry...
     593    PHP_SearchMatch:
     594        mov     al, bptr es:[di+LocBRPT_SystemID] ; Partition-ID into AL
     595        call    PART_SearchFileSysHiddenID    ; Put on =STEALTH=
     596        mov     bptr es:[di+LocBRPT_SystemID], al
     597    IFDEF ReleaseCode
     598        call    DriveIO_SavePartition      ; Saves Partition-Table
     599    ENDIF
     600        ret
    492601PART_HidePartition              EndP
     602
     603
     604
     605
    493606
    494607; This here is for marking the first "good" non-hidden partition as being
     
    499612;  do anything else.
    500613PART_MarkFirstGoodPrimary       Proc Near   Uses ax si di
    501    mov     di, offset PartitionSector+446 ; DS:SI - 1st partitionentry
    502    ; First action to do: Remove the active flag from every partition
    503    push    di
    504       mov     cl, 4
    505      PMPP_RemoveActiveFlagLoop:
    506          and     bptr es:[di+LocBRPT_Flags], 7Fh
    507          add     di, LocBRPT_LenOfEntry
    508       dec     cl
    509       jnz     PMPP_RemoveActiveFlagLoop
    510    pop     di
    511    ; First Search, will hit on any PartitionID that is:
    512    ; a) not 0
    513    ; b) not hidden
    514    ; c) not extended partition (05h or 0Fh)
    515   PMPP_Search1Loop:
    516       mov     al, bptr es:[di+LocBRPT_SystemID]
    517       or      al, al
    518       jz      PMPP_Search1NoHit
    519       cmp     al, 05h
    520       je      PMPP_Search1NoHit
    521       cmp     al, 0Fh
    522       je      PMPP_Search1NoHit
    523       mov     bl, al                     ; BL == AL == PartitionID
    524       push    si
    525          call    PART_SearchFileSysName
    526       pop     si                         ; AL == UnhiddenPartitionID
    527       cmp     al, bl                     ; if ID is unhidden...
    528       je      PMPP_SearchHit
    529      PMPP_Search1NoHit:
    530       add     di, LocBRPT_LenOfEntry     ; 16 Bytes per Partition-Entry
    531    cmp     di, 500+offset PartitionSector
    532    jb      PMPP_Search1Loop
    533 
    534    mov     di, offset PartitionSector+446 ; DS:SI - 1st Partition-Entry
    535    ; Second Search, hit on anything that is not an extended partition
    536    ;  (05 or 0Fh)
    537   PMPP_Search2Loop:
    538       mov     al, bptr es:[di+LocBRPT_SystemID]
    539       or      al, al
    540       jz      PMPP_Search2NoHit
    541       cmp     al, 05h
    542       je      PMPP_Search2NoHit
    543       cmp     al, 0Fh
    544       jne     PMPP_SearchHit
    545      PMPP_Search2NoHit:
    546       add     di, LocBRPT_LenOfEntry     ; 16 Bytes per Partition-Entry
    547    cmp     di, 500+offset PartitionSector
    548    jb      PMPP_Search2Loop
    549    jmp     PMPP_SearchFailed
    550 
    551   PMPP_SearchHit:
    552    or      bptr es:[di], 80h             ; SET ACTIVE PARTITION
    553   PMPP_SearchFailed:
    554    ret
     614    mov     di, offset PartitionSector+446 ; DS:SI - 1st partitionentry
     615    ; First action to do: Remove the active flag from every partition
     616    push    di
     617        mov     cl, 4
     618    PMPP_RemoveActiveFlagLoop:
     619        and     bptr es:[di+LocBRPT_Flags], 7Fh
     620        add     di, LocBRPT_LenOfEntry
     621        dec     cl
     622        jnz     PMPP_RemoveActiveFlagLoop
     623    pop     di
     624    ; First Search, will hit on any PartitionID that is:
     625    ; a) not 0
     626    ; b) not hidden
     627    ; c) not extended partition (05h or 0Fh)
     628    PMPP_Search1Loop:
     629        mov     al, bptr es:[di+LocBRPT_SystemID]
     630        or      al, al
     631        jz      PMPP_Search1NoHit
     632        cmp     al, 05h
     633        je      PMPP_Search1NoHit
     634        cmp     al, 0Fh
     635        je      PMPP_Search1NoHit
     636        mov     bl, al                     ; BL == AL == PartitionID
     637        push    si
     638        call    PART_SearchFileSysName
     639        pop     si                         ; AL == UnhiddenPartitionID
     640        cmp     al, bl                     ; if ID is unhidden...
     641        je      PMPP_SearchHit
     642        PMPP_Search1NoHit:
     643        add     di, LocBRPT_LenOfEntry     ; 16 Bytes per Partition-Entry
     644        cmp     di, 500+offset PartitionSector
     645        jb      PMPP_Search1Loop
     646
     647        mov     di, offset PartitionSector+446 ; DS:SI - 1st Partition-Entry
     648    ; Second Search, hit on anything that is not an extended partition
     649    ;  (05 or 0Fh)
     650    PMPP_Search2Loop:
     651        mov     al, bptr es:[di+LocBRPT_SystemID]
     652        or      al, al
     653        jz      PMPP_Search2NoHit
     654        cmp     al, 05h
     655        je      PMPP_Search2NoHit
     656        cmp     al, 0Fh
     657        jne     PMPP_SearchHit
     658        PMPP_Search2NoHit:
     659        add     di, LocBRPT_LenOfEntry     ; 16 Bytes per Partition-Entry
     660        cmp     di, 500+offset PartitionSector
     661        jb      PMPP_Search2Loop
     662        jmp     PMPP_SearchFailed
     663
     664    PMPP_SearchHit:
     665        or      bptr es:[di], 80h             ; SET ACTIVE PARTITION
     666    PMPP_SearchFailed:
     667        ret
    555668PART_MarkFirstGoodPrimary       EndP
    556669
     
    561674; Destroyed: *none*
    562675PART_SearchFileSysName          Proc Near  Uses bx dx
    563    ;movzx   bx, al
    564    mov   bl,al
    565    mov   bh,0
    566 
    567    mov     si, offset FileSysIDs
    568   PSFSN_SearchLoop:
    569       lodsw                              ; AL - NormalID, AH-HiddenID
    570       mov     dl, ds:[si]                ; DL - File-System-Flags
    571       inc     si
    572       cmp     al, bl                     ; Check, if Unhidden-ID matches...
    573       je      PSFSN_Match
    574       cmp     ah, bl                     ; Check, if Hidden-ID matches...
    575       je      PSFSN_Match
    576       mov     al, bl                     ; So Unhidden-ID will be Original-ID
    577       cmp     ah, 0                      ; Unknown (last ID in table)
    578       je      PSFSN_Match
    579       inc     bh
    580       jmp     PSFSN_SearchLoop
    581 
    582   PSFSN_Match:
    583    ; AL is already Unhidden-ID
    584    mov     ah, dl
    585    ; AH is now the FileSystem-Flag
    586    ;movzx   bx, bh
    587    mov   bl,bh
    588    mov   bh,0
    589 
    590    shl     bx, 3   ; Offsets * 8
    591    mov     si, offset FileSysNames
    592    add     si, bx
    593    ret
     676        ;movzx   bx, al
     677        mov   bl,al
     678        mov   bh,0
     679
     680        mov     si, offset FileSysIDs
     681    PSFSN_SearchLoop:
     682        lodsw                              ; AL - NormalID, AH-HiddenID
     683        mov     dl, ds:[si]                ; DL - File-System-Flags
     684        inc     si
     685        cmp     al, bl                     ; Check, if Unhidden-ID matches...
     686        je      PSFSN_Match
     687        cmp     ah, bl                     ; Check, if Hidden-ID matches...
     688        je      PSFSN_Match
     689        mov     al, bl                     ; So Unhidden-ID will be Original-ID
     690        cmp     ah, 0                      ; Unknown (last ID in table)
     691        je      PSFSN_Match
     692        inc     bh
     693        jmp     PSFSN_SearchLoop
     694
     695    PSFSN_Match:
     696        ; AL is already Unhidden-ID
     697        mov     ah, dl
     698        ; AH is now the FileSystem-Flag
     699        ;movzx   bx, bh
     700        mov   bl,bh
     701        mov   bh,0
     702
     703        shl     bx, 3   ; Offsets * 8
     704        mov     si, offset FileSysNames
     705        add     si, bx
     706        ret
    594707PART_SearchFileSysName          EndP
    595708
     
    598711;       Out: AL - Hidden File-System-ID
    599712PART_SearchFileSysHiddenID      Proc Near  Uses bx
    600    ;movzx   bx, al
    601    mov   bl,al
    602    mov   bh,0
    603 
    604    mov     si, offset FileSysIDs
    605   PSFSHI_SearchLoop:
    606       lodsw                              ; AL - NormalID, AH-HiddenID
    607       inc     si
    608       cmp     al, bl                     ; Check, if Unhidden-ID matches...
    609       je      PSFSHI_Match
    610       cmp     ah, bl                     ; Check, if Hidden-ID matches...
    611       je      PSFSHI_Match
    612       mov     ah, bl                     ; So Unhidden-ID will get replied...
    613       cmp     ah, 0                      ; Unknown (last ID in table)
    614       je      PSFSHI_Match
    615       inc     bh
    616       jmp     PSFSHI_SearchLoop
    617 
    618   PSFSHI_Match:
    619    mov     al, ah                        ; AL = Hidden ID
    620    ret
     713        ;movzx   bx, al
     714        mov   bl,al
     715        mov   bh,0
     716
     717        mov     si, offset FileSysIDs
     718    PSFSHI_SearchLoop:
     719        lodsw                              ; AL - NormalID, AH-HiddenID
     720        inc     si
     721        cmp     al, bl                     ; Check, if Unhidden-ID matches...
     722        je      PSFSHI_Match
     723        cmp     ah, bl                     ; Check, if Hidden-ID matches...
     724        je      PSFSHI_Match
     725        mov     ah, bl                     ; So Unhidden-ID will get replied...
     726        cmp     ah, 0                      ; Unknown (last ID in table)
     727        je      PSFSHI_Match
     728        inc     bh
     729        jmp     PSFSHI_SearchLoop
     730
     731    PSFSHI_Match:
     732        mov     al, ah                        ; AL = Hidden ID
     733        ret
    621734PART_SearchFileSysHiddenID      EndP
    622735
     
    625738; Destroyed: None
    626739PART_CheckForValidPartName      Proc Near   Uses ax cx dx si
    627    ; Our logic is as follows:
    628    ;  If all chars are U -> Invalid (due reformated signature)
    629    ;  If anything below 32, but 0 -> Invalid (due invalid chars)
    630    ;  If anything above 165 -> Invalid (due invalid chars)
    631    ;  If anything between 123-128 -> Invalid (due invalid chars)
    632    ;  DX - holds count of 'U's
    633    push    cx
    634       or      cx, cx
    635       jz      PCFVPN_InvalidName
    636       xor     dx, dx
    637      PCFVPN_CheckLoop:
    638          lodsb
    639          cmp     al, 0
    640          je      PCFVPN_ValidChar
    641          cmp     al, 32
    642          jb      PCFVPN_InvalidName
    643          cmp     al, 165
    644          ja      PCFVPN_InvalidName
    645          cmp     al, 123
    646          jb      PCFVPN_ValidChar
    647          cmp     al, 128
    648          jbe     PCFVPN_InvalidName
    649         PCFVPN_ValidChar:
    650          cmp     al, 'U'
    651          jne     PCFVPN_NoMagic
    652          inc     dx
    653         PCFVPN_NoMagic:
    654       dec     cx
    655       jnz     PCFVPN_CheckLoop
    656    pop     cx
    657    cmp     cx, dx
    658    clc
    659    je      PCFVPN_WasMagic
    660    stc
    661   PCFVPN_WasMagic:
    662    ret
    663   PCFVPN_InvalidName:
    664    pop     cx
    665    clc
    666    ret
     740        ; Our logic is as follows:
     741        ;  If all chars are U -> Invalid (due reformated signature)
     742        ;  If anything below 32, but 0 -> Invalid (due invalid chars)
     743        ;  If anything above 165 -> Invalid (due invalid chars)
     744        ;  If anything between 123-128 -> Invalid (due invalid chars)
     745        ;  DX - holds count of 'U's
     746        push    cx
     747            or      cx, cx
     748            jz      PCFVPN_InvalidName
     749            xor     dx, dx
     750    PCFVPN_CheckLoop:
     751            lodsb
     752            cmp     al, 0
     753            je      PCFVPN_ValidChar
     754            cmp     al, 32
     755            jb      PCFVPN_InvalidName
     756            cmp     al, 165
     757            ja      PCFVPN_InvalidName
     758            cmp     al, 123
     759            jb      PCFVPN_ValidChar
     760            cmp     al, 128
     761            jbe     PCFVPN_InvalidName
     762    PCFVPN_ValidChar:
     763            cmp     al, 'U'
     764            jne     PCFVPN_NoMagic
     765            inc     dx
     766    PCFVPN_NoMagic:
     767          dec     cx
     768          jnz     PCFVPN_CheckLoop
     769        pop     cx
     770        cmp     cx, dx
     771        clc
     772        je      PCFVPN_WasMagic
     773        stc
     774    PCFVPN_WasMagic:
     775        ret
     776    PCFVPN_InvalidName:
     777        pop     cx
     778        clc
     779        ret
    667780PART_CheckForValidPartName      EndP
    668781
     
    673786; CY set if this entry is also the install-volume
    674787PART_IsInstallVolume            Proc Near   Uses ax cx dx si di
    675       cld                                    ; Advance upwards with lodsb
    676       mov   di, offset eCS_InstallVolume     ; Address of install-volume label (max. 11 chars)
    677 
    678       mov   cx, 11                           ; Maximum length of label
    679       xor   dl, dl                           ; Not found yet
     788        cld                                    ; Advance upwards with lodsb
     789        mov   di, offset eCS_InstallVolume     ; Address of install-volume label (max. 11 chars)
     790
     791        mov   cx, 11                           ; Maximum length of label
     792        xor   dl, dl                           ; Not found yet
    680793
    681794    ; Compare next character
    682795    PART_IsInstallVolumeNext:
    683       lodsb                                  ; Load byte from SI (IPT-entry)
    684       ;cmp      al,' '                        ; If space then use zero
    685       ;jne      PART_IsInstallVolume_skip1
    686       ;xor      al,al
    687    PART_IsInstallVolume_skip1:
    688       xchg     ah,al                         ; Save char to AH
    689       xchg     si,di                         ; Exchange pointers
    690       lodsb                                  ; Load byte from SI (install-volume label)
    691       ;cmp      al,' '                        ; If space then use zero
    692       ;jne      PART_IsInstallVolume_skip2
    693       ;xor      al,al
    694    PART_IsInstallVolume_skip2:
    695       xchg     si,di                         ; Reexchange pointers
    696 ;      call     AuxIO_Teletype
    697       call     CONV_ToUpper
    698 ;      call     AuxIO_Teletype
    699       xchg     al,ah
    700 ;      call     AuxIO_Teletype
    701       call     CONV_ToUpper
    702 ;      call     AuxIO_Teletype
    703 ;      call     AuxIO_TeletypeNL
    704 
    705       ; Are both of them zero ?
    706       ; Then the names could be the same, but cx must not equal 11
    707       ; because that would indicate a null-string.
    708       mov      dh,al
    709       or       dh,ah
    710       jz       PART_IsInstallVolumeFound
    711 
    712       cmp      ah,al                         ; Are the the same ?
    713       jnz      PART_IsInstallVolumeNotFound  ; Nope, compare ended
    714       loop     PART_IsInstallVolumeNext      ; Yep, Compare next character
    715 
    716    PART_IsInstallVolumeFound:
    717       ; If CX is still 11 this was a zero string
    718       ; and thus not a valid volume-name.
    719       ; This should not occur as this function is only called when the first
    720       ; byte is non-zero.
    721       cmp      cx,11
    722       je       PART_IsInstallVolumeNotFound
    723       ; Found !
    724       mov      dl,1                          ; Found
    725       jmp      PART_IsInstallVolumeEnd
    726 
    727 
    728    PART_IsInstallVolumeNotFound:
    729       mov      dl,0
    730       jmp      PART_IsInstallVolumeEnd
    731 
    732 
    733    PART_IsInstallVolumeEnd:
    734       ; Set the status in CY
    735       mov      al,dl
    736       add      al,'0'
    737 ;      call     AuxIO_TeletypeHexByte
    738 ;      call     AuxIO_TeletypeNL
    739       rcr      dl,1                          ; Put found-flag in CY
    740       ret
     796        lodsb                                  ; Load byte from SI (IPT-entry)
     797        ;cmp      al,' '                        ; If space then use zero
     798        ;jne      PART_IsInstallVolume_skip1
     799        ;xor      al,al
     800    PART_IsInstallVolume_skip1:
     801        xchg     ah,al                         ; Save char to AH
     802        xchg     si,di                         ; Exchange pointers
     803        lodsb                                  ; Load byte from SI (install-volume label)
     804        ;cmp      al,' '                        ; If space then use zero
     805        ;jne      PART_IsInstallVolume_skip2
     806        ;xor      al,al
     807    PART_IsInstallVolume_skip2:
     808        xchg     si,di                         ; Reexchange pointers
     809        ;~ call     AuxIO_Teletype
     810        call     CONV_ToUpper
     811        ;~ call     AuxIO_Teletype
     812        xchg     al,ah
     813        ;~ call     AuxIO_Teletype
     814        call     CONV_ToUpper
     815        ;~ call     AuxIO_Teletype
     816        ;~ call     AuxIO_TeletypeNL
     817
     818        ; Are both of them zero ?
     819        ; Then the names could be the same, but cx must not equal 11
     820        ; because that would indicate a null-string.
     821        mov      dh,al
     822        or       dh,ah
     823        jz       PART_IsInstallVolumeFound
     824
     825        cmp      ah,al                         ; Are the the same ?
     826        jnz      PART_IsInstallVolumeNotFound  ; Nope, compare ended
     827        loop     PART_IsInstallVolumeNext      ; Yep, Compare next character
     828
     829    PART_IsInstallVolumeFound:
     830        ; If CX is still 11 this was a zero string
     831        ; and thus not a valid volume-name.
     832        ; This should not occur as this function is only called when the first
     833        ; byte is non-zero.
     834        cmp      cx,11
     835        je       PART_IsInstallVolumeNotFound
     836        ; Found !
     837        mov      dl,1                          ; Found
     838        jmp      PART_IsInstallVolumeEnd
     839
     840
     841    PART_IsInstallVolumeNotFound:
     842        mov      dl,0
     843        jmp      PART_IsInstallVolumeEnd
     844
     845
     846    PART_IsInstallVolumeEnd:
     847        ; Set the status in CY
     848        mov      al,dl
     849        add      al,'0'
     850        ;~ call     AuxIO_TeletypeHexByte
     851        ;~ call     AuxIO_TeletypeNL
     852        rcr      dl,1                          ; Put found-flag in CY
     853        ret
    741854PART_IsInstallVolume            EndP
    742855
     
    749862PART_SetupPhase1    Proc    Uses bx cx dx si di
    750863
    751                 ;
    752                 ; Enumberate Bootable Systems by name
    753                 ; and prepare Phase 1 if active.
    754                 ;
    755                 ; This can also be implemented using the
    756                 ; Installable LVM-flag I think.
    757                 ; But at the time I had lesser knowledge about LVM...
    758                 ; So this algorithm may change in the future.
    759                 ;
    760                 mov     byte ptr [Phase1Active],0   ; Clear phase1 indicator
    761                 mov     si, offset PartitionTable   ; Pointer to IPT
    762                 xor     cx,cx
    763                 mov     cl,[CFG_Partitions]         ; Partitions in IPT
     864        ;
     865        ; Enumberate Bootable Systems by name
     866        ; and prepare Phase 1 if active.
     867        ;
     868        ; This can also be implemented using the
     869        ; Installable LVM-flag I think.
     870        ; But at the time I had lesser knowledge about LVM...
     871        ; So this algorithm may change in the future.
     872        ;
     873        mov     byte ptr [Phase1Active],0   ; Clear phase1 indicator
     874        mov     si, offset PartitionTable   ; Pointer to IPT
     875        xor     cx,cx
     876        mov     cl,[CFG_Partitions]         ; Partitions in IPT
    764877
    765878    ; Process next entry in IPT
    766879    MBR_Parts:
    767                 add     si, 4
    768                 ;push    si
    769                 ;push    si
    770                 ;call    MBR_TeletypeVolName
    771                 ;pop     si
    772                 call    PART_IsInstallVolume        ; Check if this is install-volume
    773                 jnc     MBR_Parts_NI
    774 
    775                 ;
    776                 ; Install Volume found
    777                 ;
    778                 mov     byte ptr [Phase1Active],1   ; Set phase1 indicator
    779 
    780                 mov     al,' '
    781                 mov     bl,7
    782                 mov     ah, 0eh
    783                 int     10h
    784 
    785                 mov     al,'('
    786                 mov     bl,7
    787                 mov     ah, 0eh
    788                 int     10h
    789 
    790 
    791 
    792                 mov     al,[CFG_Partitions]
    793                 sub     al,cl
    794 
    795                 mov     dh,al
    796 
    797 
    798                 mov     [CFG_PartAutomatic],al  ; Setup entry for install-volume
    799                 mov     [CFG_PartLast],al
    800 
    801                 add     al,'1'
    802                 mov     bl,7
    803                 mov     ah, 0eh
    804                 int     10h
    805 
    806                 mov     al,')'
    807                 mov     bl,7
    808                 mov     ah, 0eh
    809                 int     10h
    810 
    811                 ;mov     bx,cx       ; ????
    812 
    813                 mov     al,dh
    814                 stc
    815                 jmp     PART_SetupPhase1_found
     880        add     si, 4
     881        ;push    si
     882        ;push    si
     883        ;call    MBR_TeletypeVolName
     884        ;pop     si
     885        call    PART_IsInstallVolume        ; Check if this is install-volume
     886        jnc     MBR_Parts_NI
     887
     888        ;
     889        ; Install Volume found
     890        ;
     891        mov     byte ptr [Phase1Active],1   ; Set phase1 indicator
     892
     893        mov     al,' '
     894        mov     bl,7
     895        mov     ah, 0eh
     896        int     10h
     897
     898        mov     al,'('
     899        mov     bl,7
     900        mov     ah, 0eh
     901        int     10h
     902
     903
     904
     905        mov     al,[CFG_Partitions]
     906        sub     al,cl
     907
     908        mov     dh,al
     909
     910
     911        mov     [CFG_PartAutomatic],al  ; Setup entry for install-volume
     912        mov     [CFG_PartLast],al
     913
     914        add     al,'1'
     915        mov     bl,7
     916        mov     ah, 0eh
     917        int     10h
     918
     919        mov     al,')'
     920        mov     bl,7
     921        mov     ah, 0eh
     922        int     10h
     923
     924        ;mov     bx,cx       ; ????
     925
     926        mov     al,dh
     927        stc
     928        jmp     PART_SetupPhase1_found
    816929
    817930    MBR_Parts_NI:
    818                 ;xor     si,si
    819                 ;call    MBR_TeletypeNL
    820                 ;pop     si
    821                 add     si, 30      ; Add remainder of IPT entry
    822                 loop    MBR_Parts
    823 
    824                 mov     al,0ffh
    825                 clc
     931        ;xor     si,si
     932        ;call    MBR_TeletypeNL
     933        ;pop     si
     934        add     si, 30      ; Add remainder of IPT entry
     935        loop    MBR_Parts
     936
     937        mov     al,0ffh
     938        clc
    826939
    827940    PART_SetupPhase1_found:
    828941
    829                 ret
     942        ret
    830943
    831944PART_SetupPhase1    EndP
     
    836949;~ PART_GetOldPartitionCount   Proc    Uses    cx dx di
    837950                ;~ mov     di,offset [PartitionXref]
    838                 ;~ mov     dx,partition_count
     951                ;~ mov     dx,LocIPT_MaxPartitions
    839952                ;~ mov     cx,dx
    840953                ;~ mov     al,0ffh
     
    849962
    850963
     964
     965
     966;~ HELEMAAL NAKIJKEN !
     967;~ DRIVELETTER ASIGNMENT CORRIGEREN
     968;~ WORDT TOCH BOOTDRIVE IN BPB GEZET ALS NON eCS SYSTEEM BOOT ?
     969
     970
     971
    851972; ###################
    852973; # START PARTITION #
     
    857978;       Out: No Return...
    858979; Destroyed: None, due to no return ;-)
    859 ;     Logic: - Harddrive: loads partition Table
    860 ;                         sets partition active
    861 ;                         saves partition table
    862 ;                         hides partitions, if needed
    863 ;                         Linux-Support, if needed
    864 ;              load boot sector
    865 ;              VIBR checking, if wanted
    866 ;              install MBR Protection, if wanted
    867 ;              Special Boot Support, if needed (OS/2 Extended partitions)
    868 ;              Copy boot-sector to StartBase
    869 ;              run boot sector...
     980;     Logic: - Harddrive:   loads partition Table
     981;                           sets partition active
     982;                           saves partition table
     983;                           hides partitions, if needed
     984;                           Linux-Support, if needed
     985;               load boot sector
     986;               VIBR checking, if wanted
     987;               install MBR Protection, if wanted
     988;               Special Boot Support, if needed (OS/2 Extended partitions)
     989;               Copy boot-sector to StartBase
     990;               run boot sector...
    870991PART_StartPartition             Proc Near   Uses ax dx es di
    871    local BootPartNo:byte
    872    local PhysDiskBpbIndex:word    ; Index into BPB to field of phys-disk
    873    local FSType:byte                ; The FS used on the loaded BPB
     992    ;
     993    ; Local Storage for this much too large function.
     994    ;
     995    local BootPartNo:byte
     996    local PhysDiskBpbIndex:word     ; Index into BPB to field of phys-disk
     997    local FSType:byte               ; The FS used on the loaded BPB
    874998                                    ; Only used for FAT/HPFS/JFS
    875 
    876    ; Get Partition-Pointer (SI) to Partition-To-Boot (DL)
    877    call    PART_GetPartitionPointer
    878 
    879    call    PART_ConvertToStraight        ; ...we save straight view for later...
    880    mov     BootPartNo, dl
    881    ; Straight - FFh -> Floppy boot
    882    ;            FEh -> BIOS continue (CD-ROM, ZIP, etc.)
    883 
    884    ; We need straight pointers from now on, so calculate the table...
    885    call    PART_CalculateStraightPartPointers
    886 
    887    ; SI contains the pointer to the IPT to what partition to boot
    888    ;  in this whole routine...it may never get messed up.
    889 
    890    push    si
    891       mov     dl, [si+LocIPT_Drive]
    892       mov     dh, [si+LocIPT_SystemID]
    893       ; Copy Partition-Name to BootingNow area for display purposes
    894          add     si, LocIPT_Name
    895 
    896 
    897 ;pusha
    898 ;call    MBR_Teletype
    899 ;mov     si,offset TXT_BootingNowPartName
    900 ;call    MBR_Teletype
    901 ;popa
    902 
    903          mov     cx, 11
    904          call    GetLenOfName
    905          mov     di, offset TXT_BootingNowPartName
    906          jz      PSP_NoName
    907          rep     movsb                                                           ; Copy label-name to boot
    908         PSP_NoName:
    909          xor     al, al
    910          stosb              ; Ending Zero
    911       mov     si, offset TXT_BootingNow1                                         ; "Booting the system using "
    912       call    MBR_Teletype
     999    local LVMdl:byte                ; LVM drive-letter
     1000    local BPBdl:byte                ; BPB boot-drive-letter. (at 25h)
     1001
     1002
     1003    ; Get Partition-Pointer (SI) to Partition-To-Boot (DL).
     1004    ; DL is filtered partition number and thus uses the PPT.
     1005    ; Returned is the address of the IPT entry of the partition to boot.
     1006    call    PART_GetPartitionPointer
     1007
     1008
     1009    ;
     1010    ; SI now points to the IPT entry for the partition to be booted.
     1011    ;
     1012
     1013
     1014    ; This converts DL filered view to straight view, aka index into the IPT.
     1015    ; Needed for later.
     1016    ; Destroys AX,BX
     1017    call    PART_ConvertToStraight
     1018
     1019    ; Save for later use.
     1020    mov     [BootPartNo], dl
     1021    ; Straight - FFh -> Floppy boot
     1022    ;            FEh -> BIOS continue (CD-ROM, ZIP, etc.)
     1023
     1024    ; This converts the PPT to have pointers to all the IPT entries.
     1025    ; We need straight pointers from now on, so calculate the table...
     1026    ; Destroys AX,BX,CX
     1027    call    PART_CalculateStraightPartPointers
     1028
     1029
     1030
     1031    ; SI contains the pointer to the IPT to what partition to boot
     1032    ;  in this whole routine...it may never get messed up.
     1033
     1034    ; ------------------------------------------------- PRINT NAME BEING BOOTED
     1035
     1036    push    si
     1037        mov     dl, [si+LocIPT_Drive]       ; Disk where partition resides
     1038        mov     dh, [si+LocIPT_SystemID]    ; AB FileSystem ID (08=NTFS, FC=JFS)
     1039        ; Copy Partition-Name to BootingNow area for display purposes
     1040        add     si, LocIPT_Name             ; Advance to AB partition-name
     1041        mov     cx, 11                      ; Max. length of AB name/label
     1042        call    GetLenOfName                ; Returns CX with length of label
     1043        mov     di, offset TXT_BootingNowPartName
     1044        jz      PSP_NoName                  ; Don't copy if zero length label
     1045        rep     movsb                       ; Copy label-name to boot
     1046    PSP_NoName:
     1047        xor     al, al                      ; Null-terminate label-string
     1048        stosb              ; Ending Zero
     1049
     1050        ;
     1051        ; Display "Booting the system using "
     1052        ;
     1053        mov     si, offset TXT_BootingNow1
     1054        call    MBR_Teletype
     1055
     1056
    9131057; [Linux support removed since v1.02]
    9141058;      cmp     dh, 0FDh
    9151059;      je      PSP_IsKernel
    9161060
    917 ;pusha
    918 ;call    MBR_Teletype
    919 ;mov     si,offset TXT_BootingNowPartName
    920 ;call    MBR_Teletype
    921 ;popa
    922 
    923 
    924       or      dl, dl
    925       jnz     PSP_IsHarddisc
    926       ; When booting floppy/CD-ROM/etc., we got other text to be displayed...
    927       mov     si, offset TXT_BootingNowPartName
    928       call    MBR_TeletypeVolName
    929       jmp     PSP_IsFloppyCDROMetc
     1061        ;~ pusha
     1062        ;~ call    MBR_Teletype
     1063        ;~ mov     si,offset TXT_BootingNowPartName
     1064        ;~ call    MBR_Teletype
     1065        ;~ popa
     1066
     1067
     1068        ;
     1069        ; DL will be zero for floppy-disk or 80h+ for harddisk.
     1070        ; Note thus that DL contains the BIOS disk numer and not the AB value
     1071        ; for floppy or cdrom.
     1072        ;
     1073        or      dl, dl
     1074        jnz     PSP_IsHarddisc
     1075
     1076        ; When booting floppy/CD-ROM/etc., we got other text to be displayed...
     1077        mov     si, offset TXT_BootingNowPartName
     1078        call    MBR_TeletypeVolName
     1079        jmp     PSP_IsFloppyCDROMetc                                                ; JUMPS BUITEN SI POP !!! AANPASSEN
     1080
    9301081
    9311082; [Linux support removed since v1.02]
     
    9401091;      jmp     PSP_IsFloppyCDROMetc
    9411092
    942      PSP_IsHarddisc:
    943       IFDEF ReleaseCode
    944          ; Save configuration on HDD boots (save CFG_PartLast)
    945          call    DriveIO_SaveConfiguration                                       ; Rousseau: SAVE CONFIGURATION !
    946       ENDIF
    947       ;call    MBR_Teletype     ; Prints out BootingNow2 including PartitionName
    948       mov     si, offset TXT_BootingNowPartName
    949       call    MBR_TeletypeVolName
    950       mov     si, offset TXT_BootingNowPartition
    951       call    MBR_Teletype
    952    pop     si                            ; restores SI (IPT-pointer)
    953 
    954    mov     ax, wptr [si+LocIPT_AbsolutePartTable+0]
    955    mov     bx, wptr [si+LocIPT_AbsolutePartTable+2]
    956    mov     cx, wptr [si+LocIPT_LocationPartTable+1]
    957    mov     dh, bptr [si+LocIPT_LocationPartTable+0]
    958    mov     dl, [si+LocIPT_Drive]
    959 
    960 
    961 
    962    ; This loads the MBR in case of PRI or the EBR in case of LOG partitions.
    963    call    DriveIO_LoadPartition         ; Load Table...                [LOAD]
    964 
    965 
    966 
    967    ; --------------------------------------------------- MODIFY PARTITION TABLE
    968    push    cs
    969    pop     es
    970    mov     di, offset PartitionSector+446 ; ES:DI - First Partitionentry
    971 
    972    ; Remove all active-flags for safety reasons, primary partition table will
    973    ;  have one partition set active by ScanPartition-routine.
    974    push    di
    975       mov      cl, 4
    976      PSP_RemoveActiveFlagLoop:
    977          and      bptr es:[di+LocBRPT_Flags], 7Fh
    978          add      di, LocBRPT_LenOfEntry
    979       dec      cl
    980       jnz      PSP_RemoveActiveFlagLoop
    981    pop     di
    982 
    983    ; Put the partition-to-be-booted location into registers...
    984    mov     ax, wptr [si+LocIPT_AbsoluteBegin+0]
    985    mov     bx, wptr [si+LocIPT_AbsoluteBegin+2]
    986    sub     ax, wptr [si+LocIPT_AbsolutePartTable+0]
    987    sbb     bx, wptr [si+LocIPT_AbsolutePartTable+2]
    988    ; BX:AX - absolute position of partition relative to partition table
    989    ; ...and search for it...
    990   PSP_SearchLoop:
    991       cmp     ax, wptr es:[di+LocBRPT_RelativeBegin]
    992       jne     PSP_SearchMismatch
    993       cmp     bx, wptr es:[di+LocBRPT_RelativeBegin+2]
    994       jne     PSP_SearchMismatch
    995       jmp     PSP_SearchMatch
    996      PSP_SearchMismatch:
    997       add     di, LocBRPT_LenOfEntry     ; 16 Bytes per Partition-Entry
    998    cmp     di, 500+offset PartitionSector
    999    jb      PSP_SearchLoop
    1000    jmp     MBR_HaltSystem
    1001 
    1002    ; -------------------------------------------------------------- ENTRY FOUND
    1003   PSP_SearchMatch:
    1004    or      byte ptr es:[di+LocBRPT_Flags], 80h ; set ACTIVE partition
    1005    IFDEF ReleaseCode
    1006       call    DriveIO_SavePartition      ; Saves the Partition-Table    [SAVE]
    1007    ENDIF
    1008 
    1009 
    1010 
    1011    ; ---------------------------------------------------------- OS/2 / eCS I13X
    1012    ; Now check if the partition to get booted is above 8 GB.
    1013    ;  If yes, set magic bytes 'I13X' at 3000:0 for boot-loader to recognize.
    1014    ;  This method is (c) by IBM <g>
    1015    ; Rousseau: Booting IBM-BM also requires the LBA address of the IBM-BM
    1016    ; partitionafter the 'I13X' signature.
    1017    ; Also, FS needs to be set to 3000H.
    1018    ; This info was obtained by examining the LVM 2,x MBR-code.
    1019    mov     ax, wptr [si+LocIPT_AbsoluteBegin+0]
    1020    mov     bx, wptr [si+LocIPT_AbsoluteBegin+2]
    1021    add     ax, wptr es:[di+LocBRPT_AbsoluteLength+0] ; Add length to absolute
    1022    adc     bx, wptr es:[di+LocBRPT_AbsoluteLength+2] ;  begin location
    1023    ; BX:AX -> Absolute End-Position of Partition
    1024 
    1025    test    byte ptr [CFG_ForceLBAUsage], 1
     1093
     1094    PSP_IsHarddisc:
     1095
     1096
     1097    IFDEF ReleaseCode
     1098        ;
     1099        ; Save configuration on HDD boots (save CFG_PartLast)
     1100        ;
     1101        call    DriveIO_SaveConfiguration
     1102    ENDIF
     1103
     1104
     1105        ;
     1106        ; Prints out BootingNow2 including PartitionName
     1107        ;
     1108        mov     si, offset TXT_BootingNowPartName
     1109        call    MBR_TeletypeVolName
     1110        mov     si, offset TXT_BootingNowPartition
     1111        call    MBR_Teletype
     1112
     1113    ; restores SI (IPT-pointer)
     1114    pop     si
     1115
     1116
     1117
     1118    ;
     1119    ; Get the CHS and LBA location of sector containing
     1120    ; the partition-table for the partition.
     1121    ;
     1122    mov     ax, wptr [si+LocIPT_AbsolutePartTable+0]
     1123    mov     bx, wptr [si+LocIPT_AbsolutePartTable+2]
     1124    mov     cx, wptr [si+LocIPT_LocationPartTable+1]
     1125    mov     dh, bptr [si+LocIPT_LocationPartTable+0]
     1126    mov     dl, [si+LocIPT_Drive]
     1127
     1128IFDEF   AUX_DEBUG
     1129    pusha
     1130    mov     si,offset ptetb
     1131    call    AuxIO_Print
     1132    call    DEBUG_DumpRegisters
     1133    call    AuxIO_TeletypeNL
     1134    mov     ax, word ptr [FreeDriveletterMap+00h]
     1135    mov     dx, word ptr [FreeDriveletterMap+02h]
     1136    call    AuxIO_TeletypeBinDWord
     1137    popa
     1138ENDIF
     1139
     1140
     1141    ;
     1142    ; This loads the MBR in case of PRI or the EBR in case of LOG partitions.
     1143    ;
     1144    call    DriveIO_LoadPartition         ; Load Table...                [LOAD]
     1145
     1146
     1147    ; -------------------------------------------------- MODIFY PARTITION TABLE
     1148
     1149    ; Make sure ES is correctly setup.
     1150    push    cs
     1151    pop     es
     1152
     1153    ; ES:DI - First Partitionentry
     1154    mov     di, offset PartitionSector+446
     1155
     1156    ; Remove all active-flags for safety reasons, primary partition table will
     1157    ; have one partition set active by ScanPartition-routine.
     1158    push    di
     1159        mov      cl, 4
     1160    PSP_RemoveActiveFlagLoop:
     1161        and      bptr es:[di+LocBRPT_Flags], 7Fh
     1162        add      di, LocBRPT_LenOfEntry
     1163        dec      cl
     1164        jnz      PSP_RemoveActiveFlagLoop
     1165    pop     di
     1166
     1167
     1168    ;
     1169    ; Put the partition-to-be-booted location into registers...
     1170    ;
     1171    mov     ax, wptr [si+LocIPT_AbsoluteBegin+0]
     1172    mov     bx, wptr [si+LocIPT_AbsoluteBegin+2]
     1173    sub     ax, wptr [si+LocIPT_AbsolutePartTable+0]
     1174    sbb     bx, wptr [si+LocIPT_AbsolutePartTable+2]
     1175
     1176
     1177    ; BX:AX - absolute position of partition relative to partition table
     1178    ; ...and search for it...
     1179    PSP_SearchLoop:
     1180        cmp     ax, wptr es:[di+LocBRPT_RelativeBegin]
     1181        jne     PSP_SearchMismatch
     1182        cmp     bx, wptr es:[di+LocBRPT_RelativeBegin+2]
     1183        jne     PSP_SearchMismatch
     1184        jmp     PSP_SearchMatch
     1185    PSP_SearchMismatch:
     1186        add     di, LocBRPT_LenOfEntry     ; 16 Bytes per Partition-Entry
     1187        cmp     di, 500+offset PartitionSector
     1188        jb      PSP_SearchLoop
     1189
     1190        ;
     1191        ; Entry not found, Halt System.
     1192        ;
     1193        jmp     MBR_HaltSystem
     1194
     1195    ; ------------------------------------------------------------- ENTRY FOUND
     1196    PSP_SearchMatch:
     1197        or      byte ptr es:[di+LocBRPT_Flags], 80h ; set ACTIVE partition
     1198
     1199
     1200
     1201    IFDEF ReleaseCode
     1202        ;
     1203        ; Save the Partition Table.
     1204        ;
     1205        call    DriveIO_SavePartition     ; Saves the Partition-Table    [SAVE]
     1206    ENDIF
     1207
     1208
     1209
     1210    ; --------------------------------------------------------- OS/2 / eCS I13X
     1211    ; Now check if the partition to get booted is above 8 GB.
     1212    ;  If yes, set magic bytes 'I13X' at 3000:0 for boot-loader to recognize.
     1213    ;  This method is (c) by IBM <g>
     1214    ; Rousseau: Booting IBM-BM also requires the LBA address of the IBM-BM
     1215    ; partitionafter the 'I13X' signature.
     1216    ; Also, FS needs to be set to 3000H.
     1217    ; This info was obtained by examining the LVM 2,x MBR-code.
     1218    mov     ax, wptr [si+LocIPT_AbsoluteBegin+0]
     1219    mov     bx, wptr [si+LocIPT_AbsoluteBegin+2]
     1220    add     ax, wptr es:[di+LocBRPT_AbsoluteLength+0] ; Add length to absolute
     1221    adc     bx, wptr es:[di+LocBRPT_AbsoluteLength+2] ; begin location
     1222    ; BX:AX -> Absolute End-Position of Partition
     1223
     1224
     1225    ;
     1226    ; Always use INT13X v1.0.8.
     1227    ;
     1228    ;~ test    byte ptr [CFG_ForceLBAUsage], 1
    10261229    ;~ jnz     PSP_ForceI13X
    10271230    jmp     PSP_ForceI13X
    10281231
    1029    ; LBA-boundary at 16450560 (FB0400h) (16320x16x63)
    1030    cmp     bx, 00FBh
    1031    jb      PSP_NoI13X
    1032 
    1033 
    1034   PSP_ForceI13X:
     1232    ; LBA-boundary at 16450560 (FB0400h) (16320x16x63)
     1233    cmp     bx, 00FBh
     1234    jb      PSP_NoI13X
     1235
     1236    ;
     1237    ; Setup 'I13X' signature.
     1238    ;
     1239    PSP_ForceI13X:
    10351240        push    es
    10361241        push    di
    10371242        push    si
    10381243
    1039         ; Setup ES and FS.
    1040         ; FS needs to keep this address.
    1041         mov     ax, 3000h
    1042         mov     es, ax
    1043         ; mov fs,ax
    1044         db  08eh
    1045         db  0e0h
    1046 
    1047         ; Insert signature
    1048         xor     di, di
    1049         mov     word ptr es:[di+00], '1I'
    1050         mov     word ptr es:[di+02], 'X3'
    1051 
    1052         ;mov     wptr es:[di], 0
    1053         ;mov     wptr es:[di+2], 0
    1054 
    1055         ; Insert LBA address.
    1056         mov     ax, [si+LocIPT_AbsoluteBegin+0]
    1057         mov     es:[di+04], ax
    1058         mov     ax, [si+LocIPT_AbsoluteBegin+2]
    1059         mov     es:[di+06], ax
     1244            ; Setup ES and FS.
     1245            ; FS needs to keep this address.
     1246            mov     ax, 3000h
     1247            mov     es, ax
     1248            ; mov fs,ax
     1249            db  08eh
     1250            db  0e0h
     1251
     1252            ; Insert signature
     1253            xor     di, di
     1254            mov     word ptr es:[di+00], '1I'
     1255            mov     word ptr es:[di+02], 'X3'
     1256
     1257            ;mov     wptr es:[di], 0
     1258            ;mov     wptr es:[di+2], 0
     1259
     1260            ; Insert LBA address.
     1261            mov     ax, [si+LocIPT_AbsoluteBegin+0]
     1262            mov     es:[di+04], ax
     1263            mov     ax, [si+LocIPT_AbsoluteBegin+2]
     1264            mov     es:[di+06], ax
    10601265
    10611266        pop     si
     
    10651270
    10661271
    1067   PSP_NoI13X:
    1068 
    1069    ; now check, if we need to hide any partition
    1070    test    byte ptr [si+LocIPT_Flags], Flags_HideFeature
    1071    jz      PSP_NoHideFeature
    1072    ; --------------------------------------------------------- PARTITION HIDING
    1073       push    si
    1074          mov     si, offset TXT_BootingHide
    1075          call    MBR_Teletype            ; display "hide active"
    1076       pop     si
    1077       ; First, find Hide-Config
    1078       mov     dl, BootPartNo             ; EntryNumber is straight view
    1079       ;~ mov     ax, LocIPT_MaxPartitions
    1080       mov     ax, LocHPT_LenOfHPT
    1081       mul     dl
    1082       mov     di, offset HidePartitionTable
    1083       add     di, ax                        ; We got the pointer
     1272    PSP_NoI13X:
     1273
     1274        ; now check, if we need to hide any partition
     1275        test    byte ptr [si+LocIPT_Flags], Flags_HideFeature
     1276        jz      PSP_NoHideFeature
     1277
     1278        ; ---------------------------------------------------- PARTITION HIDING
     1279
     1280        ; display "hide active"
     1281        push    si
     1282            mov     si, offset TXT_BootingHide
     1283            call    MBR_Teletype
     1284        pop     si
     1285
     1286
     1287        ; First, find Hide-Config
     1288        mov     dl, [BootPartNo]           ; EntryNumber is straight view
     1289        ;~ mov     ax, LocIPT_MaxPartitions
     1290        mov     ax, LocHPT_LenOfHPT
     1291        mul     dl
     1292        mov     di, offset HidePartitionTable
     1293        add     di, ax                     ; We got the pointer
    10841294
    10851295
     
    10871297        ; each points to a partition.
    10881298        ; 3Fh is end-marker / maximum entries = CFG_Partitions
    1089         mov     cl, CFG_Partitions
    1090         mov     ch,0    ; Index in bitfield array.
    1091         mov     dh,6    ; Bitfield width.
    1092         mov     bx,di   ; Pointer to entry.
     1299        mov     cl, [CFG_Partitions]
     1300        mov     ch,0        ; Index in bitfield array.
     1301        mov     dh,6        ; Bitfield width.
     1302        mov     bx,di       ; Pointer to entry.
     1303
    10931304    PSP_PartitionsHideLoop:
    10941305        mov     dl,ch
     
    11051316        dec     cl
    11061317        jnz     PSP_PartitionsHideLoop
     1318
     1319
    11071320    PSP_EndOfHideProcess:
    11081321
    1109       ; --- HIDE COMPLETED ---
    1110       ; So something got hidden and we have to remark a primary partition,
    1111       ;  if we are booting something non-primary from 1st hdd.
    1112       cmp     bptr [si+LocIPT_Drive], 80h
    1113       ja      PSP_HideAdjustPrimaryMark  ; When booting any hdd, but 1st
    1114       mov     ax, wptr [si+LocIPT_AbsolutePartTable]
    1115       mov     bx, wptr [si+LocIPT_AbsolutePartTable+2]
    1116       or      ax, ax
    1117       jnz     PSP_HideAdjustPrimaryMark  ; or booting non-primary partition
    1118       or      bx, bx                     ;  on 1st harddrive.
    1119       jz      PSP_NoHideAdjustPrimaryMark
    1120      PSP_HideAdjustPrimaryMark:
    1121       ; Load Primary Partition Table...
    1122       xor     ax, ax
    1123       xor     bx, bx
    1124       mov     cx, 0001h                  ; Cylinder 0, Sector 1
    1125       mov     dx, 0080h                  ; First HD, Head 0
     1322        ; --- HIDE COMPLETED ---
     1323        ; So something got hidden and we have to remark a primary partition,
     1324        ;  if we are booting something non-primary from 1st hdd.
     1325        cmp     bptr [si+LocIPT_Drive], 80h
     1326        ja      PSP_HideAdjustPrimaryMark  ; When booting any hdd, but 1st
     1327        mov     ax, wptr [si+LocIPT_AbsolutePartTable]
     1328        mov     bx, wptr [si+LocIPT_AbsolutePartTable+2]
     1329        or      ax, ax
     1330        jnz     PSP_HideAdjustPrimaryMark  ; or booting non-primary partition
     1331        or      bx, bx                     ;  on 1st harddrive.
     1332        jz      PSP_NoHideAdjustPrimaryMark
     1333
     1334    PSP_HideAdjustPrimaryMark:
     1335        ; Load Primary Partition Table...
     1336        xor     ax, ax
     1337        xor     bx, bx
     1338        mov     cx, 0001h                  ; Cylinder 0, Sector 1
     1339        mov     dx, 0080h                  ; First HD, Head 0
    11261340                                                                     ; Load MBR
    1127       call    DriveIO_LoadPartition      ; Load Primary Partition Table
    1128       call    PART_MarkFirstGoodPrimary
    1129       IFDEF ReleaseCode
    1130                                                                      ; Save MBR
    1131          call    DriveIO_SavePartition   ; Saves the Partition-Table
    1132       ENDIF
    1133      PSP_NoHideAdjustPrimaryMark:
    1134 
    1135   PSP_NoHideFeature:
    1136    ; Check, if we are supposed to ignore LVM altogether...
    1137    test    byte ptr [CFG_IgnoreLVM], 1
    1138    jnz     PSP_NoLVMReassignment
    1139    ; --------------------------------------------------------- LVM REASSIGNMENT
    1140       ; Driveletter must be set for this partition
    1141       test    byte ptr [si+LocIPT_Flags], Flags_DriveLetter
    1142       jz      PSP_NoLVMReassignment
    1143       ;movzx   bx, BootPartNo             ; EntryNumber is straight view
    1144       mov   bl,BootPartNo             ; EntryNumber is straight view
    1145       mov   bh,0
    1146 
    1147       mov     al, bptr [DriveLetters+bx]
    1148       sub     al, 3Dh                    ; Convert e.g. 80h -> 'C'
    1149       cmp     al, bptr [PartitionVolumeLetters+bx]
    1150       je      PSP_NoLVMReassignment      ; If driveletters match -> no change
    1151       call    LVM_DoLetterReassignment   ; Give partition SI letter AL
    1152   PSP_NoLVMReassignment:
    1153    push    si
    1154    ; ------------------------------------------------------- -"PLEASE WAIT..."-
    1155   PSP_IsFloppyCDROMetc:
    1156       mov     si, offset TXT_BootingWait
    1157       call    MBR_Teletype               ; display "please wait"
    1158    pop     si
    1159 
    1160    ; Process Partition Tables, if M$-Hack required (changes Ext Part Type)
    1161    call    MSHACK_ProcessPartTables
    1162 
    1163    test    byte ptr [CFG_BootMenuActive], 0FFh
    1164    jz      PSP_NoMenuNoSound
    1165 
    1166    ; --------------------------------------------------------------- BOOT-SOUND
    1167       call    SOUND_ExecuteBoot
    1168   PSP_NoMenuNoSound:
    1169 
    1170    ; -------------------------------------------------- SPECIAL BOOT PROCESSING
    1171    ; Check here, if the Boot shall be done via resume to BIOS...
    1172    mov     al, byte ptr [si+LocIPT_SystemID]
    1173    cmp     al, 0FEh                      ; Via BIOS ? (aka resume BIOS boot sequence)
    1174    je      PSP_ResumeBIOSbootSeq
     1341        call    DriveIO_LoadPartition      ; Load Primary Partition Table
     1342        call    PART_MarkFirstGoodPrimary
     1343
     1344    IFDEF ReleaseCode
     1345        call    DriveIO_SavePartition       ; Saves the Partition-Table
     1346    ENDIF
     1347
     1348
     1349    PSP_NoHideAdjustPrimaryMark:
     1350
     1351
     1352    PSP_NoHideFeature:
     1353        ; Check, if we are supposed to ignore LVM altogether...
     1354        test    byte ptr [CFG_IgnoreLVM], 1
     1355        jnz     PSP_NoLVMReassignment
     1356
     1357        ; ---------------------------------------------------- LVM REASSIGNMENT
     1358
     1359        ; Driveletter must be set for this partition
     1360        test    byte ptr [si+LocIPT_Flags], Flags_DriveLetter
     1361        jz      PSP_NoLVMReassignment
     1362        ;movzx   bx, BootPartNo              ; EntryNumber is straight view
     1363        mov     bl,[BootPartNo]               ; EntryNumber is straight view
     1364        mov     bh,0
     1365
     1366        mov     al, bptr [DriveLetters+bx]
     1367        sub     al, 3Dh                     ; Convert e.g. 80h -> 'C'
     1368        cmp     al, bptr [PartitionVolumeLetters+bx]
     1369
     1370
     1371        ;~ je      PSP_NoLVMReassignment   ; If driveletters match -> no change
     1372        ; Rousseau:
     1373        ; But there can still be other partitions with the same drive-letter.
     1374        ; For instance if the user did an advanced installation with multiple
     1375        ; eComStation systems using the same boot-drive-letter.
     1376        ; So, even if the drive-letter forced is the same as the
     1377        ; partition-volume-letter, other partitions still need to be checked
     1378        ; and possibly hidden. So we always do the drive-letter reassignment,
     1379        ; which is enhanced to keep data-partitions (those -not- in the Menu)
     1380        ; visible. So the 'je' instruction above is commented-out.
     1381
     1382
     1383        ;
     1384        ; Give partition SI letter AL
     1385        ;
     1386        call    LVM_DoLetterReassignment
     1387
     1388
     1389
     1390
     1391    PSP_NoLVMReassignment:
     1392        push    si
     1393        ; -------------------------------------------------- -"PLEASE WAIT..."-
     1394    PSP_IsFloppyCDROMetc:
     1395            mov     si, offset TXT_BootingWait
     1396            call    MBR_Teletype               ; display "please wait"                      ; SI staat nog op stack; aanpassen !!!!
     1397        pop     si
     1398
     1399        ; Process Partition Tables, if M$-Hack required (changes Ext Part Type)
     1400        call    MSHACK_ProcessPartTables
     1401
     1402        test    byte ptr [CFG_BootMenuActive], 0FFh
     1403        jz      PSP_NoMenuNoSound
     1404
     1405        ; ---------------------------------------------------------- BOOT-SOUND
     1406        call    SOUND_ExecuteBoot
     1407
     1408    PSP_NoMenuNoSound:
     1409
     1410        ; --------------------------------------------- SPECIAL BOOT PROCESSING
     1411        ; Check here, if the Boot shall be done via resume to BIOS...
     1412        mov     al, byte ptr [si+LocIPT_SystemID]
     1413        cmp     al, 0FEh        ; Via BIOS ? (aka resume BIOS boot sequence)
     1414        je      PSP_ResumeBIOSbootSeq
     1415
    11751416; [Linux support removed since v1.02]
    1176 ;   cmp     al, 0FDh                      ; Kernel-Booting ?
     1417;   cmp     al, 0FDh                        ; Kernel-Booting ?
    11771418;   je      PSP_KernelBooting
    1178    jmp     PSP_StartNormal
    1179 
    1180   PSP_ResumeBIOSbootSeq:
    1181    int     18h                           ; Give control back to BIOS
    1182    db      0EAh                          ; if return to here -> Reboot
    1183    dw      0FFF0h
    1184    dw      0F000h
     1419
     1420        jmp     PSP_StartNormal
     1421
     1422    PSP_ResumeBIOSbootSeq:
     1423        int     18h                         ; Give control back to BIOS
     1424        db      0EAh                        ; if return to here -> Reboot
     1425        dw      0FFF0h
     1426        dw      0F000h
    11851427
    11861428; [Linux support removed since v1.02]
     
    11911433;   dw      0F000h
    11921434
    1193    ; =======================================================================
    1194    ;  FROM THIS POINT ON, ONLY DS and SI REGISTER IS NEEDED TO BE PRESERVED
    1195    ; =======================================================================
    1196 
    1197   PSP_StartNormal:
    1198    mov     ax, wptr [si+LocIPT_AbsoluteBegin+0]
    1199    mov     bx, wptr [si+LocIPT_AbsoluteBegin+2]
    1200    mov     cx, [si+LocIPT_LocationBegin+1]
    1201    mov     dh, [si+LocIPT_LocationBegin+0]
    1202    mov     dl, [si+LocIPT_Drive]
    1203 
    1204    ; This loads the PBR of the partition.
    1205    call    DriveIO_LoadPartition         ; Loads boot-sector...   [PARTBOOTSEC]
    1206 
    1207     ;
    1208     ; The JFS PBR-code does not use the passed BPB in memory but uses the BPB
    1209     ; on disk. This breaks the drive-letter feature on JFS.
    1210     ; So we make a copy of the PBR in memory, and if the partition is JFS
    1211     ; we later adjust the physical-disk and boot-drive-letter in this
    1212     ; copy and write it back to disk.
    1213     ; Then the JFS PBR-code will see the correct boot-drive-letter.
    1214     ;
    1215     pusha
    1216     mov     si,offset PartitionSector
    1217     mov     di,offset JfsPBR
    1218     mov     cx,100h
    1219     cld
    1220     rep     movsw
    1221     popa
    1222 
    1223 
    1224 
    1225    ; Check if the disk is a harddisk or a floppy.
    1226    mov     dl,[si+LocIPT_Drive]
    1227    cmp      dl, 80h
    1228    jae      is_harddisk
    1229 
    1230    ;
    1231    ; This is a dirty hack to fix booting from a floppy.
    1232    ; With all the modifications made since v1.06 this feature was broken
    1233    ; because Int13X is used implicitly now, and that does not work
    1234    ; for diskette access.
    1235    ; This jumps to the code that loads and starts the pbr-code.
    1236    ; Note that it also skips virus checking !
    1237    ; This will be fixed at a later date.
    1238    jmp     boot_from_floppy
    1239 
    1240 
    1241 
    1242 
    1243   ;
    1244   ; The disk is a harddisk so we need to do various checks and fixes.
    1245   ;
    1246   is_harddisk:
    1247 
    1248    test    byte ptr [CFG_DetectVIBR], 1
    1249    jz      PSP_NoVIBR
    1250    test    byte ptr [si+LocIPT_Flags], Flags_VIBR_Detection
    1251    jz      PSP_NoVIBR
    1252    ; ---------------------------------------------------------- CHECKS FOR VIBR
    1253       push    si
    1254          mov     si, offset PartitionSector
    1255          mov     bx, 4B4Dh               ; Magic: 'MK'
    1256          call    MBR_GetCheckOfSector
    1257       pop     si
    1258       cmp     [si+LocIPT_BootRecordCRC], bx
    1259       je      PSP_NoVIBR
    1260       mov     bx, [si+LocIPT_BootRecordCRC]
    1261       or      bx, bx
    1262       jz      PSP_NoVIBR
    1263       ; Oh Oh, got a virus :(
    1264       mov     si, offset TXT_VirusFoundMain
    1265       call    MBR_Teletype
    1266       mov     si, offset TXT_VirusFound2 ; VIBR-Virus
    1267       call    MBR_Teletype
    1268       mov     si, offset TXT_VirusFoundEnd
    1269       call    MBR_Teletype
    1270       jmp     MBR_HaltSystem
    1271 
    1272  PSP_NoVIBR:
    1273    test    byte ptr [CFG_ProtectMBR], 1
    1274    jz      PSP_NoMBRprotect
    1275    ; -------------------------------------------------- INSTALLS MBR-PROTECTION
    1276    ; We need DS:SI later...
    1277    push    ds
    1278    push    si
    1279       ; First subtract 1024 bytes from Base-Memory...
    1280       push    ds
    1281          mov     ax, 40h
    1282          mov     ds, ax
    1283          mov     dx, word ptr ds:[13h]
    1284          dec     dx                      ; 1 == 1kbyte
    1285          mov     word ptr ds:[13h], dx
    1286       pop     ds
    1287       shl     dx, 6                      ; trick, now DX is a segment
    1288 
    1289       ; Now copy in our code (to DX:0)...
    1290 
    1291       mov     si, offset MBR_Protection  ; DS:SI - Source Image
    1292       mov     es, dx
    1293       xor     di, di                     ; ES:DI - Destination
    1294       mov     cx, 512
    1295       rep     movsw                      ; Move 1024 bytes...
    1296 
    1297       ; Now fill in variables...
    1298 
    1299       xor     ax, ax
    1300       mov     ds, ax
    1301       mov     si, 10h*4
    1302       xor     di, di                     ; INT 10h Vector to MBR Protection
    1303       ;movsd
    1304       movsw
    1305       movsw
    1306 
    1307       mov     si, 13h*4                  ; INT 13h Vector to MBR Protection
    1308       ;movsd
    1309       movsw
    1310       movsw
    1311 
    1312       mov     al, CFG_IgnoreWriteToMBR   ; Option to MBR Protection
    1313       stosb
    1314 
    1315       ; Now switch INT 13h vector to MBR Protection
    1316 
    1317       sub     si, 4
    1318       mov     ax, 9
    1319       mov     ds:[si], ax
    1320       mov     ds:[si+2], dx              ; Vector hardcoded at DS:0009
    1321       ; MBR-Protection now active :)
    1322    ; Restore DS:SI
    1323    pop     si
    1324    pop     ds
    1325 
    1326 
    1327 
    1328 
     1435
     1436
     1437    ; =======================================================================
     1438    ;  FROM THIS POINT ON, ONLY DS and SI REGISTER IS NEEDED TO BE PRESERVED
     1439    ; =======================================================================
     1440
     1441    PSP_StartNormal:
     1442        mov     ax, wptr [si+LocIPT_AbsoluteBegin+0]
     1443        mov     bx, wptr [si+LocIPT_AbsoluteBegin+2]
     1444        mov     cx, [si+LocIPT_LocationBegin+1]
     1445        mov     dh, [si+LocIPT_LocationBegin+0]
     1446        mov     dl, [si+LocIPT_Drive]
     1447
     1448        ; This loads the PBR of the partition.
     1449        call    DriveIO_LoadPartition   ; Loads boot-sector...   [PARTBOOTSEC]
     1450
     1451        ;
     1452        ; The JFS PBR-code does not use the passed BPB in memory but uses the BPB
     1453        ; on disk. This breaks the drive-letter feature on JFS.
     1454        ; So we make a copy of the PBR in memory, and if the partition is JFS
     1455        ; we later adjust the physical-disk and boot-drive-letter in this
     1456        ; copy and write it back to disk.
     1457        ; Then the JFS PBR-code will see the correct boot-drive-letter.
     1458        ;
     1459        pusha
     1460            mov     si,offset [PartitionSector]
     1461            mov     di,offset [PBRSector]
     1462            mov     cx,100h
     1463            cld
     1464            rep     movsw
     1465        popa
     1466
     1467
     1468
     1469        ; Check if the disk is a harddisk or a floppy.
     1470        mov     dl,[si+LocIPT_Drive]
     1471        cmp      dl, 80h
     1472        jae      is_harddisk
     1473
     1474        ;
     1475        ; This is a dirty hack to fix booting from a floppy.
     1476        ; With all the modifications made since v1.06 this feature was broken
     1477        ; because Int13X is used implicitly now, and that does not work
     1478        ; for diskette access.
     1479        ; This jumps to the code that loads and starts the pbr-code.
     1480        ; Note that it also skips virus checking !
     1481        ; This will be fixed at a later date.
     1482        jmp     boot_from_floppy
     1483
     1484    ;
     1485    ; The disk is a harddisk so we need to do various checks and fixes.
     1486    ;
     1487    is_harddisk:
     1488
     1489        test    byte ptr [CFG_DetectVIBR], 1
     1490        jz      PSP_NoVIBR
     1491        test    byte ptr [si+LocIPT_Flags], Flags_VIBR_Detection
     1492        jz      PSP_NoVIBR
     1493
     1494        ; ----------------------------------------------------- CHECKS FOR VIBR
     1495        push    si
     1496            mov     si, offset PartitionSector
     1497            mov     bx, 4B4Dh               ; Magic: 'MK'
     1498            call    MBR_GetCheckOfSector
     1499        pop     si
     1500
     1501        cmp     [si+LocIPT_BootRecordCRC], bx
     1502        je      PSP_NoVIBR
     1503        mov     bx, [si+LocIPT_BootRecordCRC]
     1504        or      bx, bx
     1505        jz      PSP_NoVIBR
     1506        ; Oh Oh, got a virus :(
     1507        mov     si, offset TXT_VirusFoundMain
     1508        call    MBR_Teletype
     1509        mov     si, offset TXT_VirusFound2 ; VIBR-Virus
     1510        call    MBR_Teletype
     1511        mov     si, offset TXT_VirusFoundEnd
     1512        call    MBR_Teletype
     1513        jmp     MBR_HaltSystem
     1514
     1515    PSP_NoVIBR:
     1516       test    byte ptr [CFG_ProtectMBR], 1
     1517       jz      PSP_NoMBRprotect
     1518        ; --------------------------------------------- INSTALLS MBR-PROTECTION
     1519        ; We need DS:SI later...
     1520        push    ds
     1521        push    si
     1522
     1523            ; First subtract 1024 bytes from Base-Memory...
     1524            push    ds
     1525                mov     ax, 40h
     1526                mov     ds, ax
     1527                mov     dx, word ptr ds:[13h]
     1528                dec     dx                      ; 1 == 1kbyte
     1529                mov     word ptr ds:[13h], dx
     1530            pop     ds
     1531            shl     dx, 6                      ; trick, now DX is a segment
     1532
     1533            ; Now copy in our code (to DX:0)...
     1534
     1535            mov     si, offset MBR_Protection  ; DS:SI - Source Image
     1536            mov     es, dx
     1537            xor     di, di                     ; ES:DI - Destination
     1538            ;~ mov     cx, 512
     1539            mov     cx, 384
     1540            rep     movsw                      ; Move 768 bytes...
     1541
     1542            ; Now fill in variables...
     1543
     1544            xor     ax, ax
     1545            mov     ds, ax
     1546            mov     si, 10h*4
     1547            xor     di, di                     ; INT 10h Vector to MBR Protection
     1548            ;movsd
     1549            movsw
     1550            movsw
     1551
     1552            mov     si, 13h*4                  ; INT 13h Vector to MBR Protection
     1553            ;movsd
     1554            movsw
     1555            movsw
     1556
     1557            mov     al, CFG_IgnoreWriteToMBR   ; Option to MBR Protection
     1558            stosb
     1559
     1560            ; Now switch INT 13h vector to MBR Protection
     1561
     1562            sub     si, 4
     1563            mov     ax, 9
     1564            mov     ds:[si], ax
     1565            mov     ds:[si+2], dx              ; Vector hardcoded at DS:0009
     1566            ; MBR-Protection now active :)
     1567
     1568        ; Restore DS:SI
     1569        pop     si
     1570        pop     ds
    13291571
    13301572
     
    13861628        ; Get index of phys-disk field in BX
    13871629        call    PART_GetFieldIndex
    1388         mov     PhysDiskBpbIndex,ax
     1630        mov     [PhysDiskBpbIndex],ax
    13891631        mov     bx,ax
    13901632
    13911633        ; Locate cursor for output of debug-info
    1392         pusha
    1393         mov     ch,7
    1394         mov     cl,0
    1395         call    VideoIO_Color
    1396         mov     ch,6
    1397         mov     cl,1
    1398         call    VideoIO_Locate
    1399         popa
    1400 
    1401 
    1402 
     1634        ;~ pusha
     1635        ;~ mov     ch,7
     1636        ;~ mov     cl,0
     1637        ;~ call    VideoIO_Color
     1638        ;~ mov     ch,6
     1639        ;~ mov     cl,1
     1640        ;~ call    VideoIO_Locate
     1641        ;~ popa
    14031642
    14041643
     
    14311670
    14321671
    1433 
    1434 
    1435 
    1436 
    14371672        ;
    14381673        ; If the partition is IBM-BM we skip all the BPB adjustments.
     
    14511686        ; BX holds index to phys-disk field
    14521687        ;
    1453         mov     al,byte ptr [si+LocIPT_Drive]
     1688        mov     al,byte ptr [si+LocIPT_Drive]                                       ; Moet dit niet later gebeuren ??? (NT/WIN LDR hangs)
    14541689        mov     es:[di+bx],al
    14551690
     
    14671702        ; Fix hidden sectors field
    14681703        ;
    1469 
    1470         ; Low word of 32-bits "hidden sectors"
    14711704        mov     ax,[si+LocIPT_AbsoluteBegin]
    1472         mov     es:[di+1ch], ax
    1473         ; High word of 32-bits "hidden sectors"
     1705        mov     es:[di+1ch], ax     ; Low word of 32-bits "hidden sectors"
     1706
    14741707        mov     ax,[si+LocIPT_AbsoluteBegin+2]
    1475         mov     es:[di+1eh], ax
    1476 
    1477 
    1478 
    1479 
     1708        mov     es:[di+1eh], ax     ; High word of 32-bits "hidden sectors"
    14801709
    14811710        ;
     
    15311760        ; depending on FS used.
    15321761        ; AL will be 0 for any file-system other than FAT12/FAT16/HPFS/JFS.
     1762        ; In that case no fixing of boot-drive-letters is needed.
    15331763        ;
    15341764        test    al,al
     
    15361766
    15371767
    1538 
    1539         ; Check if the boot-drive-letter is non-zero.
    1540         mov     bx,PhysDiskBpbIndex
    1541         inc     bx
    1542         mov     al,es:[di+bx]
    1543         test    al,al
    1544         ; Non-zero, so no fixing needed.
    1545         ;jnz     bdl_ok     ;; Why not always fix ? (so, jnz disabled)
    1546 
    1547 
    1548         ;
    1549         ; Always fix boot-drive-letter on FAT12/FAT16/HPFS/JFS
    1550         ;
    1551 
     1768        ;
     1769        ; We have a partition that potentially can have incorrect values
     1770        ; for the boot-drive-letter or incorrect LVM drive-letters.
     1771        ;
     1772        ; The boot-drive-letter can be zero as the result of copying / moving
     1773        ; partitions or restoring a HPFS system from archive.
     1774        ; In that case the LVM drive-letter is used if present.
     1775        ;
     1776        ; Incorrect LVM drive-letters are the result of the drive-letter
     1777        ; reassign function when two or more eComStation installations use the
     1778        ; same boot-drive-letter.
     1779        ; In that case the boot-drive-letter is assigned to the
     1780        ; LVM drive-letter.
     1781        ;
     1782        ; If both are zero there is no way to obtain the correct
     1783        ; boot-drive-letter value. The user needs to examine CONFIG.SYS and
     1784        ; force that letter for the partition.
     1785        ;
     1786
     1787
     1788
     1789
     1790
     1791        ;
    15521792        ; Get the drive-letter for the partition from the LVM-info.
     1793        ; Returns CY=1 if AL contains drive-letter, CY=0 and AL=0 if
     1794        ; no letter assigned (hidden) or no LVM info found.
     1795        ;
    15531796        mov     dl,byte ptr [si+LocIPT_Drive]
    15541797        mov     cx,[si+LocIPT_AbsoluteBegin+00h]
     
    15561799        call    LVM_GetDriveLetter
    15571800
    1558         ; Save the status for later use
    1559         pushf
     1801
     1802        ; Save for later use.
     1803        mov     byte ptr [LVMdl], al
    15601804
    15611805        ; See if the drive-letter feature is active.
     
    15631807        test    byte ptr [si+LocIPT_Flags], Flags_DriveLetter
    15641808
    1565         ; Nope, it's not so we don't force the boot-drive-letter
    1566         ; using field 25h.
     1809        ; Nope, it's not so we don't force the boot-drive-letter.
    15671810        jz      PSP_NoLogicalSupport
    15681811
    15691812        ; Partition index in BX
    1570         mov     bl,BootPartNo               ; EntryNumber is straight view
     1813        mov     bl,[BootPartNo]     ; EntryNumber is straight view
    15711814        mov     bh,0
    15721815
    1573         ; Pointer to the user specified boot-drive
    1574         ; Get it and convert to ASCII letter
     1816        ; Get the user specified boot-drive-letter.
     1817        ; 80h notation.
    15751818        mov     al, bptr [DriveLetters+bx]
    1576         sub     al,3dh      ; Convert BIOS notation to ASCII drive-letter
    1577 
     1819
     1820        ; Safety check for zero value.
     1821        test    al,al
     1822        jz      PSP_NoValidUserDriveLetter
     1823
     1824        ; Convert 80h notation to ASCII.
     1825        sub     al,3dh              ; 80h - 3dh = 43h = 'C', etc.
     1826
     1827    PSP_NoValidUserDriveLetter:
     1828        ; Here we misuse the LVM-dl storage to store the user forced
     1829        ; or zero drive-letter.
     1830        mov     byte ptr [LVMdl], al
    15781831
    15791832
    15801833    PSP_NoLogicalSupport:
    15811834
    1582         ; Drive letter is LVM obtained or user-forced.
    1583         ; Save it in AH.
     1835        ; A possibly valid drive-letter has been obtained from either
     1836        ; LVM-info or the drive-letter feature.
     1837        ; It's in [LDMdl] local storage.
     1838
     1839
     1840
     1841        ;
     1842        ; Get the boot-drive-letter from the BPB of the partition.
     1843        ;
     1844        mov     bx, [PhysDiskBpbIndex]
     1845        inc     bx
     1846        mov     al,es:[di+bx]       ; 80h=C:,81h=D:, etc.
     1847        ; Store it for later use
     1848        mov     byte ptr [BPBdl], al
     1849
     1850
     1851        ; See if both the LVM drive-letter and the BPB drive-letter are zero.
     1852        ; If so, then we have a problem.
     1853        ; No valid drive-letter can be obtained and the user has to examine
     1854        ; CONFIG.SYS and set that letter in the drive-letter feature
     1855        ; for the partition.
    15841856        mov     ah,al
    1585 
    1586 
    1587         ; Restore the status whether an LVM drive-letter could be obtained
    1588         popf
    1589 
    1590 
    1591         ;
    1592         ; No valid LVM-info if no info found or drive-letter is zero.
    1593         ;
    1594         jnc     no_valid_lvm_info
    1595         test    al,al
    1596         jz      no_valid_lvm_info
    1597 
    1598 
    1599         ;
    1600         ; We have found a valid drive-letter in the LVM-info.
    1601         ;
    1602 
     1857        mov     al, byte ptr [LVMdl]
     1858        or      al,ah
     1859        jz      no_valid_boot_drive_letter_found
     1860
     1861
     1862        ; See if both the LVM drive-letter and the BPB drive-letter are
     1863        ; the same. In that case we should have a valid situation and no
     1864        ; adjustments need to be made.
     1865        cmp     al,ah
     1866        jz      PSP_valid_boot_drive
     1867
     1868
     1869        ;
     1870        ; Ok, at least one of them is valid.
     1871        ;
     1872
     1873        ; See if the BPB boot-drive-letter is valid
     1874        ; This one is supposed not to change since eCS cannot be booted
     1875        ; from another drive then it was installed on.
     1876        test    ah,ah
     1877        jnz     BPB_boot_drive_valid
     1878
     1879        ; Nope it's not.
     1880        ; So we use the LVM drive-letter for the BPB boot-drive-letter.
    16031881        ; Convert to BIOS notation ('C'+3dh=80h, 'D'->81h, etc.)
     1882        ; This is where the user can fix this issue by using the
     1883        ; drive-letter feature.
    16041884        add     al,3dh
    1605 
     1885        mov     bx,[PhysDiskBpbIndex]
     1886        ; Advance to field for drive-letter in BIOS notation (OS/2 - eCS)
     1887        inc     bx
     1888        ; Fix the boot-drive-letter field in the BPB
     1889        mov     es:[di+bx],al
     1890
     1891        jmp     PSP_valid_boot_drive
    16061892
    16071893        ;
     
    16171903
    16181904
    1619         ; Fix the boot-drive-letter field in the BPB
    1620         mov     bx,PhysDiskBpbIndex
    1621         ; Advance to field for drive-letter in BIOS notation (OS/2 - eCS)
     1905    ;
     1906    ; Here we enter when the LVM drive-letter is zero or not the same
     1907    ; as the BPB boot-drive-letter.
     1908    ; This can be the case when booting a hidden partition, LVM-dl = zero,
     1909    ; or the LVM-dl was reassigned because another system with the same
     1910    ; drive-letter was booted previously.
     1911    ; In any case, we set the LVM drive-letter to the BPB boot-drive-letter
     1912    ; so the system can be booted.
     1913    ; Driveletters on other partitions have already been reassigned by the
     1914    ; reassignement-procedure earlier.
     1915    ;
     1916    BPB_boot_drive_valid:
     1917
     1918
     1919
     1920
     1921        ;
     1922        ; ALWAYS SET LVM to BPB
     1923        ;
     1924        ;~ mov     dl,byte ptr [si+LocIPT_Drive]
     1925        ;~ mov     cx,[si+LocIPT_AbsoluteBegin+00h]
     1926        ;~ mov     bx,[si+LocIPT_AbsoluteBegin+02h]
     1927        ;~ mov     al,[BPBdl]
     1928        ;~ sub     al,3dh
     1929        ;~ call    LVM_SetDriveLetter                                                                  ; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1930
     1931
     1932        ;
     1933        ; ALWAYS SET BPB to LVM
     1934        ;
     1935        mov     dl,byte ptr [si+LocIPT_Drive]
     1936        mov     cx,[si+LocIPT_AbsoluteBegin+00h]
     1937        mov     bx,[si+LocIPT_AbsoluteBegin+02h]
     1938        call    LVM_GetDriveLetter                                                                  ; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1939        add     al,3dh
     1940        mov     bx,[PhysDiskBpbIndex]
    16221941        inc     bx
    16231942        mov     es:[di+bx],al
    16241943
    16251944
    1626         jmp     bdl_ok
    1627 
    1628 
    1629     no_valid_lvm_info:
     1945    update_PBR:
     1946
     1947
     1948
     1949    ;
     1950    ; Here both the boot-drive-letter and the LVM drive-letter are zero.
     1951    ; So the only way to determine the drive-letter is to examine CONFIG.SYS.
     1952    ; Then force that drive-letter in the drive-letter feature.
     1953    no_valid_boot_drive_letter_found:
    16301954        ; HERE SHOULD COME AN ERROR POP-UP ABOUT NO BOOT-DRIVE OR NO LVM-INFO.
    16311955        ; WE CONTINUE BOOTING BUT OS/2 - eCS WILL MOST PROBABLY FAIL TO BOOT.
     1956
     1957        ; FIXME:
     1958        ; ISSUE SOME KIND OF WARNING...
    16321959
    16331960        ;mov     ah,07h
     
    16391966
    16401967
     1968
     1969
     1970    PSP_valid_boot_drive:
     1971
     1972
     1973
     1974
    16411975    ;
    16421976    ; Boot DriveLetter OK.
     
    16441978    bdl_ok:
    16451979
     1980
     1981IFDEF   AUX_DEBUG
     1982    pusha
     1983    call    AuxIO_TeletypeNL
     1984    mov     bx, [PhysDiskBpbIndex]
     1985    inc     bx
     1986    mov     al, [di+bx]
     1987    call    AuxIO_TeletypeHexByte
     1988    mov     bl,[BootPartNo]
     1989    mov     al, [DriveLetters+bx]
     1990    call    AuxIO_TeletypeHexByte
     1991    mov     al, [PartitionVolumeLetters+bx]
     1992    add     al, 3dh
     1993    call    AuxIO_TeletypeHexByte
     1994    mov     al, [LVMdl]
     1995    add     al, 3dh
     1996    call    AuxIO_TeletypeHexByte
     1997    mov     al, [si+LocIPT_SystemID]
     1998    call    AuxIO_TeletypeHexByte
     1999    mov     al,[FSType]
     2000    call    AuxIO_TeletypeHexByte
     2001    popa
     2002ENDIF
    16462003
    16472004        ;
     
    16552012        mov     al,[FSType]
    16562013        cmp     al,04h      ; JFS
    1657         jnz     no_jfs_pbr
     2014        je      write_back_pbr
     2015        cmp     al,02h      ; HPFS
     2016        je      write_back_pbr
     2017
     2018        jmp     no_jfs_pbr
     2019
     2020
     2021    write_back_pbr:
    16582022
    16592023        ; Save IPT pointer
     
    16612025
    16622026        ; Copy the boot-drive and boot-drive-letter fields.
    1663         mov     si,offset PartitionSector
    1664         mov     di,offset JfsPBR
     2027        mov     si,offset [PartitionSector]
     2028        mov     di,offset [PBRSector]
    16652029        mov     al,[si+24h]
    16662030        mov     [di+24h],al
     
    16792043
    16802044        ; Write the adjusted JFS PBR to disk.
    1681         mov     si, offset JfsPBR
     2045        mov     si, offset [PBRSector]
    16822046        call    DriveIO_SaveSector
    16832047
     
    16932057
    16942058
    1695 
    1696 
    1697 
    1698 
    1699 
    1700 
    1701 
    1702 
    1703 
    1704 
    1705 
    1706 
    17072059    ; ----------------------------------------------- LOGICAL PARTITION SUPPORT
    17082060
    17092061
    17102062
    1711         ; AiR-BOOT now works around it by using the LVM-info (DLAT) of
    1712         ; the partiton if present.
    1713         ; Note however that if the drive-letter feature is active,
    1714         ; this will override AB's automatic fixing.
    1715         ;
    1716         ; Test if the drive-letter feature is active for this partition.
    1717         ; If so, then the drive that the user defined will be placed at
    1718         ; byte 25h (37d) of the in-ram PartitionSector (BPB).
    1719         ; (BIOS 80h notation: 80h=C, 81h=D, etc.)
    1720         ; This is a remedy for when the corresponding field (25h) in the BPB on
    1721         ; disk is zero.
    1722         ;
     2063    ; AiR-BOOT now works around it by using the LVM-info (DLAT) of
     2064    ; the partiton if present.
     2065    ; Note however that if the drive-letter feature is active,
     2066    ; this will override AB's automatic fixing.
     2067    ;
     2068    ; Test if the drive-letter feature is active for this partition.
     2069    ; If so, then the drive that the user defined will be placed at
     2070    ; byte 25h (37d) of the in-ram PartitionSector (BPB).
     2071    ; (BIOS 80h notation: 80h=C, 81h=D, etc.)
     2072    ; This is a remedy for when the corresponding field (25h) in the BPB on
     2073    ; disk is zero.
     2074    ;
    17232075
    17242076
     
    17592111
    17602112
    1761 IFDEF AUX_DEBUG
    1762    call     DEBUG_Dump2
    1763    ;~ call     DEBUG_DumpBSSSectors
    1764    ;~ call     DEBUG_DumpDriveLetters
    1765 ENDIF
     2113    IFDEF   AUX_DEBUG
     2114        pusha
     2115        call    DEBUG_Dump2
     2116        ;~ call    DEBUG_DumpBSSSectors
     2117        call    DEBUG_DumpDriveLetters
     2118        call    DEBUG_DumpVolumeLetters
     2119        call    AuxIO_TeletypeNL
     2120        popa
     2121    ENDIF
    17662122
    17672123
     
    17712127;
    17722128
    1773     ; Skip wait-for-key
    1774     jmp start_pbr
     2129    IFNDEF  AUX_DEBUG
     2130        ; Skip wait-for-key
     2131        jmp StartPBR
     2132    ENDIF
    17752133
    17762134        ;
     
    17842142
    17852143        ; Nope, Go activate PBR loader
    1786         jne      start_pbr
     2144        jne      StartPBR
    17872145
    17882146        ;push    ds
    17892147        ;pop     es
    17902148
     2149        ; Yep, restart AiR-BOOT so simulate load DX:BX with old BIOS SS:SP
     2150        jmp     AirbootRestart
     2151
    17912152        ; Yep, Reenter bootmenu
    1792         jmp      MBR_Main_ReEnterBootMenuPre
     2153        ;~ jmp     MBR_Main_ReEnterBootMenuPre
    17932154
    17942155
     
    17972158; Transfer control to the PBR
    17982159;
    1799 start_pbr:
     2160StartPBR:
    18002161
    18012162        ; Debug display index
     
    18122173
    18132174        ;
    1814         ; Show "wait dots"
    1815         ;
    1816         pusha
    1817         ; Color white on black
    1818         mov     ch,7
    1819         mov     cl,0
    1820         call    VideoIO_Color
    1821         ; Locate cursor for output of debug-info
    1822         mov     ch,8
    1823         mov     cl,1
    1824         call    VideoIO_Locate
    1825 
    1826         ; Print dots with interval.
    1827         mov     cx,10
    1828     print_next_dot:
    1829         mov     al,'.'
    1830         call    VideoIO_PrintSingleChar
    1831         ; Value 30 is about 1.5 seconds
    1832         mov     al,1
    1833         call    TIMER_WaitTicCount
    1834         loop    print_next_dot
    1835         popa
     2175        ; Show dot's to indicate something is happening...
     2176        ;
     2177        call    VideoIO_ShowWaitDots
    18362178
    18372179    ;
     
    18422184
    18432185
    1844         ;
    1845         ; BYE BYE
     2186
     2187        ;
     2188        ; BYE BYE   (prepare some registers? look at other MBR-code)
    18462189        ;
    18472190        xor     ax, ax
     
    18552198
    18562199
    1857         ;
    1858         ; JUMP TO PBR loader
    1859         ;
     2200        ; ###############################
     2201        ; # JUMP TO THE PBR LOADER CODE #
     2202        ; ###############################
    18602203        IFDEF ReleaseCode
    18612204            db      0EAh
     
    18692212
    18702213
    1871 ;
    1872 ; THE FUNCTIONS HERE BELOW WERE INTRODUCED TO ENHANCE THE PBR PROCESSING,
    1873 ; BUT THEY ARE ACTUALLY OBSOLETE BECAUSE THE INFORMATION THEY PROVIDE CAN
    1874 ; ALSO BE OBTAINED FROM THE IPT. HOWEVER, THE IPT USES DIFFERENT IDENTIFIERS
    1875 ; FOR PARTICULAR FILE-SYSTEMS / PBR TYPES, LIKE JFS BEING REPRESENTED AS 0FCh.
    1876 ; POSSIBLY THE INFO IN THE IPT NEEDS TO BE EXPANDED TO DISTINGUISH BETWEEN
    1877 ; OTHER BOOT-RECORDS AND FILE-SYSTEMS TOO, LIKE VISTA/WIN7 BMGR AND GRUB, ETC.
    1878 ; THIS WOULD NEED TO BE DONE IN THE PARTSCAN ROUTINES.
    1879 ; SO, FOR NOW WE KEEP USING THE STUFF BELOW.
    1880 ;
     2214
     2215
     2216
    18812217
    18822218
     
    19642300; In
    19652301; --
    1966 ; DL    = Physical Disk
    1967 ; BX:CX = LBA sector
     2302; SI    = Pointer to IPT entry
    19682303;
    19692304; Out
     
    19712306; CY    = Set if HPFS partition, clear if not
    19722307;
    1973 PART_IsHPFS     Proc Near  Uses ax bx cx dx si di ds es
    1974 
    1975         ; Load specified LBA sector (BX:CX) from the disk in DL
    1976         mov     di,ds
    1977         mov     si,offset [TmpSector]
    1978         call    DriveIO_LoadSectorLBA
    1979 
    1980         ; Point to location of 'HPFS    ' identifier.
    1981         add     si,36h
    1982 
    1983         ; DL holds equality status
    1984         xor     dl,dl
    1985         cld
    1986 
    1987         ; Load letter into AL, xor with letter will result 0 if the same.
    1988         ; Then or to DL.
    1989         ; If at the end of the sequence DL is zero, the signature is present.
    1990         lodsb
    1991         xor     al,'H'
    1992         or      dl,al
    1993         lodsb
    1994         xor     al,'P'
    1995         or      dl,al
    1996         lodsb
    1997         xor     al,'F'
    1998         or      dl,al
    1999         lodsb
    2000         xor     al,'S'
    2001         or      dl,al
    2002         lodsb
    2003         xor     al,' '
    2004         or      dl,al
    2005         lodsb
    2006         xor     al,' '
    2007         or      dl,al
    2008         lodsb
    2009         xor     al,' '
    2010         or      dl,al
    2011         lodsb
    2012         xor     al,' '
    2013         or      dl,al
    2014 
    2015         ; Assume not present
    2016         clc
    2017         jnz     PART_IsHPFS_exit
    2018 
    2019         ; JFS signature found
    2020         stc
    2021 
     2308PART_IsHPFS     Proc Near  Uses ax
     2309        mov     al, [si+LocIPT_SystemID]    ; Get SystemID
     2310        cmp     al, 07h                     ; Compare with AiR-BOOT ID for HPFS
     2311        stc                                 ; Assume HPFS
     2312        je      PART_IsHPFS_exit            ; Yep
     2313        clc                                 ; Nope, clear CY
    20222314    PART_IsHPFS_exit:
    20232315        ret
     
    20322324; In
    20332325; --
    2034 ; DL    = Physical Disk
    2035 ; BX:CX = LBA sector
     2326; SI    = Pointer to IPT entry
    20362327;
    20372328; Out
     
    20392330; CY    = Set if JFS partition, clear if not
    20402331;
    2041 PART_IsJFS      Proc Near  Uses ax bx cx dx si di ds es
    2042 
    2043         ; Load specified LBA sector (BX:CX) from the disk in DL
    2044         mov     di,ds
    2045         mov     si,offset [TmpSector]
    2046         call    DriveIO_LoadSectorLBA
    2047 
    2048         ; Point to location of 'JFS     ' identifier.
    2049         add     si,36h
    2050 
    2051         ; DL holds equality status
    2052         xor     dl,dl
    2053         cld
    2054 
    2055         ; Load letter into AL, xor with letter will result 0 if the same.
    2056         ; Then or to DL.
    2057         ; If at the end of the sequence DL is zero, the signature is present.
    2058         lodsb
    2059         xor     al,'J'
    2060         or      dl,al
    2061         lodsb
    2062         xor     al,'F'
    2063         or      dl,al
    2064         lodsb
    2065         xor     al,'S'
    2066         or      dl,al
    2067         lodsb
    2068         xor     al,' '
    2069         or      dl,al
    2070         lodsb
    2071         xor     al,' '
    2072         or      dl,al
    2073         lodsb
    2074         xor     al,' '
    2075         or      dl,al
    2076         lodsb
    2077         xor     al,' '
    2078         or      dl,al
    2079         lodsb
    2080         xor     al,' '
    2081         or      dl,al
    2082 
    2083         ; Assume not present
    2084         clc
    2085         jnz     PART_IsJFS_exit
    2086 
    2087         ; JFS signature found
    2088         stc
    2089 
     2332PART_IsJFS      Proc Near  Uses ax
     2333        mov     al, [si+LocIPT_SystemID]    ; Get SystemID
     2334        cmp     al, 0fch                    ; Compare with AiR-BOOT ID for JFS
     2335        stc                                 ; Assume JFS
     2336        je      PART_IsJFS_exit             ; Yep
     2337        clc                                 ; Nope, clear CY
    20902338    PART_IsJFS_exit:
    20912339        ret
    20922340PART_IsJFS      Endp
    20932341
     2342
     2343
     2344;
     2345; #############################
     2346; # Is this an NTFS partition #
     2347; #############################
     2348;
     2349; In
     2350; --
     2351; SI    = Pointer to IPT entry
     2352;
     2353; Out
     2354; ---
     2355; CY    = Set if NTFS partition, clear if not
     2356;
     2357PART_IsNTFS     Proc Near  Uses ax
     2358        mov     al, [si+LocIPT_SystemID]    ; Get SystemID
     2359        cmp     al, 08h                     ; Compare with AiR-BOOT ID for NTFS
     2360        stc                                 ; Assume NTFS
     2361        je      PART_IsNTFS_exit            ; Yep
     2362        clc                                 ; Nope, clear CY
     2363    PART_IsNTFS_exit:
     2364        ret
     2365PART_IsNTFS     Endp
    20942366
    20952367
     
    21012373; In
    21022374; --
    2103 ; DL    = Physical Disk
    2104 ; BX:CX = LBA sector
     2375; SI    = Pointer to IPT entry
    21052376;
    21062377; Out
     
    21082379; CY    = Set if FAT12 or FAT16 partition, clear if not
    21092380;
    2110 ; This can be a FAT12 or FAT16 partition.
    2111 ; When OS/2 formats volume with FAT it does not use the FAT16 identifier,
    2112 ; but uses the FAT identifier.
    2113 ;
    2114 PART_IsFAT    Proc Near  Uses ax bx cx dx si di ds es
    2115 
    2116         ; First see if this is a FAT32 partition.
    2117         ; If it is, exit with NC indicating not FAT12 or FAT16.
    2118         call    PART_IsFAT32
    2119         cmc
    2120         jnc     PART_IsFAT_exit
    2121 
    2122         ; Load specified LBA sector (BX:CX) from the disk in DL
    2123         mov     di,ds
    2124         mov     si,offset [TmpSector]
    2125         call    DriveIO_LoadSectorLBA
    2126 
    2127         ; Point to location of 'FAT     ' identifier.
    2128         add     si,36h
    2129 
    2130         ; DL holds equality status
    2131         xor     dl,dl
    2132         cld
    2133 
    2134         ; Load letter into AL, xor with letter will result 0 if the same.
    2135         ; Then or to DL.
    2136         ; If at the end of the sequence DL is zero, the signature is present.
    2137         lodsb
    2138         xor     al,'F'
    2139         or      dl,al
    2140         lodsb
    2141         xor     al,'A'
    2142         or      dl,al
    2143         lodsb
    2144         xor     al,'T'
    2145         or      dl,al
    2146         lodsb
    2147 
    2148         ; Since OS/2 formats FAT volumes with an identifier of 'FAT     ',
    2149         ; and others with 'FAT16   ', we skip two bytes for comparison.
    2150         ; The rest must be spaces however.
    2151 ;        xor     al,' '
    2152 ;        or      dl,al
    2153         lodsb
    2154 ;        xor     al,' '
    2155 ;        or      dl,al
    2156 
    2157         lodsb
    2158         xor     al,' '
    2159         or      dl,al
    2160         lodsb
    2161         xor     al,' '
    2162         or      dl,al
    2163         lodsb
    2164         xor     al,' '
    2165         or      dl,al
    2166 
    2167         ; Assume not present
    2168         clc
    2169         jnz     PART_IsFAT_exit
    2170 
    2171         ; FAT signature found
     2381PART_IsFAT    Proc Near  Uses ax
     2382        mov     al, [si+LocIPT_SystemID]    ; Get SystemID
     2383        cmp     al, 04h                     ; Is FAT12 ?
    21722384        stc
    2173 
     2385        je      PART_IsFAT_exit             ; Yep
     2386        cmp     al, 06h                     ; Is FAT16 CHS ?
     2387        stc
     2388        je      PART_IsFAT_exit             ; Yep
     2389        cmp     al, 0eh                     ; Is FAT16 LBA ?
     2390        stc
     2391        je      PART_IsFAT_exit             ; Yep
     2392        clc                                 ; Nope
    21742393    PART_IsFAT_exit:
    21752394        ret
     
    21842403; In
    21852404; --
    2186 ; DL    = Physical Disk
    2187 ; BX:CX = LBA sector
     2405; SI    = Pointer to IPT entry
    21882406;
    21892407; Out
     
    21912409; CY    = Set if FAT32 partition, clear if not
    21922410;
    2193 PART_IsFAT32    Proc Near  Uses ax bx cx dx si di ds es
    2194 
    2195         ; Load specified LBA sector (BX:CX) from the disk in DL
    2196         mov     di,ds
    2197         mov     si,offset [TmpSector]
    2198         call    DriveIO_LoadSectorLBA
    2199 
    2200         ; Point to location of 'FAT32   ' identifier.
    2201         add     si,52h
    2202 
    2203         ; DL holds equality status
    2204         xor     dl,dl
    2205         cld
    2206 
    2207         ; Load letter into AL, xor with letter will result 0 if the same.
    2208         ; Then or to DL.
    2209         ; If at the end of the sequence DL is zero, the signature is present.
    2210         lodsb
    2211         xor     al,'F'
    2212         or      dl,al
    2213         lodsb
    2214         xor     al,'A'
    2215         or      dl,al
    2216         lodsb
    2217         xor     al,'T'
    2218         or      dl,al
    2219         lodsb
    2220         xor     al,'3'
    2221         or      dl,al
    2222         lodsb
    2223         xor     al,'2'
    2224         or      dl,al
    2225         lodsb
    2226         xor     al,' '
    2227         or      dl,al
    2228         lodsb
    2229         xor     al,' '
    2230         or      dl,al
    2231         lodsb
    2232         xor     al,' '
    2233         or      dl,al
    2234 
    2235         ; Assume not present
    2236         clc
    2237         jnz     PART_IsFAT32_exit
    2238 
    2239         ; FAT32 signature found
     2411PART_IsFAT32    Proc Near  Uses ax
     2412        mov     al, [si+LocIPT_SystemID]    ; Get SystemID
     2413        cmp     al, 0bh                     ; Is FAT32 CHS ?
    22402414        stc
    2241 
     2415        je      PART_IsFAT32_exit           ; Yep
     2416        cmp     al, 0ch                     ; Is FAT32 LBA ?
     2417        stc
     2418        je      PART_IsFAT32_exit           ; Yep
     2419        clc                                 ; Nope
    22422420    PART_IsFAT32_exit:
    22432421        ret
  • trunk/BOOTCODE/REGULAR/PARTSCAN.ASM

    r50 r51  
    2121
    2222
    23 IFDEF ModuleNames
     23IFDEF   MODULE_NAMES
    2424DB 'PARTSCAN',0
    2525ENDIF
     
    4848        mov     byte ptr [CurIO_Scanning], 0             ; Reset flag due scanning complete
    4949
    50 IFDEF   AUX_DEBUG
     50    IFDEF   AUX_DEBUG
    5151        ;~ pusha
    5252        ;~ call    DEBUG_DumpHidePartTables
    5353        ;~ popa
    54 ENDIF
     54    ENDIF
    5555        ; Use X-Reference to sync NewPartitionTable with Hide-Config
    5656        call    PARTSCAN_SyncHideConfigWithXref
    5757
    58 IFDEF   AUX_DEBUG
     58    IFDEF   AUX_DEBUG
    5959        ;~ pusha
    6060        ;~ call    DEBUG_DumpHidePartTables
    6161        ;~ popa
    62 ENDIF
     62    ENDIF
    6363
    6464        ; Now we copy the new IPT over the old one...
     
    128128        ret
    129129PARTSCAN_ScanForPartitions      EndP
     130
     131
     132
     133;
     134; This function reconnects a forced drive-letter with it's partition
     135; when partitions are removed.
     136;
     137PARTSCAN_UpdateDriveLetters     Proc
     138        pusha
     139        xor     bx,bx           ; index-pointer
     140        xor     cx,cx           ; counter
     141        xor     dx,dx           ; backup index-pointer
     142        mov     cl,LocIPT_MaxPartitions     ; nr of entries to process
     143        mov     si,offset [PartitionXref]   ; old-new relation table
     144        mov     di,offset [DriveLetters]    ; forced drive-letters table
     145
     146        ;
     147        ; Loop over each entry in the xref-table to see if the partition
     148        ; has been removed or has been given a new index in the IPT.
     149        ; A removed partition has 0ffh in it's slot and for a partition
     150        ; that has a new index in the IPT the value at the slot is different
     151        ; from the index of the slot in the xref-table.
     152        ;
     153    PARTSCAN_UpdateDriveLetters_next_entry:
     154        jcxz    PARTSCAN_UpdateDriveLetters_done
     155        dec     cl              ; decrement counter
     156        mov     al,[si+bx]      ; get possibly old index for this entry
     157        mov     dl,bl           ; save current index
     158        inc     bl              ; advance index-pointer
     159        inc     al              ; 0ffh will become 0, part removed so continue
     160        jz      PARTSCAN_UpdateDriveLetters_next_entry
     161
     162        ;
     163        ; If value in slot is the same as the index of the slot then
     164        ; the partition has not moved in the IPT.
     165        ;
     166        dec     al              ; restore possibly out-of-date index
     167        cmp     al,dl           ; same as array index? then ok, do next
     168        je      PARTSCAN_UpdateDriveLetters_next_entry
     169
     170;!
     171;! DEBUG_PROBE
     172;!
     173IFDEF   AUX_DEBUG
     174    push    1234h
     175    call    DEBUG_Probe
     176ENDIF
     177
     178        ;
     179        ; The partition has moved in the IPT so we lookup it's forced
     180        ; drive-letter at the old location and put it at the new one.
     181        ; The old location is identified by the index in the xref-table
     182        ; and the new location is identified by the value at that index.
     183        ; Thus, when no partitions have been deleted or added, the xref-table
     184        ; contains the sequence 0,1,2,3,...,n,0ffh,0ffh, etc.
     185        ; The value 0ffh means that no partition is using the slot.
     186        ;
     187        xor     ah,ah           ; no drive-letter
     188        dec     bl              ; backup index-pointer one position
     189        xchg    ah,[di+bx]      ; get drive-letter and store zero
     190        xchg    bl,al           ; use slot value as new index
     191        mov     [di+bx],ah      ; store drive-letter
     192        xchg    al,bl           ; restore index-pointer
     193        inc     bl              ; point to next entry
     194        jmp     PARTSCAN_UpdateDriveLetters_next_entry
     195    PARTSCAN_UpdateDriveLetters_done:
     196        popa
     197        ret
     198PARTSCAN_UpdateDriveLetters     EndP
     199
     200
     201
    130202
    131203; Scannt die Festplatte auf jegliche Partitionstabellen...
     
    270342        adc     bx, wptr [CurPartition_Location+2] ;  sectors
    271343
     344
     345
    272346        ; Sets up DS:SI - TmpSector
    273         call    DriveIO_LoadTmpSector         ; Loads Boot record                     ; Rousseau: LOAD PARTITION BOOT RECORD !!
     347        call    DriveIO_LoadTmpSector         ; Loads Boot record
    274348
    275349
  • trunk/BOOTCODE/REGULAR/PASSWORD.ASM

    r46 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'PASSWORD',0
    2424ENDIF
  • trunk/BOOTCODE/REGULAR/STD_TEXT.ASM

    r50 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'STD_TEXT',0
    2424ENDIF
     
    5050;
    5151Copyright:
    52              db ' AiR-BOOT v'
    53              db BLDLVL_MAJOR_VERSION,'.'
    54              db BLDLVL_MIDDLE_VERSION,'.'
    55              db BLDLVL_MINOR_VERSION,' - (c) '
    56              db BLDLVL_YEAR
    57              db ' M. Kiewitz  <<Internal Release 3e>> (bld: '
    58              ;~ db ' M. Kiewitz  <<Release Candidate 2>> (bld: '
    59              db BLDLVL_YEAR
    60              db BLDLVL_MONTH
    61              db BLDLVL_DAY,')'
    62              db 0
     52            db ' AiR-BOOT v'
     53            db BLDLVL_MAJOR_VERSION,'.'
     54            db BLDLVL_MIDDLE_VERSION,'.'
     55            db BLDLVL_MINOR_VERSION,' - (c) '
     56            db BLDLVL_YEAR
     57            ;~ db ' M. Kiewitz  <<Internal Release 3o>> (bld: '
     58            ;~ db ' M. Kiewitz  <<@ Interim Release @>> (bld: '
     59            ;~ db ' M. Kiewitz  <<Release Candidate 2>> (bld: '
     60            db ' M. Kiewitz  <<Release Candidate 3>> (bld: '
     61            db BLDLVL_YEAR
     62            db BLDLVL_MONTH
     63            db BLDLVL_DAY,')'
     64            db 0
     65
     66;
     67; Normal copyright notice.
     68;
     69;~ Copyright   db ' AiR-BOOT v1.0.8 - (c) 1998-2012 M. Kiewitz, Dedicated to Gerd Kiewitz', 0
    6370
    6471
    65 ;Copyright             db ' AiR-BOOT v1.0.8 - (c) 1998-2012 M. Kiewitz, Dedicated to Gerd Kiewitz', 0
    6672
    67 ; Message in case the user wants to edit the label of a type 0x35 partition
    68 TXT_SETUP_NoEditType35          db 'Labels of LVM-Data partitions cannot be changed.', 0
    69 ; Message in case the user wants to make a type 0x35 partition bootable
    70 TXT_SETUP_NoBootType35          db 'LVM-Data partitions cannot be set bootable.', 0
     73; License and source info.
     74BootEndMsg      db 'This is GPLv3+ software, please visit: http://www.gnu.org/licenses/gpl.txt', 0
     75BootEndMsg2     db 'To obtain the sources,   please visit: http://svn.netlabs.org/air-boot', 0
    7176
    72 ;TXT_ERROR_TooManyPartitions     db 'Too many partitions! -- Proper operation not guaranteed!', 0
    73 
    74 ; Rousseau: switch around
    75 BootEndMsg           db 'This is GPLv3+ software, please visit: http://www.gnu.org/licenses/gpl.txt', 0
    76 BootEndMsg2          db 'To obtain the sources,   please visit: http://svn.netlabs.org/air-boot', 0
    77 
    78 AuxInitMsg           db 'Initializing Serial Communications on COM',0
    79 
    80 CheckID_MBR          db 'AiRBOOT'
    81 BrokenHDD            db ' (HDDx)', 0
     77; Bugger...
     78CheckID_MBR     db 'AiRBOOT'
     79BrokenHDD       db ' (HDDx)', 0
    8280
    8381; Colors for special words hard-coded. Keep all 0s.
     
    8886                            db 'Contact via e-mail: ', 0, 'airboot@ecomstation.com', 0
    8987
     88; Table that points to BIOS device names.
     89ContinueBIOSbootTable   dw offset TXT_SETUP_MAGIC_CDROM
     90                        dw offset TXT_SETUP_MAGIC_Network
     91                        dw offset TXT_SETUP_MAGIC_ZIPLS
     92                        dw     0
     93
     94; Com-port debugging header.
     95AuxInitMsg              db 'Initializing Serial Communications on COM',0
     96
     97; LVM protection messages; should be translated and moved to lang-files.
     98TXT_SETUP_NoEditType35      db 'Labels of LVM-Data partitions cannot be changed', 0
     99TXT_SETUP_NoBootType35      db 'LVM-Data partitions cannot be set bootable', 0
     100TXT_BootMenuPowerOff        db 'DEL to Power Off', 0
     101TXT_NoINT13XSupport         db  'This BIOS does not support Extended INT13h Functions', 0
     102;~ TXT_ERROR_TooManyPartitions db 'Too many partitions! -- Proper operation not guaranteed!', 0
     103
     104; MBR protection; should also be translated and moved.
     105NonMBRwrite     db  'AiR-BOOT TRIED TO WRITE A non-MBR TO DISK !!',0
     106NonMBRwrite_rep db  'Please report this at airboot@ecomstation.com',0
     107SystemHalted    db  'System Halted',0
     108
    90109; Build Information string.
    91 build_info          db  'Build Date: ',0
    92 jwasm_txt           db  'JWasm',0
    93 masm_txt            db  'Masm',0
    94 wasm_txt            db  'Wasm',0
    95 tasm_txt            db  'Tasm',0
    96 unknown_txt         db  '????',0
     110build_info      db  'Build Date: ',0
     111jwasm_txt       db  'JWasm',0
     112masm_txt        db  'Masm',0
     113wasm_txt        db  'Wasm',0
     114tasm_txt        db  'Tasm',0
     115unknown_txt     db  '????',0
    97116
    98 ContinueBIOSbootTable dw offset TXT_SETUP_MAGIC_CDROM
    99                       dw offset TXT_SETUP_MAGIC_Network
    100                       dw offset TXT_SETUP_MAGIC_ZIPLS
    101                       dw     0
  • trunk/BOOTCODE/REGULAR/TIMER.ASM

    r30 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'TIMER',0
    2424ENDIF
  • trunk/BOOTCODE/REGULAR/VIDEOIO.ASM

    r46 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'VIDEOIO',0
    2424ENDIF
     
    126126;        In: SI - String to Print (EOS is 0)
    127127; Destroyed: SI
    128 VideoIO_Print                   Proc Near   Uses es di
     128VideoIO_Print                   Proc Near   Uses ax es di
    129129   call    VideoIO_Internal_SetRegs
    130130     VIOP_Loop:
     
    171171      mov     es:[di+1], ah
    172172      add     di, 2
    173       inc     TextPosX
     173      inc     [TextPosX]
    174174  dec      cl
    175175  jnz      VIOFP_Loop
     
    672672
    673673        ; Copy assembler specification.
    674 IFDEF       JWASM
     674    IFDEF       JWASM
    675675        mov     al,'['
    676676        stosb
    677677        mov     si,offset jwasm_txt
    678 ELSEIFDEF   TASM
     678    ELSEIFDEF   TASM
    679679        mov     al,' '
    680680        stosb
     
    683683        mov     si,offset tasm_txt
    684684
    685 ELSEIFDEF   WASM
     685    ELSEIFDEF   WASM
    686686        mov     al,' '
    687687        stosb
     
    689689        stosb
    690690        mov     si,offset wasm_txt
    691 ELSEIFDEF   MASM
     691    ELSEIFDEF   MASM
    692692        mov     al,' '
    693693        stosb
     
    695695        stosb
    696696        mov     si,offset masm_txt
    697 ELSE
     697    ELSE
    698698        mov     al,' '
    699699        stosb
     
    701701        stosb
    702702        mov     si,offset unknown_txt
    703 ENDIF
     703    ENDIF
     704
    704705    VideoIO_PrintBuildInfo_a1:
    705706        lodsb
     
    758759VideoIO_DumpDiskInfo    Proc Near uses ax bx cx dx
    759760
    760    VideoIO_DumpDiskInfo_next_disk:
    761       push     dx
    762       xor      ax,ax
    763       mov      al,[TextPosY]
    764       push     ax
    765 
    766       mov      ax,21
    767       mov      dh,dl
    768       and      dh,01111111b
    769       mul      dh
    770       mov      dh,al
    771 
    772       mov      [TextPosX],dh
    773 
    774       mov   si, offset Disk
    775       call  VideoIO_Print
    776       mov   al,dl
    777 
    778       ; NIET GOED, GAAT FOUT > 9, HEX PRINT GEBRUIKEN !!
    779       shr      al,4
    780       add      al,'0'
    781       call     VideoIO_PrintSingleChar
    782       mov      al,dl
    783       and      al,01111111b
    784       add      al,'0'
    785       call     VideoIO_PrintSingleChar
    786       mov      al,'h'
    787       call     VideoIO_PrintSingleChar
    788 
    789       inc      [TextPosY]
    790       mov      [TextPosX],dh
    791 
    792       mov      al,'-'
    793       mov      cl,17
    794       call     VideoIO_PrintSingleMultiChar
    795 
    796 ;      inc      [TextPosY]
    797 ;      mov      [TextPosX],dh
    798 ;      mov      si, offset BiosCyls
    799 ;      call     VideoIO_Print
    800 
    801 ;      push     dx
    802 ;      mov      bx,offset BIOS_Cyls
    803 ;      xor      dh,dh
    804 ;      and      dl,01111111b
    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       mov      si, offset BiosHeads
    816       call     VideoIO_Print
    817 
    818       push     dx
    819       mov      bx,offset BIOS_Heads
    820       xor      dh,dh
    821       and      dl,01111111b
    822       shl      dx,1
    823       shl      dx,1
    824       add      bx,dx
    825       mov      ax,[bx]
    826       mov      dx,[bx+02]
    827       call     VideoIO_PrintHexDWord
    828       pop      dx
    829 
    830       inc      [TextPosY]
    831       mov      [TextPosX],dh
    832       mov      si, offset BiosSecs
    833       call     VideoIO_Print
    834 
    835       push     dx
    836       mov      bx,offset BIOS_Secs
    837       xor      dh,dh
    838       and      dl,01111111b
    839       shl      dx,1
    840       shl      dx,1
    841       add      bx,dx
    842       mov      ax,[bx]
    843       mov      dx,[bx+02]
    844       call     VideoIO_PrintHexDWord
    845       pop      dx
    846 
    847       inc      [TextPosY]
    848       mov      [TextPosX],dh
    849       mov      si, offset LvmSecs
    850       call     VideoIO_Print
    851 
    852       push     dx
    853       ; Offset of array containing LVM SPT values for each disk found
    854       mov      bx,offset TrueSecs
    855       ; DX to index
    856       xor      dh,dh
    857       and      dl,01111111b
    858       shl      dx,1
    859       shl      dx,1
    860       add      bx,dx
    861       ; Get LVM SPT
    862       mov      ax,[bx]
    863       mov      dx,[bx+02]
    864       call     VideoIO_PrintHexDWord
    865       pop      dx
    866 
    867       inc      [TextPosY]
    868       mov      [TextPosX],dh
    869       mov      si, offset BiosLBA
    870       call     VideoIO_Print
    871 
    872       push     dx
    873       mov      bx,offset BIOS_TotalSecs
    874       xor      dh,dh
    875       and      dl,01111111b
    876       shl      dx,1
    877       shl      dx,1
    878       shl      dx,1
    879       add      bx,dx
    880       mov      ax,[bx]
    881       mov      dx,[bx+02]
    882       call     VideoIO_PrintHexDWord
    883       pop      dx
    884 
    885       inc      [TextPosY]
    886       mov      [TextPosX],dh
    887 
    888       pop      ax
    889       mov      [TextPosY],al
    890       pop      dx
    891 
    892       inc      dl
    893       mov      al,dl
    894       and      al,01111111b
    895       cmp      al,[TotalHarddiscs]
    896       jae      VideoIO_DumpDiskInfo_end
    897       jmp      VideoIO_DumpDiskInfo_next_disk
    898 
    899    VideoIO_DumpDiskInfo_end:
    900       mov      [TextPosX],0
    901       add      [TextPosY],6
    902       ret
     761    VideoIO_DumpDiskInfo_next_disk:
     762        push    dx
     763        xor     ax,ax
     764        mov     al,[TextPosY]
     765        push    ax
     766
     767        mov     ax,21
     768        mov     dh,dl
     769        and     dh,01111111b
     770        mul     dh
     771        mov     dh,al
     772
     773        mov     [TextPosX],dh
     774
     775        mov     si, offset [Disk]
     776        call    VideoIO_Print
     777        mov     al,dl
     778
     779        ; NIET GOED, GAAT FOUT > 9, HEX PRINT GEBRUIKEN !!
     780        shr     al,4
     781        add     al,'0'
     782        call    VideoIO_PrintSingleChar
     783        mov     al,dl
     784        and     al,01111111b
     785        add     al,'0'
     786        call    VideoIO_PrintSingleChar
     787        mov     al,'h'
     788        call    VideoIO_PrintSingleChar
     789
     790        inc     [TextPosY]
     791        mov     [TextPosX],dh
     792
     793        mov     al,'-'
     794        mov     cl,17
     795        call    VideoIO_PrintSingleMultiChar
     796
     797        ;~ inc     [TextPosY]
     798        ;~ mov     [TextPosX],dh
     799        ;~ mov     si, offset BiosCyls
     800        ;~ call    VideoIO_Print
     801
     802        ;~ push    dx
     803        ;~ mov     bx,offset BIOS_Cyls
     804        ;~ xor     dh,dh
     805        ;~ and     dl,01111111b
     806        ;~ shl     dx,1
     807        ;~ shl     dx,1
     808        ;~ add     bx,dx
     809        ;~ mov     ax,[bx]
     810        ;~ mov     dx,[bx+02]
     811        ;~ call    VideoIO_PrintHexDWord
     812        ;~ pop     dx
     813
     814        inc     [TextPosY]
     815        mov     [TextPosX],dh
     816        mov     si, offset BiosHeads
     817        call    VideoIO_Print
     818
     819        push    dx
     820        mov     bx,offset BIOS_Heads
     821        xor     dh,dh
     822        and     dl,01111111b
     823        shl     dx,1
     824        shl     dx,1
     825        add     bx,dx
     826        mov     ax,[bx]
     827        mov     dx,[bx+02]
     828        call    VideoIO_PrintHexDWord
     829        pop     dx
     830
     831        inc     [TextPosY]
     832        mov     [TextPosX],dh
     833        mov     si, offset BiosSecs
     834        call    VideoIO_Print
     835
     836        push    dx
     837        mov     bx,offset BIOS_Secs
     838        xor     dh,dh
     839        and     dl,01111111b
     840        shl     dx,1
     841        shl     dx,1
     842        add     bx,dx
     843        mov     ax,[bx]
     844        mov     dx,[bx+02]
     845        call    VideoIO_PrintHexDWord
     846        pop     dx
     847
     848        inc     [TextPosY]
     849        mov     [TextPosX],dh
     850        mov     si, offset LvmSecs
     851        call    VideoIO_Print
     852
     853        push    dx
     854        ; Offset of array containing LVM SPT values for each disk found
     855        mov     bx,offset TrueSecs
     856        ; DX to index
     857        xor     dh,dh
     858        and     dl,01111111b
     859        shl     dx,1
     860        shl     dx,1
     861        add     bx,dx
     862        ; Get LVM SPT
     863        mov     ax,[bx]
     864        mov     dx,[bx+02]
     865        call    VideoIO_PrintHexDWord
     866        pop     dx
     867
     868        inc     [TextPosY]
     869        mov     [TextPosX],dh
     870        mov     si, offset BiosLBA
     871        call    VideoIO_Print
     872
     873        push    dx
     874        mov     bx,offset BIOS_TotalSecs
     875        xor     dh,dh
     876        and     dl,01111111b
     877        shl     dx,1
     878        shl     dx,1
     879        shl     dx,1
     880        add     bx,dx
     881        mov     ax,[bx]
     882        mov     dx,[bx+02]
     883        call    VideoIO_PrintHexDWord
     884        pop     dx
     885
     886        inc     [TextPosY]
     887        mov     [TextPosX],dh
     888
     889        pop     ax
     890        mov     [TextPosY],al
     891        pop     dx
     892
     893        inc     dl
     894        mov     al,dl
     895        and     al,01111111b
     896        cmp     al,[TotalHarddiscs]
     897        jae     VideoIO_DumpDiskInfo_end
     898        jmp     VideoIO_DumpDiskInfo_next_disk
     899
     900    VideoIO_DumpDiskInfo_end:
     901        mov     [TextPosX],0
     902        add     [TextPosY],6
     903        ret
    903904VideoIO_DumpDiskInfo    EndP
     905
     906
     907;
     908; Set position to teletype cursor
     909;
     910VideoIO_ShowWaitDots    Proc
     911        pusha
     912        ; Color white on black
     913        mov     ch,7
     914        mov     cl,0
     915        call    VideoIO_Color
     916        ; Locate cursor for output of debug-info
     917        mov     ch,8
     918        mov     cl,1
     919        call    VideoIO_Locate
     920
     921        ; Print dots with interval.
     922        mov     cx,10
     923    VideoIO_ShowWaitDots_next_dot:
     924        mov     al,'.'
     925        call    VideoIO_PrintSingleChar
     926        ; Value 30 is about 1.5 seconds
     927        mov     al,1
     928        call    TIMER_WaitTicCount
     929        loop    VideoIO_ShowWaitDots_next_dot
     930        popa
     931        ret
     932VideoIO_ShowWaitDots    EndP
    904933
    905934
     
    927956Yes               db "YES",0
    928957No                db "NO",0
    929 On                db "ON",0
    930 Off               db "OFF",0
    931 None              db "NONE",0
    932 Active            db "ACTIVE",0
     958;~ On                db "ON",0
     959;~ Off               db "OFF",0
     960;~ None              db "NONE",0
     961;~ Active            db "ACTIVE",0
    933962NotActive         db "NOT ACTIVE",0
    934963
  • trunk/BOOTCODE/SETUP/MAIN.ASM

    r46 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'MAIN',0
    2424ENDIF
     
    7171SETUP_CheckEnterSETUP           Proc Near
    7272
    73 
    74 
    7573   ; Rousseau: added
    7674   ;mov     SETUP_ExitEvent, 0
     
    108106   call    PART_CalculateStraightPartPointers
    109107
    110    call    FX_StartScreen                 ; Start of new screen...
     108    IFDEF   FX_ENABLED
     109        call    FX_StartScreen                 ; Start of new screen...
     110    ENDIF
     111
    111112   call    SETUP_DrawMenuBase
    112113   mov     bp, offset SETUP_MainMenu
     
    131132   cmp     ax, offset TXT_SETUPHELP_Main ; ask only in main-menu...
    132133   jne     SMT_NotMainMenu
    133    call    FX_EndScreenLeft              ; Do FX, if requested...
     134
     135    IFDEF   FX_ENABLED
     136        call    FX_EndScreenLeft              ; Do FX, if requested...
     137    ENDIF
     138
    134139   test    byte ptr [CFG_PasswordSetup], 1
    135140   jz      SMT_NotMainMenu
     
    147152         int     16h
    148153      pop     dx
     154
     155;!
     156;! DEBUG_PROBE
     157;!
     158IFDEF   AUX_DEBUGx
     159    push    1234h
     160    call    DEBUG_Probe
     161    call    DEBUG_DumpIPT
     162    call    DEBUG_DumpRegisters
     163ENDIF
     164
     165
     166
    149167      cmp     ah, Keys_Up
    150168      je      SMT_KeyUp
     
    280298
    281299  SMT_SaveAndExitNOW:                    ; Direct HackIn
     300
     301;!
     302;! DEBUG_PROBE
     303;!
     304IFDEF   AUX_DEBUGx
     305    push    1235h
     306    call    DEBUG_Probe
     307ENDIF
     308
    282309   mov     ax, offset SETUP_EnterMenu_SaveAndExitSetup
    283310   jmp     SMT_DirectExecute
    284311
    285312  SMT_ExitWithoutSaving:                 ; Direct HackIn
     313;!
     314;! DEBUG_PROBE
     315;!
     316IFDEF   AUX_DEBUGx
     317    push    1236h
     318    call    DEBUG_Probe
     319ENDIF
     320
    286321   mov     ax, offset SETUP_EnterMenu_ExitWithoutSaving
    287322   jmp     SMT_DirectExecute
     
    389424   call    VideoIO_Print                 ; ...and print it.
    390425  SDIOS_Name_NoItemName:
    391    mov     wptr TextColorFore, dx
     426   mov     word ptr [TextColorFore], dx
    392427   ret
    393428
     
    586621   call    VideoIO_Color
    587622   call    VideoIO_Print                 ; white - 'contact via e-mail'...
    588    mov     cx, 0800h
     623   mov     cx, 0700h
    589624   call    VideoIO_Color
    590625   call    VideoIO_Print                 ; and finally the e-mail adress
     
    11511186SETUPMAGIC_InternalCopyTillNUL  Proc Near Uses ax cx
    11521187  SMICTN_Loop:
     1188
     1189    ;!
     1190    ;! DEBUG_PROBE
     1191    ;!
     1192    IFDEF   AUX_DEBUGx
     1193        push    1239h
     1194        call    DEBUG_Probe
     1195        call    DEBUG_DumpRegisters
     1196        call    DEBUG_DumpIPT
     1197    ENDIF
     1198
    11531199      lodsb
    11541200      stosb
     
    11731219; Cur Value in DL, Maximum Value in DH. Add/Sub in CL
    11741220SETUPMAGIC_InternalCheckUp      Proc Near
     1221;!
     1222;! DEBUG_PROBE
     1223;!
     1224IFDEF   AUX_DEBUGx
     1225    push    1238h
     1226    call    DEBUG_Probe
     1227    call    DEBUG_DumpRegisters
     1228ENDIF
     1229
    11751230   or      cl, cl                        ; CL==0?    -> Decrease
    11761231   jz      SMICU_Substract               ; otherwise -> Increase
     
    15791634
    15801635SETUPMAGIC_ChangeBIOSbootSeq    Proc Near   Uses ax bx cx dx si di
     1636;!
     1637;! DEBUG_PROBE
     1638;!
     1639IFDEF   AUX_DEBUGx
     1640    push    1237h
     1641    call    DEBUG_Probe
     1642    call    DEBUG_DumpRegisters
     1643ENDIF
     1644
    15811645   mov     di, si
    15821646   mov     dl, ds:[bx]                   ; Cur Timed-Key-Handling
     
    16021666
    16031667   shl     bx, 1
    1604    mov     si, wptr [ContinueBIOSbootTable+bx]
     1668   mov     si, word ptr [ContinueBIOSbootTable+bx]
    16051669  SMCBBS_CopyThiz:
    16061670   add     di, LocMENU_ItemPack          ; DI points to ItemPack...
  • trunk/BOOTCODE/SETUP/MENUS.ASM

    r50 r51  
    5555;
    5656
    57 IFDEF ModuleNames
     57IFDEF   MODULE_NAMES
    5858DB 'MENUS',0
    5959ENDIF
     
    8585                dw      offset SETUP_EnterMenu_ExtendedOptions, 0
    8686                dw      offset TXT_SETUP_ExtOptions, offset TXT_SETUPHELP_ExtOptions
     87
    8788                ; The Menu-Items of the right side start here...
    8889                dw      offset SETUP_EnterMenu_DefineMasterPassword, 0
     
    132133                dw      offset TXT_SETUP_IncludeFloppy, offset TXT_SETUPHELP_IncludeFloppy
    133134                dw      6 dup (0)
    134                 dw      0, 0
    135                 dw      0, 0
     135
     136                ; Show LVM Drive Letters or not
     137                dw      offset SETUPMAGIC_EnableDisable, offset CFG_MiscFlags
     138                dw      offset TXT_SETUP_ShowLVMDriveLetters, offset TXT_SETUPHELP_ShowLVMDriveLetters
     139                dw      6 dup (0)
     140
     141                ;~ dw      0, 0
     142                ;~ dw      0, 0
     143
     144
    136145                dw      offset SETUPMAGIC_EnableDisable, offset CFG_ProtectMBR
    137146                dw      offset TXT_SETUP_MbrProtection, offset TXT_SETUPHELP_MbrProtection
  • trunk/BOOTCODE/SETUP/PART_SET.ASM

    r49 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'PART_SET',0
    2424ENDIF
     
    4141         int     16h
    4242      pop     dx
     43
     44        ;
     45        ; INSERT DEBUG KEYHANDLER HERE ?
     46        ;
     47
    4348      cmp     ah, Keys_Up
    4449      je      PSM_KeyUp
     
    143148   mov     [si+LocIPT_Flags], al
    144149   xor     ax, ax
    145    mov     wptr [si+LocIPT_BootRecordCRC], ax
     150   mov     word ptr [si+LocIPT_BootRecordCRC], ax
    146151   call    PARTSETUP_DrawPartitionInfo
    147152   call    PARTSETUP_BuildChoiceBar
  • trunk/BOOTCODE/SPECIAL/APM.ASM

    r30 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'APM',0
    2424ENDIF
  • trunk/BOOTCODE/SPECIAL/CHARSET.ASM

    r45 r51  
    6262      jmp    DecodeLoop
    6363  DecodeDone:
    64    call   FX_WaitRetrace                 ; Wait for retrace to reduce flickering
     64    IFDEF   FX_ENABLED
     65        call   FX_WaitRetrace                 ; Wait for retrace to reduce flickering
     66    ENDIF
    6567   mov    ax, 1110h
    6668   mov    bh, 16
  • trunk/BOOTCODE/SPECIAL/F00K/BILLSUXX.ASM

    r46 r51  
    2828;  on the partition's P-flag including the overall M$hack-Enable Flag.
    2929
    30 IFDEF ModuleNames
     30IFDEF   MODULE_NAMES
    3131DB 'BILLSUXX',0
    3232ENDIF
  • trunk/BOOTCODE/SPECIAL/FAT16.ASM

    r46 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'FAT16',0
    2424ENDIF
  • trunk/BOOTCODE/SPECIAL/FX.ASM

    r46 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'FX',0
    2424ENDIF
  • trunk/BOOTCODE/SPECIAL/FXTABLES.ASM

    r30 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'FXTABLES',0
    2424ENDIF
  • trunk/BOOTCODE/SPECIAL/LINUX.ASM

    r40 r51  
    4444;  have done it as well as fat16.asm.
    4545
    46 IFDEF ModuleNames
     46IFDEF   MODULE_NAMES
    4747DB 'LINUX',0
    4848ENDIF
  • trunk/BOOTCODE/SPECIAL/LVM.ASM

    r50 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'LVM',0
    2424ENDIF
    2525
    2626LVM_InitCRCTable                Proc Near
    27    ; Initializes our LVM-CRC-Table
    28    xor    cl, cl
    29    mov    di, offset LVM_CRCTable
    30   LVM_ICRCT_Loop:
    31       ;movzx  ax, cl
    32       mov   al,cl
    33       mov   ah,0
    34 
    35       xor    dx, dx                      ; DX:AX - CRC-Value
    36       mov    ch, 8
    37      LVM_ICRCT_Loop2:
    38          shr    dx, 1
    39          rcr    ax, 1                    ; Shift value 1 to the right
    40          jnc    LVM_ICRCT_NoXOR
    41          xor    dx, 0EDB8h
    42          xor    ax, 8320h
    43         LVM_ICRCT_NoXOR:
    44       dec    ch
    45       jnz    LVM_ICRCT_Loop2
    46       mov    wptr [di+0], ax
    47       mov    wptr [di+2], dx
    48       add    di, 4
    49    add    cl, 1
    50    jnc    LVM_ICRCT_Loop
    51    ret
     27        ; Initializes our LVM-CRC-Table
     28        xor     cl, cl
     29        mov     di, offset [LVM_CRCTable]
     30    LVM_ICRCT_Loop:
     31        ;movzx  ax, cl
     32        mov     al,cl
     33        mov     ah,0
     34        xor     dx, dx                      ; DX:AX - CRC-Value
     35        mov     ch, 8
     36    LVM_ICRCT_Loop2:
     37        shr     dx, 1
     38        rcr     ax, 1                    ; Shift value 1 to the right
     39        jnc     LVM_ICRCT_NoXOR
     40        xor     dx, 0EDB8h
     41        xor     ax, 8320h
     42    LVM_ICRCT_NoXOR:
     43        dec     ch
     44        jnz     LVM_ICRCT_Loop2
     45        mov     wptr [di+0], ax
     46        mov     wptr [di+2], dx
     47        add     di, 4
     48        add     cl, 1
     49        jnc     LVM_ICRCT_Loop
     50        ret
    5251LVM_InitCRCTable                EndP
    5352
     
    5756; Destroyed: None
    5857LVM_GetSectorCRC                Proc Near   Uses bx cx
    59    push   wptr [si+LocLVM_CRC]
    60    push   wptr [si+LocLVM_CRC+2]
    61    push   si
    62       mov    wptr [si+LocLVM_CRC], 0
    63       mov    wptr [si+LocLVM_CRC+2], 0
    64       mov    ax, -1
    65       mov    dx, -1
    66       mov    cx, 512
    67      LVM_GSCRC_Loop:
    68          xor    bh, bh
    69          mov    bl, al                      ; Save last byte to BL
    70          mov    al, ah
    71          mov    ah, dl
    72          mov    dl, dh
    73          xor    dh, dh                      ; SHR DX:AX, 8
    74          xor    bl, [si]
    75          inc    si                          ; XOR last byte with [data]
    76          shl    bx, 1
    77          shl    bx, 1
    78          xor    ax, wptr [LVM_CRCTable+bx+0]
    79          xor    dx, wptr [LVM_CRCTable+bx+2] ; XOR with CRC-Table
    80       loop   LVM_GSCRC_Loop
    81    pop    si
    82    pop    wptr [si+LocLVM_CRC+2]
    83    pop    wptr [si+LocLVM_CRC]
    84    ret
     58        push    word ptr [si+LocLVM_CRC+00]
     59        push    word ptr [si+LocLVM_CRC+02]
     60        push    si
     61        mov     word ptr [si+LocLVM_CRC], 0
     62        mov     word ptr [si+LocLVM_CRC+2], 0
     63        mov     ax, -1
     64        mov     dx, -1
     65        mov     cx, 512
     66    LVM_GSCRC_Loop:
     67        xor     bh, bh
     68        mov     bl, al                      ; Save last byte to BL
     69        mov     al, ah
     70        mov     ah, dl
     71        mov     dl, dh
     72        xor     dh, dh                      ; SHR DX:AX, 8
     73        xor     bl, [si]
     74        inc     si                          ; XOR last byte with [data]
     75        shl     bx, 1
     76        shl     bx, 1
     77        xor     ax, word ptr [LVM_CRCTable+bx+0]
     78        xor     dx, word ptr [LVM_CRCTable+bx+2] ; XOR with CRC-Table
     79        loop    LVM_GSCRC_Loop
     80        pop     si
     81        pop     word ptr [si+LocLVM_CRC+2]
     82        pop     word ptr [si+LocLVM_CRC]
     83        ret
    8584LVM_GetSectorCRC                EndP
    8685
     
    9190; Destroyed: None
    9291LVM_CheckSectorSignature        Proc Near
    93    test    byte ptr [CFG_IgnoreLVM], 1            ; We are supposed to ignore LVM, so
    94    jnz     LVMCSS_InvalidSignature       ;  any sector is bad!
    95    cmp     word ptr [si+LocLVM_SignatureStart], 5202h                                ; Rousseau: identify LVM sector
    96    jne     LVMCSS_InvalidSignature
    97    cmp     word ptr [si+LocLVM_SignatureStart+2], 'BM'
    98    jne     LVMCSS_InvalidSignature
    99    cmp     word ptr [si+LocLVM_SignatureStart+4], 'MP'
    100    jne     LVMCSS_InvalidSignature
    101    cmp     word ptr [si+LocLVM_SignatureStart+6], 'DF'
    102    jne     LVMCSS_InvalidSignature
    103    stc
    104    ret
    105   LVMCSS_InvalidSignature:
    106    clc
    107    ret
     92        test    byte ptr [CFG_IgnoreLVM], 1 ; We are supposed to ignore LVM, so
     93        jnz     LVMCSS_InvalidSignature     ;  any sector is bad!
     94        cmp     word ptr [si+LocLVM_SignatureStart], 5202h
     95        jne     LVMCSS_InvalidSignature
     96        cmp     word ptr [si+LocLVM_SignatureStart+2], 'BM'
     97        jne     LVMCSS_InvalidSignature
     98        cmp     word ptr [si+LocLVM_SignatureStart+4], 'MP'
     99        jne     LVMCSS_InvalidSignature
     100        cmp     word ptr [si+LocLVM_SignatureStart+6], 'DF'
     101        jne     LVMCSS_InvalidSignature
     102        stc
     103        ret
     104    LVMCSS_InvalidSignature:
     105        clc
     106        ret
    108107LVM_CheckSectorSignature        EndP
    109108
     
    114113; Destroyed: None
    115114LVM_CheckSectorCRC              Proc Near   Uses ax dx
    116    call    LVM_GetSectorCRC
    117    cmp     ax, word ptr [si+LocLVM_CRC]
    118    jne     LVMCSCRC_BadCRC
    119    cmp     dx, word ptr [si+LocLVM_CRC+2]
    120    jne     LVMCSCRC_BadCRC
    121    stc
    122    ret
    123   LVMCSCRC_BadCRC:
    124    clc
    125    ret
     115        call    LVM_GetSectorCRC
     116        cmp     ax, word ptr [si+LocLVM_CRC]
     117        jne     LVMCSCRC_BadCRC
     118        cmp     dx, word ptr [si+LocLVM_CRC+2]
     119        jne     LVMCSCRC_BadCRC
     120        stc
     121        ret
     122    LVMCSCRC_BadCRC:
     123        clc
     124        ret
    126125LVM_CheckSectorCRC              EndP
    127126
     
    132131; Destroyed: None
    133132LVM_UpdateSectorCRC            Proc Near   Uses ax dx
    134    call    LVM_GetSectorCRC
    135    mov     word ptr [si+LocLVM_CRC], ax
    136    mov     word ptr [si+LocLVM_CRC+2], dx
    137    ret
     133        call    LVM_GetSectorCRC
     134        mov     word ptr [si+LocLVM_CRC], ax
     135        mov     word ptr [si+LocLVM_CRC+2], dx
     136        ret
    138137LVM_UpdateSectorCRC            EndP
    139138
     
    146145; Destroyed: None
    147146LVM_SearchForPartition          Proc Near   Uses cx
    148    cmp     bptr [si+LocLVM_SignatureStart], LocLVM_SignatureByte0
    149    jne     LVMSFP_NotFound               ; Quick Check, if LVM sector there
    150    add     si, LocLVM_StartOfEntries
    151    mov     cl, LocLVM_MaxEntries
    152   LVMSFP_Loop:
    153       cmp     ax, [si+LocLVM_PartitionStart]
    154       jne     LVMSFP_NextEntry
    155       cmp     dx, [si+LocLVM_PartitionStart+2]
    156       je      LVMSFP_FoundIt
    157      LVMSFP_NextEntry:
    158       add     si, LocLVM_LenOfEntry
    159    dec     cl
    160    jnz     LVMSFP_Loop
    161   LVMSFP_NotFound:
    162    clc
    163    ret
    164   LVMSFP_FoundIt:
    165    stc
    166    ret
     147        cmp     byte ptr [si+LocLVM_SignatureStart], LocLVM_SignatureByte0
     148        jne     LVMSFP_NotFound               ; Quick Check, if LVM sector there
     149        add     si, LocLVM_StartOfEntries
     150        mov     cl, LocLVM_MaxEntries
     151    LVMSFP_Loop:
     152        cmp     ax, [si+LocLVM_PartitionStart]
     153        jne     LVMSFP_NextEntry
     154        cmp     dx, [si+LocLVM_PartitionStart+2]
     155        je      LVMSFP_FoundIt
     156    LVMSFP_NextEntry:
     157        add     si, LocLVM_LenOfEntry
     158        dec     cl
     159        jnz     LVMSFP_Loop
     160    LVMSFP_NotFound:
     161        clc
     162        ret
     163    LVMSFP_FoundIt:
     164        stc
     165        ret
    167166LVM_SearchForPartition          EndP
    168167
     
    171170;        In: BX:CX - LBA starting sector of partition to be searched
    172171;            DL = Physical Disk in BIOS notation. (80h+)
    173 ;       Out: Carry set, if LVM-info found
    174 ;            AL - drive-letter from LVM-info
    175 
     172;       Out: CY=1 if LVM-info found, 0 if no LVM-info.
     173;            AL - drive-letter from LVM-info or zero if no drive-letter
     174;            assigned or no LVM-info.
    176175LVM_GetDriveLetter      Proc Near   Uses bx cx dx si di ds es
    177176        ; For primary partitions this information is stored in the last
     
    222221        mov     si,offset [LVMSector]
    223222        mov     di,ds
    224         call    DriveIO_LoadSectorLBA
     223        call    DriveIO_LoadSectorLBA                                           ; Change this to normal IO-routine !!!!!!
    225224        pop     di
    226225        pop     si
     
    238237        jz      LVM_GetDriveLetter_is_not_pri
    239238
     239        ;
    240240        ; It's a PRI so we use the special locator function.
    241241        ; This locator takes care of extended eCS geometry should that be used
     242        ;
    242243        call    DriveIO_LoadMasterLVMSector
    243244
     
    261262        call    LVM_SearchForPartition
    262263        mov     bx,si   ; BX now points to LVM entry
    263         mov     dx,0    ; Setup null driveletter
     264        mov     dx,0
    264265        pop     si
    265266
    266         mov     al,0
     267        mov     al,0    ; Setup null driveletter
    267268        ; Oops, no valid LVM record was used so we have a null driveletter.
    268269        jnc     LVM_GetDriveLetter_null_lvm_dl
     
    273274        ;
    274275        mov     al,[bx+LocLVM_VolumeLetter]
    275         ; Clear CY if 0
     276        ; Test for zero dtive-letter.
    276277        test    al,al
     278        ; Preset CY in case drive-letter is zero.
    277279        clc
    278280        jz      LVM_GetDriveLetter_null_lvm_dl
     281
     282        ; We have a non-zero drive-letter, so set CY.
    279283        stc
    280284
     
    282286        ret
    283287LVM_GetDriveLetter      EndP
     288
     289
     290
     291; Sets a drive-letter in the LVM-info of a partition. (if it exists)
     292;        In: BX:CX - LBA starting sector of partition to be searched
     293;            DL = Physical Disk in BIOS notation. (80h+)
     294;            AL = DriveLetter to set (can be zero to hide partition from LVM)
     295;       Out: CY=1 if LVM-info found, 0 if no LVM-info.
     296LVM_SetDriveLetter      Proc Near   Uses bx cx dx si di ds es
     297        local   disk:byte
     298        local   drive_letter:byte
     299        local   pri_ind:byte
     300        local   lvm_log_high:word
     301        local   lvm_log_low:word
     302        ; For primary partitions this information is stored in the last
     303        ; sector of track0; for all four partition entries in case they
     304        ; they are all primary ones.
     305        ;
     306        ; LVM DLAT info for logical partitions is stored in the sector
     307        ; preceding the start of the partition.
     308        ;
     309        ; Because the LVM info of a logical partition is the easiest to find,
     310        ; we do that first. The LVM info for primary partitions is located
     311        ; dependent on the geometry in use, so we use a special locater
     312        ; call for that. Also, since the LVM info for primaries contains
     313        ; info on all 4 entries, we need the partition index to obtain the
     314        ; correct drive-letter.
     315        ;
     316
     317        mov     [disk], dl
     318
     319        ; Store the drive-letter for later use
     320        mov     [drive_letter], al
     321
     322
     323        ; See if this is a primary partition
     324        ; CY will be set if it is and AL will contain the 0-based
     325        ; index in the P-table.
     326        ; If it's a logical partition, CY will be clear and AL
     327        ; will be set to 0ffh indicating an invalid index.
     328        call    PART_IsPrimaryPartition
     329        mov     al,0
     330        rcl     al,1        ; CY if primary
     331        mov     dh,al       ; Save PRI or LOG
     332        mov     [pri_ind],al
     333
     334        ; Save PRI/LOG indicator for later use
     335        push    dx
     336
     337        ; Load *possible* LVM sector
     338        ; This load is only valid if the partition is logical, in which case
     339        ; the LVM sector is below the start of the partition.
     340        ; If primary, the LVM sector is at a location that
     341        ; DriveIO_LoadMasterLVMSector will find out.
     342
     343        ; Push LBA address
     344        push    bx
     345        push    cx
     346
     347        ; Adjust for logical LVM-sector
     348        sub     cx,1
     349        sbb     bx,0
     350
     351        ; Store LBA address of LVM-sector
     352        mov     [lvm_log_low],cx
     353        mov     [lvm_log_high],bx
     354
     355        ; Load the LVM sector
     356        push    si
     357        push    di
     358        mov     si,offset [LVMSector]
     359        mov     di,ds
     360        call    DriveIO_LoadSectorLBA                                           ; Change this to normal IO-routine !!!!!!
     361        pop     di
     362        pop     si
     363
     364        ; Restore LBA address
     365        pop     cx
     366        pop     bx
     367
     368        ; Restore PRI/LOG partition indicator in DH
     369        pop     dx
     370
     371        ; Test PRI or not
     372        test    dh,dh
     373        ; It's not a PRI so we can use the previously loaded LVM sector
     374        jz      LVM_SetDriveLetter_is_not_pri
     375
     376        ;
     377        ; It's a PRI so we use the special locator function.
     378        ; This locator takes care of extended eCS geometry should that be used
     379        ;
     380        call    DriveIO_LoadMasterLVMSector
     381        jnc     LVM_SetDriveLetter_null_lvm_dl
     382
     383        mov     ax, word ptr [MasterLVMLBA]                                         ; ARRAY VAN MAKEN !
     384        mov     [lvm_log_low], ax
     385        mov     [lvm_log_high], 0
     386
     387    LVM_SetDriveLetter_is_not_pri:
     388
     389        ;
     390        ; At this stage the LVM-info sector has been loaded at [LVMSector].
     391        ; From here we look for an LVM entry for the partition.
     392        ; If one is found, based on it's LBA-start, it's driveletter is used
     393        ; in case byte 25h in the BPB is zero.
     394        ;
     395
     396        ; Search for the partition in the LVM info.
     397        ; If found, CY is set and SI points to LVM entry.
     398        push    si
     399        mov     ax,cx
     400        mov     dx,bx
     401        mov     si,offset [LVMSector]
     402        call    LVM_SearchForPartition
     403        mov     bx,si   ; BX now points to LVM entry
     404        pop     si
     405
     406        mov     al,0    ; Setup null driveletter
     407        ; Oops, no valid LVM record was used so we have a null driveletter.
     408        jnc     LVM_SetDriveLetter_null_lvm_dl
     409
     410        ;
     411        ; At this point BX points to the LVM-entry related to the
     412        ; partition, whether it was a logical or a primary one.
     413        ;
     414        mov     al, [drive_letter]
     415        mov     [bx+LocLVM_VolumeLetter],al
     416
     417        mov     si, offset [LVMSector]
     418        call    LVM_UpdateSectorCRC
     419
     420        mov     dl, [disk]
     421        mov     bx, [lvm_log_high]
     422        mov     ax, [lvm_log_low]
     423
     424        call    DriveIO_SaveSector
     425
     426    LVM_SetDriveLetter_null_lvm_dl:
     427        ret
     428LVM_SetDriveLetter      EndP
     429
    284430
    285431
     
    290436; Destroyed: None
    291437LVM_RemoveVolLetterFromSector   Proc Near   Uses cx
    292    cmp     bptr [si+LocLVM_SignatureStart], LocLVM_SignatureByte0
    293    jne     LVMRVLFS_Done                 ; Quick Check, if LVM sector there
    294    push    si
    295       add     si, LocLVM_StartOfEntries
    296       mov     cl, LocLVM_MaxEntries
    297      LVMRVLFS_Loop:
    298          cmp     ch, [si+LocLVM_VolumeLetter]
    299          jne     LVMRVLFS_NextEntry
    300          ; Reset drive-letter, if matched
    301          mov     bptr [si+LocLVM_VolumeLetter], 0
    302         LVMRVLFS_NextEntry:
    303          add     si, LocLVM_LenOfEntry
    304       dec     cl
    305       jnz     LVMRVLFS_Loop
    306    pop     si
    307    call    LVM_UpdateSectorCRC
    308   LVMRVLFS_Done:
    309    ret
     438        cmp     bptr [si+LocLVM_SignatureStart], LocLVM_SignatureByte0
     439        jne     LVMRVLFS_Done                 ; Quick Check, if LVM sector there
     440        push    si
     441        add     si, LocLVM_StartOfEntries
     442        mov     cl, LocLVM_MaxEntries
     443    LVMRVLFS_Loop:
     444        cmp     ch, [si+LocLVM_VolumeLetter]
     445        jne     LVMRVLFS_NextEntry
     446        ; Reset drive-letter, if matched
     447        mov     bptr [si+LocLVM_VolumeLetter], 0          ; ASSIGN NEXT FREE HERE...  (DOET DUBBEL ALS ZELFDE DL ALS SYS)
     448    LVMRVLFS_NextEntry:
     449        add     si, LocLVM_LenOfEntry
     450        dec     cl
     451        jnz     LVMRVLFS_Loop
     452        pop     si
     453        call    LVM_UpdateSectorCRC
     454    LVMRVLFS_Done:
     455        ret
    310456LVM_RemoveVolLetterFromSector   EndP
    311457
     
    317463;       Out: None
    318464; Destroyed: AX
     465
    319466LVM_DoLetterReassignment        Proc Near   Uses bx cx dx si di
    320    mov     di, si                        ; Save SI in DI (Partition-pointer)
    321    mov     ch, al                        ; and AL in CH (drive-letter)
    322    xor     bx, bx
    323    mov     cl, CFG_Partitions
    324    or      cl, cl
    325    jz      LVMDLR_SkipRemove
    326 
    327   LVMDLR_RemoveLoop:
    328       cmp     bptr [PartitionVolumeLetters+bx], ch
    329       jne     LVMDLR_NextPartition
    330       ; One volume that has our wanted drive-letter, so remove it!
    331       mov     dl, bl
    332       call    PART_GetPartitionPointer   ; DL - partition -> SI
    333       ; Now set CurPartition_Location for the DriveIO-functions to work
    334       mov     ax, wptr [si+LocIPT_AbsolutePartTable]
    335       mov     wptr [CurPartition_Location+0], ax
    336       mov     ax, wptr [si+LocIPT_AbsolutePartTable+2]
    337       mov     wptr [CurPartition_Location+2], ax
    338       mov     ax, wptr [si+LocIPT_LocationPartTable+1]
    339       mov     wptr [CurPartition_Location+6], ax
    340       mov     ah, bptr [si+LocIPT_LocationPartTable+0]
    341       mov     al, [si+LocIPT_Drive]
    342       mov     wptr [CurPartition_Location+4], ax
    343       call    DriveIO_LoadLVMSector      ; SI points now to LVM-Sector
    344       call    LVM_RemoveVolLetterFromSector
    345       IFDEF ReleaseCode
    346          call    DriveIO_SaveLVMSector   ; Save sector
    347       ENDIF
    348      LVMDLR_NextPartition:
    349       inc     bx
    350    dec     cl
    351    jnz     LVMDLR_RemoveLoop
    352 
    353   LVMDLR_SkipRemove:
    354    ; Set CurPartition_Location information of destination partition
    355    mov     ax, wptr [di+LocIPT_AbsolutePartTable]
    356    mov     wptr [CurPartition_Location+0], ax
    357    mov     ax, wptr [di+LocIPT_AbsolutePartTable+2]
    358    mov     wptr [CurPartition_Location+2], ax
    359    mov     ah, bptr [di+LocIPT_LocationPartTable+0]
    360    mov     al, [di+LocIPT_Drive]
    361    mov     wptr [CurPartition_Location+4], ax
    362    mov     ax, wptr [di+LocIPT_LocationPartTable+1]
    363    mov     wptr [CurPartition_Location+6], ax
    364    call    DriveIO_LoadLVMSector         ; SI points now to LVM-Sector
    365    mov     ax, wptr [di+LocIPT_AbsoluteBegin]
    366    mov     dx, wptr [di+LocIPT_AbsoluteBegin+2]
    367    mov     di, si                        ; Save SI in DI
    368    call    LVM_SearchForPartition
    369    jnc     LVMDLR_DestPartNotFound
    370    ; Set new volume letter
    371    mov     bptr [si+LocLVM_VolumeLetter], ch
    372    mov     si, di                        ; SI - LVM Sector again
    373    call    LVM_UpdateSectorCRC           ; Update LVM-CRC now
    374    IFDEF ReleaseCode
    375       call    DriveIO_SaveLVMSector      ; Save sector
    376    ENDIF
    377   LVMDLR_DestPartNotFound:
    378    ; This here is done for safety, because we misuse CurPartition_Location
    379    xor     ax, ax
    380    mov     di, offset CurPartition_Location
    381    mov     cx, 4
    382    rep     stosw                         ; NUL out CurPartition_Location
    383    ret
     467
     468    IFDEF   AUX_DEBUG
     469        pusha
     470        mov     si, offset dlra
     471        call    AuxIO_Print
     472        call    AuxIO_Teletype
     473        call    AuxIO_TeletypeNL
     474        popa
     475    ENDIF
     476
     477        mov     di, si              ; Save SI in DI (Partition-pointer)
     478        mov     ch, al              ; and AL in CH (drive-letter)
     479        xor     bx, bx
     480        mov     cl, CFG_Partitions
     481        or      cl, cl
     482        jz      LVMDLR_SkipRemove
     483
     484    LVMDLR_RemoveLoop:
     485        cmp     bptr [PartitionVolumeLetters+bx], ch
     486        jne     LVMDLR_NextPartition
     487        ; One volume that has our wanted drive-letter, so remove it!
     488        mov     dl, bl
     489        call    PART_GetPartitionPointer   ; DL - partition -> SI
     490        ; Now set CurPartition_Location for the DriveIO-functions to work
     491        mov     ax, wptr [si+LocIPT_AbsolutePartTable]
     492        mov     wptr [CurPartition_Location+0], ax
     493        mov     ax, wptr [si+LocIPT_AbsolutePartTable+2]
     494        mov     wptr [CurPartition_Location+2], ax
     495        mov     ax, wptr [si+LocIPT_LocationPartTable+1]
     496        mov     wptr [CurPartition_Location+6], ax
     497        mov     ah, bptr [si+LocIPT_LocationPartTable+0]
     498        mov     al, [si+LocIPT_Drive]
     499        mov     wptr [CurPartition_Location+4], ax
     500        call    DriveIO_LoadLVMSector      ; SI points now to LVM-Sector
     501        call    LVM_RemoveVolLetterFromSector
     502
     503    IFDEF ReleaseCode
     504        call    DriveIO_SaveLVMSector   ; Save sector
     505    ENDIF
     506    LVMDLR_NextPartition:
     507        inc     bx
     508        dec     cl
     509        jnz     LVMDLR_RemoveLoop
     510
     511    LVMDLR_SkipRemove:
     512        ; Set CurPartition_Location information of destination partition
     513        mov     ax, wptr [di+LocIPT_AbsolutePartTable]
     514        mov     wptr [CurPartition_Location+0], ax
     515        mov     ax, wptr [di+LocIPT_AbsolutePartTable+2]
     516        mov     wptr [CurPartition_Location+2], ax
     517        mov     ah, bptr [di+LocIPT_LocationPartTable+0]
     518        mov     al, [di+LocIPT_Drive]
     519        mov     wptr [CurPartition_Location+4], ax
     520        mov     ax, wptr [di+LocIPT_LocationPartTable+1]
     521        mov     wptr [CurPartition_Location+6], ax
     522        call    DriveIO_LoadLVMSector         ; SI points now to LVM-Sector
     523        mov     ax, wptr [di+LocIPT_AbsoluteBegin]
     524        mov     dx, wptr [di+LocIPT_AbsoluteBegin+2]
     525        mov     di, si                        ; Save SI in DI
     526        call    LVM_SearchForPartition
     527        jnc     LVMDLR_DestPartNotFound
     528        ; Set new volume letter
     529        mov     bptr [si+LocLVM_VolumeLetter], ch
     530        mov     si, di                        ; SI - LVM Sector again
     531        call    LVM_UpdateSectorCRC           ; Update LVM-CRC now
     532
     533    IFDEF ReleaseCode
     534        call    DriveIO_SaveLVMSector      ; Save sector
     535    ENDIF
     536
     537    LVMDLR_DestPartNotFound:
     538        ; This here is done for safety, because we misuse CurPartition_Location
     539        xor     ax, ax
     540        mov     di, offset CurPartition_Location
     541        mov     cx, 4
     542        rep     stosw                         ; NUL out CurPartition_Location
     543        ret
    384544LVM_DoLetterReassignment        EndP
     545
     546
     547; This walks the IPT and for each partition it obtains the LVM drive-letter
     548; if available. This drive-letter is then marked as in-use in the Map.
     549; The FreeDriveletterMap is used by the drive-letter reassignment function
     550; to assign a new drive to a data-partition when a system-partition is booted
     551; with the same drive-letter. The original drive-letter for the data-partition
     552; is saved so it can be restored later when a system is booted that does not
     553; use the drive-letter. Note that there can be multiple system-partitions
     554; using the same drive-letter and data-partitions can become system-partition
     555; by making them bootable. (and vice versa)
     556LVM_ComposeFreeDriveletterMap   Proc
     557
     558; get nr of partitions in IPT
     559; for each partition get LVM drive-letter and reset bit in map.
     560
     561LVM_ComposeFreeDriveletterMap   EndP
     562
  • trunk/BOOTCODE/SPECIAL/SOUND.ASM

    r46 r51  
    2020;---------------------------------------------------------------------------
    2121
    22 IFDEF ModuleNames
     22IFDEF   MODULE_NAMES
    2323DB 'SOUND',0
    2424ENDIF
  • trunk/BOOTCODE/SPECIAL/VIRUS.ASM

    r40 r51  
    2424; Segment Registers preserved
    2525
    26 IFDEF ModuleNames
     26IFDEF   MODULE_NAMES
    2727DB 'VIRUS',0
    2828ENDIF
  • trunk/BOOTCODE/TEXT/DE/MENUS.ASM

    r37 r51  
    5353TXT_SETUP_RememberTimedBoot    db 'Zeit-Boot-Part. merken', 0
    5454TXT_SETUP_IncludeFloppy        db 'Disk-LW hinzufgen', 0
     55TXT_SETUP_ShowLVMDriveLetters  db 'Show LVM Drive Letters',0
    5556TXT_SETUP_MbrProtection        db 'MBR Schutz', 0
    5657TXT_SETUP_IgnoreMbrWrites      db '-> Ignoriere Schreiben', 0
     
    8283;TXT_SETUP_DefLinuxCmd          db 'DEFINIERE LINUX KOMMANDOZEILE', 0
    8384TXT_SETUP_IgnoreLVM            db 'Ignoriere LVM Daten', 0
    84 TXT_SETUP_ForceLBAUsage        db 'Erzwinge BIOS-LBA', 0
     85;~ TXT_SETUP_ForceLBAUsage        db 'Erzwinge BIOS-LBA', 0
    8586TXT_SETUP_ExtPartMShack        db 'Erw-Part MS Workaround', 0
    8687
     
    211212                               db 'Booten von Laufwerk A:', 0
    212213                               db 0
     214TXT_SETUPHELP_ShowLVMDriveLetters   db 'AiR-BOOT will show', 0
     215                                    db 'LVM Drive Letters', 0
     216                                    db 'in the menu.', 0
     217                                    db 0
    213218TXT_SETUPHELP_MbrProtection    db 'Beschtzt Ihren MBR', 0
    214219                               db 'durch residenten Code.', 0
     
    299304                               db 'LVM Informationen.', 0
    300305                               db 0
    301 TXT_SETUPHELP_ForceLBAUsage    db 'Erzwingt Bentzung der', 0
    302                                db 'BIOS LBA APIs anstatt', 0
    303                                db 'gemischter Verwendung', 0
    304                                db 'von CHS und LBA.', 0
    305                                db 0
     306;~ TXT_SETUPHELP_ForceLBAUsage    db 'Erzwingt Bentzung der', 0
     307                               ;~ db 'BIOS LBA APIs anstatt', 0
     308                               ;~ db 'gemischter Verwendung', 0
     309                               ;~ db 'von CHS und LBA.', 0
     310                               ;~ db 0
    306311TXT_SETUPHELP_ExtPartMShack    db 'Aktiviert dynamisches', 0
    307312                               db '„ndern des erweiterten', 0
  • trunk/BOOTCODE/TEXT/EN/MENUS.ASM

    r37 r51  
    5353TXT_SETUP_RememberTimedBoot    db 'Remember Timed Boot', 0
    5454TXT_SETUP_IncludeFloppy        db 'Include Floppy Drive', 0
     55TXT_SETUP_ShowLVMDriveLetters  db 'Show LVM Drive Letters',0
    5556TXT_SETUP_MbrProtection        db 'MBR Protection', 0
    5657TXT_SETUP_IgnoreMbrWrites      db '-> Ignore MBR Writes', 0
     
    8283;TXT_SETUP_DefLinuxCmd          db 'DEFINE COMMAND LINE FOR LINUX', 0
    8384TXT_SETUP_IgnoreLVM            db 'Ignore LVM information', 0
    84 TXT_SETUP_ForceLBAUsage        db 'Force BIOS-LBA Usage', 0
     85;~ TXT_SETUP_ForceLBAUsage        db 'Force BIOS-LBA Usage', 0
    8586TXT_SETUP_ExtPartMShack        db 'Ext-Part MS Workaround', 0
    8687
     
    212213                               db 'menu.', 0
    213214                               db 0
     215TXT_SETUPHELP_ShowLVMDriveLetters   db 'AiR-BOOT will show', 0
     216                                    db 'LVM Drive Letters', 0
     217                                    db 'in the menu.', 0
     218                                    db 0
    214219TXT_SETUPHELP_MbrProtection    db 'Protects your MBR via', 0
    215220                               db 'resident code. Needs', 0
     
    301306                               db 'LVM information.', 0
    302307                               db 0
    303 TXT_SETUPHELP_ForceLBAUsage    db 'Forces the usage of', 0
    304                                db 'BIOS LBA APIs instead', 0
    305                                db 'of mixed usage of CHS', 0
    306                                db 'and LBA.', 0
    307                                db 0
     308;~ TXT_SETUPHELP_ForceLBAUsage    db 'Forces the usage of', 0
     309                               ;~ db 'BIOS LBA APIs instead', 0
     310                               ;~ db 'of mixed usage of CHS', 0
     311                               ;~ db 'and LBA.', 0
     312                               ;~ db 0
    308313TXT_SETUPHELP_ExtPartMShack    db 'Enables dynamic change', 0
    309314                               db 'of the ext. partition', 0
  • trunk/BOOTCODE/TEXT/FR/MENUS.ASM

    r37 r51  
    5353TXT_SETUP_RememberTimedBoot    db 'M‚moriser Amorce Tempo.', 0
    5454TXT_SETUP_IncludeFloppy        db 'Incl. Lecteur Disquette', 0
     55TXT_SETUP_ShowLVMDriveLetters  db 'Show LVM Drive Letters',0
    5556TXT_SETUP_MbrProtection        db 'Protection MBR', 0
    5657TXT_SETUP_IgnoreMbrWrites      db '-> Ignorer criture MBR', 0
     
    8283;TXT_SETUP_DefLinuxCmd          db 'DFINIR LIGNE DE COMMANDE LINUX', 0
    8384TXT_SETUP_IgnoreLVM            db 'Ignorer Information LVM', 0
    84 TXT_SETUP_ForceLBAUsage        db 'Force usage du BIOS-LBA', 0
     85;~ TXT_SETUP_ForceLBAUsage        db 'Force usage du BIOS-LBA', 0
    8586TXT_SETUP_ExtPartMShack        db 't-Part MS Workaround', 0
    8687
     
    216217                               db 'menu.', 0
    217218                               db 0
     219TXT_SETUPHELP_ShowLVMDriveLetters   db 'AiR-BOOT will show', 0
     220                                    db 'LVM Drive Letters', 0
     221                                    db 'in the menu.', 0
     222                                    db 0
    218223TXT_SETUPHELP_MbrProtection    db 'ProtŠge MBR par code', 0
    219224                               db 'r‚sidant. N‚cessite', 0
     
    310315                               db 'LVM.', 0
    311316                               db 0
    312 TXT_SETUPHELP_ForceLBAUsage    db 'Forcer l''usage de', 0
    313                                db 'l''API BIOS LBA au lieu', 0
    314                                db 'd''un amalgame de', 0
    315                                db 'CHS et LBA.', 0
    316                                db 0
     317;~ TXT_SETUPHELP_ForceLBAUsage    db 'Forcer l''usage de', 0
     318                               ;~ db 'l''API BIOS LBA au lieu', 0
     319                               ;~ db 'd''un amalgame de', 0
     320                               ;~ db 'CHS et LBA.', 0
     321                               ;~ db 0
    317322TXT_SETUPHELP_ExtPartMShack    db 'Changement dynamique', 0
    318323                               db 'du type id (standard', 0
  • trunk/BOOTCODE/TEXT/IT/MENUS.ASM

    r37 r51  
    5454TXT_SETUP_RememberTimedBoot    db 'Ricorda Avvio Temporiz.', 0
    5555TXT_SETUP_IncludeFloppy        db 'Includi Avvio da Floppy', 0
     56TXT_SETUP_ShowLVMDriveLetters  db 'Show LVM Drive Letters',0
    5657TXT_SETUP_MbrProtection        db 'Proteggi MBR', 0
    5758TXT_SETUP_IgnoreMbrWrites      db '->Ignora modifiche MBR', 0
     
    8384;TXT_SETUP_DefLinuxCmd          db 'DEFINIRE LINEA DI COMANDO LINUX', 0
    8485TXT_SETUP_IgnoreLVM            db 'Ignorare LVM info.', 0
    85 TXT_SETUP_ForceLBAUsage        db 'Forza uso LBA del BIOS', 0
     86;~ TXT_SETUP_ForceLBAUsage        db 'Forza uso LBA del BIOS', 0
    8687TXT_SETUP_ExtPartMShack        db 'Est-Part MS Workaround', 0
    8788
     
    217218                               db 'tramite il menu', 0
    218219                               db 0
     220TXT_SETUPHELP_ShowLVMDriveLetters   db 'AiR-BOOT will show', 0
     221                                    db 'LVM Drive Letters', 0
     222                                    db 'in the menu.', 0
     223                                    db 0
    219224TXT_SETUPHELP_MbrProtection    db 'Protegge il MBR con un', 0
    220225                               db 'programma residente.', 0
     
    314319                               db 'informazione.', 0
    315320                               db 0
    316 TXT_SETUPHELP_ForceLBAUsage    db 'Forza l''uso delle API', 0
    317                                db 'LBA del BIOS invece', 0
    318                                db 'dell''uso misto di CHS', 0
    319                                db 'ed LBA.', 0
    320                                db 0
     321;~ TXT_SETUPHELP_ForceLBAUsage    db 'Forza l''uso delle API', 0
     322                               ;~ db 'LBA del BIOS invece', 0
     323                               ;~ db 'dell''uso misto di CHS', 0
     324                               ;~ db 'ed LBA.', 0
     325                               ;~ db 0
    321326TXT_SETUPHELP_ExtPartMShack    db 'Abilita il cambiamento', 0
    322327                               db 'dinamico della partiz.', 0
  • trunk/BOOTCODE/TEXT/NL/MENUS.ASM

    r37 r51  
    5353TXT_SETUP_RememberTimedBoot    db 'Vorige keuze/wachttijd', 0
    5454TXT_SETUP_IncludeFloppy        db 'Inclusief station A:', 0
     55TXT_SETUP_ShowLVMDriveLetters  db 'Toon LVM Drive Letters',0
    5556TXT_SETUP_MbrProtection        db 'MBR beveiligen', 0
    5657TXT_SETUP_IgnoreMbrWrites      db '-> MBR niet beveiligen', 0
     
    8283;TXT_SETUP_DefLinuxCmd          db 'Opdrachtenreeks voor Linux', 0
    8384TXT_SETUP_IgnoreLVM            db 'LVM-gegevens negeren', 0
    84 TXT_SETUP_ForceLBAUsage        db 'Enkel BIOS-LBA', 0
     85;~ TXT_SETUP_ForceLBAUsage        db 'Enkel BIOS-LBA', 0
    8586TXT_SETUP_ExtPartMShack        db 'Ext-Part MS Workaround', 0
    8687;----------------------------------|---------------------|------------------
     
    217218                               db 'starten werd gekozen.' ,0
    218219                               db 0
    219 TXT_SETUPHELP_IncludeFloppy    db 'U kan van A: opstarten', 0
     220TXT_SETUPHELP_IncludeFloppy    db 'U kunt van A: opstarten', 0
    220221                               db 'via het AiR-BOOTmenu.', 0
    221222                               db 0
     223TXT_SETUPHELP_ShowLVMDriveLetters   db 'AiR-BOOT will show', 0
     224                                    db 'LVM Drive Letters', 0
     225                                    db 'in the menu.', 0
     226                                    db 0
    222227TXT_SETUPHELP_MbrProtection    db 'Beveiligt het MBR via', 0
    223228                               db 'een residente code.', 0
     
    318323                               db 'onbestaande beschouwd.', 0
    319324                               db 0
    320 TXT_SETUPHELP_ForceLBAUsage    db 'Uitschakelen van de', 0
    321                                db 'combinatie van LBA', 0
    322                                db 'en CHS. Er wordt dan', 0
    323                                db 'ENKEL gebruik gemaakt', 0
    324                                db 'van de BIOS LBA API''s.', 0
    325                                db 0
     325;~ TXT_SETUPHELP_ForceLBAUsage    db 'Uitschakelen van de', 0
     326                               ;~ db 'combinatie van LBA', 0
     327                               ;~ db 'en CHS. Er wordt dan', 0
     328                               ;~ db 'ENKEL gebruik gemaakt', 0
     329                               ;~ db 'van de BIOS LBA API''s.', 0
     330                               ;~ db 0
    326331TXT_SETUPHELP_ExtPartMShack    db 'Schakelt dynamische', 0
    327332                               db 'wijziging van ext.', 0
  • trunk/BOOTCODE/TEXT/RU/MENUS.ASM

    r37 r51  
    6060TXT_SETUP_RememberTimedBoot    db '®¬­šâì ¢  ¢â®§ £à㧪¥', 0
    6161TXT_SETUP_IncludeFloppy        db '„®¡ ¢šâì €šáª®¢®€', 0
     62TXT_SETUP_ShowLVMDriveLetters  db 'Show LVM Drive Letters',0
    6263TXT_SETUP_MbrProtection        db '‡ éšâ  MBR', 0
    6364TXT_SETUP_IgnoreMbrWrites      db '-> ¥ ¬¥­ïâì MBR', 0
     
    9091 ŠŽŒ€„“ž ‘’ŽŠ“ „‹Ÿ LINUX', 0
    9192TXT_SETUP_IgnoreLVM            db 'ˆ£­®àšà®¢ âì € ­­ë¥ LVM', 0
    92 TXT_SETUP_ForceLBAUsage        db 'ˆá¯®«ì§®¢ âì BIOS-LBA', 0
     93;~ TXT_SETUP_ForceLBAUsage        db 'ˆá¯®«ì§®¢ âì BIOS-LBA', 0
    9394TXT_SETUP_ExtPartMShack        db ' §€¥«ë €«ï MS-ášá⥬', 0
    9495
     
    222223                               db 'ç¥à¥§ ¬¥­î.', 0
    223224                               db 0
     225TXT_SETUPHELP_ShowLVMDriveLetters   db 'AiR-BOOT will show', 0
     226                                    db 'LVM Drive Letters', 0
     227                                    db 'in the menu.', 0
     228                                    db 0
    224229TXT_SETUPHELP_MbrProtection    db '‡ éšé ¥â MBR ç¥à¥§', 0
    225230                               db 'à¥§š€¥­â­ë© ª®€. ãŠ­®', 0
     
    309314                               db 'š­ä®à¬ æšî LVM', 0
    310315                               db 0
    311 TXT_SETUPHELP_ForceLBAUsage    db '’ॡ〥⠚ᯮ«ì§®¢ ­š¥', 0
    312                                db 'BIOS LBA API ¢¬¥áâ®', 0
    313                                db 'ª®¬¡š­šà®¢ ­­®£® - CHS', 0
    314                                db 'š LBA.', 0
    315                                db 0
     316;~ TXT_SETUPHELP_ForceLBAUsage    db '’ॡ〥⠚ᯮ«ì§®¢ ­š¥', 0
     317                               ;~ db 'BIOS LBA API ¢¬¥áâ®', 0
     318                               ;~ db 'ª®¬¡š­šà®¢ ­­®£® - CHS', 0
     319                               ;~ db 'š LBA.', 0
     320                               ;~ db 0
    316321TXT_SETUPHELP_ExtPartMShack    db '‚ª«îç ¥â €š­ ¬šç¥áªãî', 0
    317322                               db 'ᬥ­ã ⚯  à áèšà¥­­ëå', 0
  • trunk/BOOTCODE/TEXT/SW/MENUS.ASM

    r37 r51  
    5353TXT_SETUP_RememberTimedBoot    db 'Kom Ih†g Tids Boot', 0
    5454TXT_SETUP_IncludeFloppy        db 'Inkludera Diskettenhet', 0
     55TXT_SETUP_ShowLVMDriveLetters  db 'Show LVM Drive Letters',0
    5556TXT_SETUP_MbrProtection        db 'MBR Skydd', 0
    5657TXT_SETUP_IgnoreMbrWrites      db '-> Ignorera MBR Skriv', 0
     
    8384TXT_SETUP_IgnoreLVM            db 'Ignore LVM information', 0
    8485; ###
    85 TXT_SETUP_ForceLBAUsage        db 'Forc BIOS-LBA Anv„ndn.', 0
     86;~ TXT_SETUP_ForceLBAUsage        db 'Forc BIOS-LBA Anv„ndn.', 0
    8687TXT_SETUP_ExtPartMShack        db 'Ext-Part MS Workaround', 0
    8788
     
    227228                               db 'fr†n A: via menyn.', 0
    228229                               db 0
     230TXT_SETUPHELP_ShowLVMDriveLetters   db 'AiR-BOOT will show', 0
     231                                    db 'LVM Drive Letters', 0
     232                                    db 'in the menu.', 0
     233                                    db 0
    229234TXT_SETUPHELP_MbrProtection    db 'Skydda din MBR via', 0
    230235                               db 'resident kod. Beh”ver', 0
     
    325330                               db 0
    326331; ###
    327 TXT_SETUPHELP_ForceLBAUsage    db 'Forc. anv„ndning av', 0
    328                                db 'BIOS LBA APIs', 0
    329                                db 'ist„llet f”r mixad anv.', 0
    330                                db 'av CHS och LBA.', 0
    331                                db 0
     332;~ TXT_SETUPHELP_ForceLBAUsage    db 'Forc. anv„ndning av', 0
     333                               ;~ db 'BIOS LBA APIs', 0
     334                               ;~ db 'ist„llet f”r mixad anv.', 0
     335                               ;~ db 'av CHS och LBA.', 0
     336                               ;~ db 0
    332337TXT_SETUPHELP_ExtPartMShack    db 'Aktiverar dyn. „ndring', 0
    333338                               db 'av den ut”kade part.,', 0
  • trunk/BOOTCODE/VERSION.INC

    r50 r51  
     1;
     2; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
     3;
     4; This file is part of AiR-BOOT
     5;
     6; AiR-BOOT is free software: you can redistribute it and/or modify it under
     7;  the terms of the GNU General Public License as published by the Free
     8;  Software Foundation, either version 3 of the License, or (at your option)
     9;  any later version.
     10;
     11; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
     12;  WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
     13;  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
     14;  details.
     15;
     16; You should have received a copy of the GNU General Public License along with
     17;  AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
     18;
     19
     20
    121;
    222; AiR-BOOT Version Information.
     
    1636; The Year, Month and Day in BCD so we can easily extract nibbles.
    1737AB_YEAR             EQU     2012h
    18 AB_MONTH            EQU     05h
    19 AB_DAY              EQU     14h
     38AB_MONTH            EQU     09h
     39AB_DAY              EQU     09h
    2040
    2141; The Hours, Minutes and Seconds, again in BCD for easy manipulation.
    22 AB_HOURS            EQU     22h
    23 AB_MINUTES          EQU     21h
    24 AB_SECONDS          EQU     00h
     42AB_HOURS            EQU     09h
     43AB_MINUTES          EQU     09h
     44AB_SECONDS          EQU     09h
    2545
    2646; The AiR-BOOT signature uses big-endian so we shuffle some bits around.
  • trunk/INCLUDE/ASM.INC

    r46 r51  
    119119    ; Use this value to fill the gap between the new origin and the last
    120120    ; emitted code or data.
    121     fillchar = '0'
     121    IFDEF   AUX_DEBUG
     122        fillchar = '#'
     123    ELSE
     124        fillchar = 0
     125    ENDIF
    122126
    123127    ; Mark the location of the last emitted code or data.
     
    142146    ; Masm can also do db 0 dup (0), and it does calculate correctly
    143147    ; but cannot find the after label.
    144     ; Same issue as with JWasm but the db construct does not solve it for masm.
     148    ; Same issue as with JWasm but the db construct does not solve it for Masm.
    145149    ; The label-values show-up to be correct in the listing though.
    146150    ; Currently overlap-checking is disabled when assembling with Masm !
     
    199203IF image_size EQ image_size_60secs
    200204    ; Maximum number of partitions supported in pre v1.07.
    201    partition_count               equ   30
     205   max_partitions                equ   30
    202206ELSE
    203207    ; Maximum number of partitions supported in post v1.06.
    204    partition_count               equ   45
     208   max_partitions                equ   45
    205209ENDIF
  • trunk/INSTALL/C/INSTALL.C

    r50 r51  
    10561056        }
    10571057        Status_Config = STATUS_INSTALLEDMGU;
     1058
     1059        // Abort if unknown installed config version.
     1060        if ((Installed_ConfigVersion > 0x108)) {
     1061            if (!Option_CID) {
     1062                printf("\n");
     1063                printf("Configuration version of installed AiR-BOOT not supported by this installer !\n");
     1064                printf("\n");
     1065            }
     1066            exit(1);
     1067        }
     1068
     1069        // Abort if unknown to-install config version.
     1070        if ((Bootcode_ConfigVersion > 0x108)) {
     1071            if (!Option_CID) {
     1072                printf("\n");
     1073                printf("Configuration version of new AiR-BOOT.BIN not supported by this installer !\n");
     1074                printf("\n");
     1075            }
     1076            exit(1);
     1077        }
     1078
     1079
    10581080        // Those upgrades will copy useful configuration data to the image config
    10591081        //  If new configuration data was added, those spaces are not overwritten
     
    11151137        /*
    11161138        // Convert v1.06 hideparttable (30x30) to the v1.07 (30x45) format.
     1139        // Also copy drive-letters to either v1.07 or v1.0.8 location.
    11171140        */
    11181141        if ((Installed_ConfigVersion == 0x102) && (Bootcode_ConfigVersion >= 0x107)) {
     
    11201143            char    c;
    11211144            //printf("Converting 1.06 -> 1.07 hidepart");
     1145            // Copy old hide-part table to new location.
    11221146            memcpy(&Bootcode[0x7400], &Track0[0x7200], 900);
     1147            // Setup temporary table.
    11231148            memset(TempHidPartTable, 0xff, 45 * 34);
     1149            // Copy old hide-part table to temporary table.
    11241150            for (i=0; i<30; i++) {
    11251151                for (j=0; j<30; j++) {
     
    11281154                }
    11291155            }
     1156            // Copy temporary table to final v1.07 location.
    11301157            memcpy(&Bootcode[0x7400], TempHidPartTable, 30 * 45);
     1158
     1159            // Clear drive-letters if version being installed is v1.07.
     1160            if (Bootcode_ConfigVersion == 0x107) {
     1161                memset(&Bootcode[0x7946], 0, 45);
     1162            }
     1163
     1164            // Copy over drive-letters from v1.06 location to v1.08 location.
     1165            if (Bootcode_ConfigVersion == 0x108) {
     1166                memset(&Bootcode[0x6cb0], 0, 45);
     1167                memcpy(&Bootcode[0x6cb0], &Track0[0x7584], 30);
     1168            }
    11311169        }
    11321170
     
    11341172        // Convert v1.07 hideparttable (30x45) to a packed v1.0.8+ (45x45) format.
    11351173        */
    1136         if ((Installed_ConfigVersion < 0x108) && (Bootcode_ConfigVersion >= 0x108)) {
     1174        if ((Installed_ConfigVersion < 0x108) && (Bootcode_ConfigVersion == 0x108)) {
    11371175            int     i,j;
    11381176            char    c;
    11391177            //printf("Converting to 1.08 packed hidepart");
     1178            // Setup temporary table.
    11401179            memset(TempHidPartTable, 0xff, 45 * 34);
     1180
     1181            // Copy old hide-part table to temporary table.
    11411182            // Unpacked table is 30 rows with 45 columns per row.
    11421183            // Packed table is 45 rows with 45 columns per row packed in 34 bytes.
     
    11471188                }
    11481189            }
     1190            // Copy temporary table to final v1.0.8 location (packed format)
    11491191            memcpy(&Bootcode[0x7400], TempHidPartTable, 45 * 34);
     1192            // Show LVM Drive Letters.
     1193            Bootcode[0x6c17] = 1;
    11501194        }
    11511195
  • trunk/INSTALL/C/INSTALL.H

    r48 r51  
    1 /* INSTALL.H */
    2 
     1// AiR-BOOT (c) Copyright 1998-2009 M. Kiewitz
     2//
     3// This file is part of AiR-BOOT
     4//
     5// AiR-BOOT is free software: you can redistribute it and/or modify it under
     6//  the terms of the GNU General Public License as published by the Free
     7//  Software Foundation, either version 3 of the License, or (at your option)
     8//  any later version.
     9//
     10// AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
     11//  WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
     12//  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
     13//  details.
     14//
     15// You should have received a copy of the GNU General Public License along with
     16//  AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
     17//
    318
    419
     
    1429// Build date
    1530#define     BLDLVL_YEAR             "2012"
    16 #define     BLDLVL_MONTH            "04"
    17 #define     BLDLVL_DAY              "23"
     31#define     BLDLVL_MONTH            "09"
     32#define     BLDLVL_DAY              "09"
    1833// Build time
    19 #define     BLDLVL_HOURS            "19"
    20 #define     BLDLVL_MINUTES          "41"
    21 #define     BLDLVL_SECONDS          "00"
     34#define     BLDLVL_HOURS            "09"
     35#define     BLDLVL_MINUTES          "09"
     36#define     BLDLVL_SECONDS          "09"
    2237// Build machine
    2338//#define     BLDLVL_MACHINE          "ecs-devbox"
  • trunk/INSTALL/DOS/Makefile

    r46 r51  
    6363#ASM=masm
    6464#ASM=alp
    65 ASM=tasm
     65#ASM=tasm
    6666#ASM=wasm
    67 #ASM=jwasm
     67ASM=jwasm
    6868
    6969#
  • trunk/TOOLS/INTERNAL/FIXCODE

    r46 r51  
    1515#
    1616# This script is now obsolete.
     17# Don't use since the MBR Protaction Image has moved !!
    1718#
    1819exit 1;
  • trunk/TOOLS/INTERNAL/FIXCODE.C

    r47 r51  
    8383
    8484/* File buffers */
    85 char    BootCode[IMAGE_SIZE];   // Buffer for boot-image
    86 char    MBRProtection[1024];    // Buffer for protection-image
     85char    BootCode[IMAGE_SIZE];           // Buffer for boot-image
     86char    MBRProtection[MBRPROT_SIZE];    // Buffer for protection-image
    8787
    8888
     
    163163    // AIR-BOOT.COM image.
    164164    */
    165     for (i=0; i<55; i++) {
    166         if (!memcmp(MBRProtectionSignature, &BootCode[i*SECSIZE], strlen(MBRProtectionSignature))) {
     165    //~ for (i=0; i<55; i++) {
     166    for (i=0; i<110; i++) {
     167        if (!memcmp(MBRProtectionSignature, &BootCode[i*PAGESIZE], strlen(MBRProtectionSignature))) {
    167168            found = 1;
    168169            break;
     
    182183    // Merge Protection Image.
    183184    */
    184     memcpy(&BootCode[i*SECSIZE], MBRProtection, MBRPROT_SIZE);
     185    //~ memcpy(&BootCode[i*SECSIZE], MBRProtection, MBRPROT_SIZE);
     186    memcpy(&BootCode[i*PAGESIZE], MBRProtection, MBRPROT_SIZE);
    185187    printf("%s", Okay);
    186188
  • trunk/TOOLS/INTERNAL/FIXCODE.H

    r46 r51  
    2222
    2323#define     IMAGE_SIZE      31744
    24 #define     MBRPROT_SIZE    1024
     24//~ #define     MBRPROT_SIZE    1024
     25#define     MBRPROT_SIZE    768
    2526#define     SECSIZE         512
     27#define     PAGESIZE        256
    2628
    2729#endif
  • trunk/TOOLS/OS2/SETABOOT/Makefile

    r46 r51  
    289289        @if exist *.o   $(RM) *.o
    290290
     291# -----------------------------------------------------------------------------
     292# DISTRIBUTE TO RELEASE SPACE
     293# -----------------------------------------------------------------------------
     294# This distributes all .BIN files to BOOTCODE.
     295# Then it installs the English version to RELEASES as AIRBOOT.BIN.
     296# -----------------------------------------------------------------------------
     297dist:   .SYMBOLIC
     298        @if exist *.EXE $(CP) *.EXE ..$(DS)..$(DS)..$(DS)RELEASE$(DS)OS2
     299
    291300#
    292301# Help on using this Makefile.
  • trunk/TOOLS/OS2/SETABOOT/SETABOOT.H

    r48 r51  
    1515// Build date
    1616#define     BLDLVL_YEAR             "2012"
    17 #define     BLDLVL_MONTH            "04"
    18 #define     BLDLVL_DAY              "23"
     17#define     BLDLVL_MONTH            "09"
     18#define     BLDLVL_DAY              "09"
    1919// Build time
    20 #define     BLDLVL_HOURS            "19"
    21 #define     BLDLVL_MINUTES          "41"
    22 #define     BLDLVL_SECONDS          "00"
     20#define     BLDLVL_HOURS            "09"
     21#define     BLDLVL_MINUTES          "09"
     22#define     BLDLVL_SECONDS          "09"
    2323// Build machine
    2424//#define     BLDLVL_MACHINE          "ecs-devbox"
Note: See TracChangeset for help on using the changeset viewer.