Ignore:
Timestamp:
May 5, 2011, 2:00:00 PM (14 years ago)
Author:
Ben Rietbroek
Message:

AiR-BOOT v1.06 -- Complete sourceforge mirror. (r56) [2010-02-19]
Signature-date: 2006-03-13.
Also contains binairy releases from v1.01 to v1.06, cd-rom images, etc.
If you want the whole pre v1.07 shebang, checkout this revision's trunk.
The v1.06 reference version is in 'tags/v1.06r'.
Note that this reference version uses 'NL' for 'Dutch'.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BOOTCODE/REGULAR/PARTMAIN.ASM

    r23 r29  
    1 
    2 ; Disclaimer:
    3 ;=============
    4 ; The sourcecode is released via www.netlabs.org CVS *ONLY*.
    5 ;  You MUST NOT upload it to other servers nor republish it in any way.
    6 The sourcecode is still COPYRIGHTED and NOT RELEASED UNDER GPL.
    7 It's (c) Copyright 1998-2003 by Martin Kiewitz.
    8 You may recompile the source and do *PRIVATE* modifications, but please keep
    9 ;  in mind that modifying this code needs at least *some* assembly skill. If
    10 ;  you mess up your system, because you needed to hack your way through, don't
    11 blame me. Releasing a customized version of AiR-BOOT, selling it in any form
    12 or reusing parts of this source is *PROHIBITED*. Ask me, if you have some
    13 idea about new functionality *before* developing the code, otherwise I will
    14 ;  definitely reject it. Also please accept, that I have some basic design
    15 ;  rules on AiR-BOOT and I will maintain them at all costs, so this won't get
    16 another GRUB.
    17 
     1; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
     2;
     3; This file is part of AiR-BOOT
     4;
     5; AiR-BOOT is free software: you can redistribute it and/or modify it under
     6the terms of the GNU General Public License as published by the Free
     7Software Foundation, either version 3 of the License, or (at your option)
     8any later version.
     9;
     10; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
     11WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
     12FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
     13details.
     14;
     15; You should have received a copy of the GNU General Public License along with
     16AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
     17;
    1818;---------------------------------------------------------------------------
    1919;                                     AiR-BOOT / PARTiTiON REGULAR ROUTINES
     
    2424   xor     bl, bl
    2525   mov     dl, CFG_PartDefault
    26    call    PART_FixUpPartitionNumber
     26   call    PART_FixUpSelectionNumber
    2727   mov     CFG_PartDefault, dl
    2828   mov     dl, CFG_PartLast
    29    call    PART_FixUpPartitionNumber
     29   call    PART_FixUpSelectionNumber
    3030   mov     CFG_PartLast, dl
    3131   mov     dl, CFG_PartAutomatic
    32    call    PART_FixUpPartitionNumber
     32   call    PART_FixUpSelectionNumber
    3333   mov     CFG_PartAutomatic, dl
    3434
    35    ; Fix-Up Linux Kernel Partition - If lost, search for FAT-16
    36    mov     bl, 06h
    37    mov     dl, CFG_LinuxKrnlPartition
    38    call    PART_FixUpPartitionNumber
    39    mov     CFG_LinuxKrnlPartition, dl
    40 
    41    ; Fix-Up Linux Root Partition - If lost, search for Linux partition (83h)
    42    mov     bl, 83h
    43    mov     dl, CFG_LinuxRootPartition
    44    call    PART_FixUpPartitionNumber
    45    mov     CFG_LinuxRootPartition, dl
     35; [Linux support removed since v1.02]
     36;   ; Fix-Up Linux Kernel Partition - If lost, search for FAT-16
     37;   mov     bl, 06h
     38;   mov     dl, CFG_LinuxKrnlPartition
     39;   call    PART_FixUpPartitionNumber
     40;   mov     CFG_LinuxKrnlPartition, dl
     41;
     42;   ; Fix-Up Linux Root Partition - If lost, search for Linux partition (83h)
     43;   mov     bl, 83h
     44;   mov     dl, CFG_LinuxRootPartition
     45;   call    PART_FixUpPartitionNumber
     46;   mov     CFG_LinuxRootPartition, dl
    4647   ret
    4748PART_FixUpDefaultPartitionValues EndP
     
    6263;            BL - Requested Partition ID
    6364;       Out: DL - New number of partition (guessed normally ;)
    64 PART_FixUpPartitionNumber       Proc Near Uses ax cx
    65    cmp     dl, 0FFh
    66    je      PFUPN_PartitionDisabled
     65PART_FixUpSelectionNumber       Proc Near Uses ax cx
     66   cmp     dl, 080h
     67   je      PFUPN_SelectionDisabled
     68   ja      PFUPN_SpecialSelection
    6769   call    PARTSCAN_GetXref              ; DL - PartitionNo prev IPT
    6870   cmp     dh, 0FFh                      ; DH -> Partition No in new IPT
    69    je      PFUPN_PartitionGone
    70   PFUPN_PartitionDisabled:
    71    ret
    72 
    73    ; Partition is not referenced in New-IPT, so dig for requested partition
    74   PFUPN_PartitionGone:
     71   je      PFUPN_SelectionGone
     72   mov     dl, dh
     73  PFUPN_SelectionDisabled:
     74   ret
     75
     76  PFUPN_SpecialSelection:
     77   cmp     dl, 0FEh                      ; Resume-BIOS?
     78   ja      PFUPN_SpecialSelectionFloppy
     79   cmp     CFG_ResumeBIOSbootSeq, 0
     80   je      PFUPN_SelectionGone
     81   jmp     PFUPN_Found
     82  PFUPN_SpecialSelectionFloppy:
     83   cmp     CFG_IncludeFloppy, 0
     84   je      PFUPN_SelectionGone
     85   jmp     PFUPN_Found
     86
     87   ; Partition is not referenced in New-IPT or Resume-BIOS/Floppy selected, but
     88   ;  actual media is disabled...so dig for requested partition
     89  PFUPN_SelectionGone:
    7590   mov     cl, CFG_Partitions
    7691   or      cl, cl
     
    94109  PFUPN_BootableSearchLoop:
    95110      call    PART_GetPartitionPointer   ; Gets SI for partition DL
    96       mov     al, cs:[si+LocIPT_Flags]
     111      mov     al, ds:[si+LocIPT_Flags]
    97112      and     al, Flags_BootAble
    98113      jnz     PFUPN_Found
     
    106121
    107122  PFUPN_NothingFound:
    108    mov     dl, 0FFh                      ; Now being Disabled
     123   mov     dl, 080h                      ; Now being Disabled
    109124  PFUPN_Found:
    110125   ret
    111 PART_FixUpPartitionNumber       EndP
     126PART_FixUpSelectionNumber       EndP
    112127
    113128; ============================================================================
    114 ;        In: CS:SI - IPT-Entry of partition
    115 ;            ExecBaseSeg:Ptr - Actual Boot-Record of partition
     129;        In: DS:SI - IPT-Entry of partition
     130;            DS:PartitionSector - Actual Boot-Record of partition
    116131;       Out: *none* (BootRecordCRD updated)
    117132PART_UpdateBootRecordCRC        Proc Near Uses bx
    118    push    ds si
    119       push    ExecBaseSeg
    120       pop     ds
    121       mov     si, offset ExecBasePtr
    122       mov     bx, 4B4Dh            ; Magic: 'MK'
    123       call    MBR_GetCheckOfSector
    124    pop     si ds
    125    mov     cs:[si+LocIPT_BootRecordCRC], bx
     133   mov     si, offset PartitionSector
     134   mov     bx, 4B4Dh            ; Magic: 'MK'
     135   call    MBR_GetCheckOfSector
     136   mov     [si+LocIPT_BootRecordCRC], bx
    126137   ret
    127138PART_UpdateBootRecordCRC        EndP
     139
     140; Copies the device-name to the Resume-BIOS IPT entry
     141PART_UpdateResumeBIOSName       Proc Near Uses ax bx cx si di
     142   movzx   bx, CFG_ResumeBIOSbootSeq
     143   dec     bx
     144   shl     bx, 1
     145   mov     si, wptr [ContinueBIOSbootTable+bx]
     146   mov     di, offset BIOScontIPTentry+LocIPT_Name
     147   push    di
     148      mov     cx, 11
     149      mov     al, ' '
     150      rep     stosb
     151   pop     di
     152  PURBN_BootDeviceCopyLoop:
     153      lodsb
     154      or      al, al
     155      jz      PURBN_NoResumeBootSeq
     156      stosb
     157      jmp     PURBN_BootDeviceCopyLoop
     158  PURBN_NoResumeBootSeq:
     159   ret
     160PART_UpdateResumeBIOSName       EndP
    128161
    129162; ============================================================================
     
    166199  PCMPP_NoResumeBootSeqInclude:
    167200
    168    ; Now include all Linux Kernels, if any available...
    169    movzx   cx, LINUX_KernelNo
    170    or      cx, cx
    171    jz      PCMPP_NoLinuxKernels
    172    mov     ax, offset LINUX_KernelEntries
    173   PCMPP_KernelLoop:
    174       mov     ds:[bx], ax
    175       add     bx, 2
    176       add     ax, LocIPT_LenOfIPT
    177    dec     cx
    178    jnz     PCMPP_KernelLoop
    179   PCMPP_NoLinuxKernels:
     201; [Linux support removed since v1.02]
     202;   ; Now include all Linux Kernels, if any available...
     203;   movzx   cx, LINUX_KernelNo
     204;   or      cx, cx
     205;   jz      PCMPP_NoLinuxKernels
     206;   mov     ax, offset LINUX_KernelEntries
     207;  PCMPP_KernelLoop:
     208;      mov     ds:[bx], ax
     209;      add     bx, 2
     210;      add     ax, LocIPT_LenOfIPT
     211;   dec     cx
     212;   jnz     PCMPP_KernelLoop
     213;  PCMPP_NoLinuxKernels:
    180214
    181215   movzx   cx, CFG_Partitions ; LocIPT_MaxPartitions
     
    201235; Gets a pointer to the given partition
    202236;        In: DL - Number of partition
    203 ;       Out: SI - Pointer to it (use CS)
     237;       Out: SI - Pointer to it
    204238PART_GetPartitionPointer        Proc Near   Uses bx
    205239   cmp     dl, 0FEh
     
    208242   movzx   bx, dl
    209243   shl     bx, 1
    210    mov     si, wptr cs:[PartitionPointers+bx]
     244   mov     si, wptr [PartitionPointers+bx]
    211245   ret
    212246  PGPP_IsBIOSbootSeq:
     
    250284   jb      PCTS_IsBIOSbootSeq
    251285   je      PCTS_IsFloppy
    252    cmp     ax, offset LINUX_KernelEntries
    253    jae     PCTS_IsKernelEntry
     286; [Linux support removed since v1.02]
     287;   cmp     ax, offset LINUX_KernelEntries
     288;   jae     PCTS_IsKernelEntry
    254289   sub     ax, offset PartitionTable
    255290   mov     bl, LocIPT_LenOfIPT
     
    257292   mov     dl, al
    258293   ret
    259   PCTS_IsKernelEntry:
    260    mov     dl, 0FDh
    261    ret
     294; [Linux support removed since v1.02]
     295;  PCTS_IsKernelEntry:
     296;   mov     dl, 0FDh
     297;   ret
    262298  PCTS_IsBIOSbootSeq:
    263299   mov     dl, 0FEh
     
    271307;       Out: DL - Number of partition in filtered view
    272308PART_ConvertFromStraight        Proc Near    Uses es di
     309   cmp     dl, 0FEh
     310   jb      PCFS_IsPartition
     311   mov     ax, offset BIOScontIPTentry
     312   je      PCFS_DoSearch
     313   mov     ax, offset FloppyIPTentry
     314   jmp     PCFS_DoSearch
     315  PCFS_IsPartition:
    273316   ; First we get Partition-Offset in AX
    274317   movzx   ax, dl
     
    276319   mul     bl
    277320   add     ax, offset PartitionTable
     321  PCFS_DoSearch:
    278322   ; Now search for this offset in our filtered Partition-Pointer-Table
    279323   push    cs
     
    297341; Destroyed: AX
    298342PART_GetSizeElementPointer      Proc Near   Uses bx
    299    cmp     ax, offset LINUX_KernelEntries
    300    jae     PGSEP_IsKernelEntry
     343; [Linux support removed since v1.02]
     344;   cmp     ax, offset LINUX_KernelEntries
     345;   jae     PGSEP_IsKernelEntry
    301346   mov     si, offset PartitionSizeTable
    302347   sub     ax, offset PartitionTable
    303    jmp     PGSEP_Continue
    304   PGSEP_IsKernelEntry:
    305    mov     si, offset LINUX_KernelSizeTable
    306    sub     ax, offset LINUX_KernelEntries
    307   PGSEP_Continue:
     348;   jmp     PGSEP_Continue
     349; [Linux support removed since v1.02]
     350;  PGSEP_IsKernelEntry:
     351;   mov     si, offset LINUX_KernelSizeTable
     352;   sub     ax, offset LINUX_KernelEntries
     353;  PGSEP_Continue:
    308354   mov     bl, LocIPT_LenOfIPT
    309355   div     bl                            ; Divide with IPTlength
     
    381427;              install MBR Protection, if wanted
    382428;              Special Boot Support, if needed (OS/2 Extended partitions)
     429;              Copy boot-sector to StartBase
    383430;              run boot sector...
    384431PART_StartPartition             Proc Near   Uses ax dx es di
     
    389436   call    PART_ConvertToStraight        ; ...we save straight view for later...
    390437   mov     BootPartNo, dl
     438   ; Straight - FFh -> Floppy boot
     439   ;            FEh -> BIOS continue (CD-ROM, ZIP, etc.)
    391440
    392441   ; We need straight pointers from now on, so calculate the table...
     
    397446
    398447   push    si
    399       mov     dl, cs:[si+LocIPT_Drive]
    400       mov     dh, cs:[si+LocIPT_SystemID]
     448      mov     dl, [si+LocIPT_Drive]
     449      mov     dh, [si+LocIPT_SystemID]
    401450      ; Copy Partition-Name to BootingNow area for display purposes
    402451         add     si, LocIPT_Name
     
    411460      mov     si, offset TXT_BootingNow1
    412461      call    MBR_Teletype
    413       cmp     dh, 0FDh
    414       je      PSP_IsKernel
     462; [Linux support removed since v1.02]
     463;      cmp     dh, 0FDh
     464;      je      PSP_IsKernel
    415465      or      dl, dl
    416466      jnz     PSP_IsHarddisc
     
    420470      jmp     PSP_IsFloppyCDROMetc
    421471
    422      PSP_IsKernel:
    423       IFDEF ReleaseCode
    424          ; Save configuration on HDD boots (save CFG_LinuxLastKernel)
    425          call    DriveIO_SaveConfiguration
    426       ENDIF
    427       call    MBR_Teletype       ; Prints out BootingNow2 including KernelName
    428       mov     si, offset TXT_BootingNowKernel
    429       call    MBR_Teletype
    430       jmp     PSP_IsFloppyCDROMetc
     472; [Linux support removed since v1.02]
     473;    PSP_IsKernel:
     474;      IFDEF ReleaseCode
     475;         ; Save configuration on HDD boots (save CFG_LinuxLastKernel)
     476;         call    DriveIO_SaveConfiguration
     477;      ENDIF
     478;      call    MBR_Teletype       ; Prints out BootingNow2 including KernelName
     479;      mov     si, offset TXT_BootingNowKernel
     480;      call    MBR_Teletype
     481;      jmp     PSP_IsFloppyCDROMetc
    431482
    432483     PSP_IsHarddisc:
     
    440491   pop     si                            ; restores SI (IPT-pointer)
    441492
    442    mov     ax, wptr cs:[si+LocIPT_AbsolutePartTable+0]
    443    mov     bx, wptr cs:[si+LocIPT_AbsolutePartTable+2]
    444    mov     cx, wptr cs:[si+LocIPT_LocationPartTable+1]
    445    mov     dh, bptr cs:[si+LocIPT_LocationPartTable+0]
    446    mov     dl, cs:[si+LocIPT_Drive]
     493   mov     ax, wptr [si+LocIPT_AbsolutePartTable+0]
     494   mov     bx, wptr [si+LocIPT_AbsolutePartTable+2]
     495   mov     cx, wptr [si+LocIPT_LocationPartTable+1]
     496   mov     dh, bptr [si+LocIPT_LocationPartTable+0]
     497   mov     dl, [si+LocIPT_Drive]
    447498   call    DriveIO_LoadPartition         ; Load Table...
    448499   ; --------------------------------------------------- MODIFY PARTITION TABLE
    449    push    ExecBaseSeg
     500   push    cs
    450501   pop     es
    451    mov     di, ExecBasePtr
    452    add     di, 446                ; DS:SI - Erster Partitionseintrag
     502   mov     di, offset PartitionSector+446 ; ES:DI - First Partitionentry
    453503
    454504   ; Remove all active-flags for safety reasons, primary partition table will
     
    464514
    465515   ; Put the partition-to-be-booted location into registers...
    466    mov     ax, wptr cs:[si+LocIPT_AbsoluteBegin+0]
    467    mov     bx, wptr cs:[si+LocIPT_AbsoluteBegin+2]
    468    sub     ax, wptr cs:[si+LocIPT_AbsolutePartTable+0]
    469    sbb     bx, wptr cs:[si+LocIPT_AbsolutePartTable+2]
     516   mov     ax, wptr [si+LocIPT_AbsoluteBegin+0]
     517   mov     bx, wptr [si+LocIPT_AbsoluteBegin+2]
     518   sub     ax, wptr [si+LocIPT_AbsolutePartTable+0]
     519   sbb     bx, wptr [si+LocIPT_AbsolutePartTable+2]
    470520   ; BX:AX - absolute position of partition relative to partition table
    471521   ; ...and search for it...
     
    478528     PSP_SearchMismatch:
    479529      add     di, LocBRPT_LenOfEntry     ; 16 Bytes per Partition-Entry
    480    cmp     di, 500+ExecBasePtr
     530   cmp     di, 500+offset PartitionSector
    481531   jb      PSP_SearchLoop
    482532   jmp     MBR_HaltSystem
     
    493543   ;  If yes, set magic bytes 'I13X' at 3000:0 for boot-loader to recognize.
    494544   ;  This method is (c) by IBM <g>
    495    mov     ax, wptr cs:[si+LocIPT_AbsoluteBegin+0]
    496    mov     bx, wptr cs:[si+LocIPT_AbsoluteBegin+2]
     545   mov     ax, wptr [si+LocIPT_AbsoluteBegin+0]
     546   mov     bx, wptr [si+LocIPT_AbsoluteBegin+2]
    497547   add     ax, wptr es:[di+LocBRPT_AbsoluteLength+0] ; Add length to absolute
    498548   adc     bx, wptr es:[di+LocBRPT_AbsoluteLength+2] ;  begin location
     
    515565
    516566   ; now check, if we need to hide any partition
    517    test    byte ptr cs:[si+LocIPT_Flags], Flags_HideFeature
     567   test    byte ptr [si+LocIPT_Flags], Flags_HideFeature
    518568   jz      PSP_NoHideFeature
    519569   ; --------------------------------------------------------- PARTITION HIDING
     
    532582      mov     cl, CFG_Partitions
    533583     PSP_PartitionsHideLoop:
    534          mov     dl, cs:[di]
     584         mov     dl, es:[di]
    535585         inc     di
    536586         cmp     dl, 0FFh
     
    543593      ; So something got hidden and we have to remark a primary partition,
    544594      ;  if we are booting something non-primary from 1st hdd.
    545       cmp     bptr ds:[si+LocIPT_Drive], 80h
     595      cmp     bptr [si+LocIPT_Drive], 80h
    546596      ja      PSP_HideAdjustPrimaryMark  ; When booting any hdd, but 1st
    547       mov     ax, wptr ds:[si+LocIPT_AbsolutePartTable]
    548       mov     bx, wptr ds:[si+LocIPT_AbsolutePartTable+2]
     597      mov     ax, wptr [si+LocIPT_AbsolutePartTable]
     598      mov     bx, wptr [si+LocIPT_AbsolutePartTable+2]
    549599      or      ax, ax
    550600      jnz     PSP_HideAdjustPrimaryMark  ; or booting non-primary partition
     
    565615
    566616  PSP_NoHideFeature:
     617   ; Check, if we are supposed to ignore LVM altogether...
     618   test    [CFG_IgnoreLVM], 1
     619   jnz     PSP_NoLVMReassignment
     620   ; --------------------------------------------------------- LVM REASSIGNMENT
     621      ; Driveletter must be set for this partition
     622      test    byte ptr [si+LocIPT_Flags], Flags_DriveLetter
     623      jz      PSP_NoLVMReassignment
     624      movzx   bx, BootPartNo             ; EntryNumber is straight view
     625      mov     al, bptr [DriveLetters+bx]
     626      sub     al, 3Dh                    ; Convert e.g. 80h -> 'C'
     627      cmp     al, bptr [PartitionVolumeLetters+bx]
     628      je      PSP_NoLVMReassignment      ; If driveletters match -> no change
     629      call    LVM_DoLetterReassignment   ; Give partition SI letter AL
     630  PSP_NoLVMReassignment:
    567631   push    si
    568632   ; ------------------------------------------------------- -"PLEASE WAIT..."-
     
    584648   ; -------------------------------------------------- SPECIAL BOOT PROCESSING
    585649   ; Check here, if the Boot shall be done via resume to BIOS...
    586    mov     al, bptr cs:[si+LocIPT_SystemID]
     650   mov     al, bptr [si+LocIPT_SystemID]
    587651   cmp     al, 0FEh                      ; Via BIOS ? (aka resume BIOS boot sequence)
    588652   je      PSP_ResumeBIOSbootSeq
    589    cmp     al, 0FDh                      ; Kernel-Booting ?
    590    je      PSP_KernelBooting
     653; [Linux support removed since v1.02]
     654;   cmp     al, 0FDh                      ; Kernel-Booting ?
     655;   je      PSP_KernelBooting
    591656   jmp     PSP_StartNormal
    592657
     
    597662   dw      0F000h
    598663
    599   PSP_KernelBooting:
    600    call    LINUX_LoadKernel              ; DS:SI - Entry Pointer to Kernel
    601    db      0EAh                          ; if return to here -> Reboot
    602    dw      0FFF0h
    603    dw      0F000h
    604 
    605    ; ==================================================================
    606    ;  FROM THIS POINT ON, ONLY *SI* REGISTER IS NEEDED TO BE PRESERVED
    607    ; ==================================================================
     664; [Linux support removed since v1.02]
     665;  PSP_KernelBooting:
     666;   call    LINUX_LoadKernel              ; DS:SI - Entry Pointer to Kernel
     667;   db      0EAh                          ; if return to here -> Reboot
     668;   dw      0FFF0h
     669;   dw      0F000h
     670
     671   ; =======================================================================
     672   ;  FROM THIS POINT ON, ONLY DS and SI REGISTER IS NEEDED TO BE PRESERVED
     673   ; =======================================================================
    608674
    609675  PSP_StartNormal:
    610    mov     ax, wptr cs:[si+LocIPT_AbsoluteBegin+0]
    611    mov     bx, wptr cs:[si+LocIPT_AbsoluteBegin+2]
    612    mov     cx, cs:[si+LocIPT_LocationBegin+1]
    613    mov     dh, cs:[si+LocIPT_LocationBegin+0]
    614    mov     dl, cs:[si+LocIPT_Drive]
     676   mov     ax, wptr [si+LocIPT_AbsoluteBegin+0]
     677   mov     bx, wptr [si+LocIPT_AbsoluteBegin+2]
     678   mov     cx, [si+LocIPT_LocationBegin+1]
     679   mov     dh, [si+LocIPT_LocationBegin+0]
     680   mov     dl, [si+LocIPT_Drive]
    615681   call    DriveIO_LoadPartition         ; Loads boot-sector...
    616682
    617683   test    CFG_DetectVIBR, 1
    618684   jz      PSP_NoVIBR
    619    test    byte ptr cs:[si+LocIPT_Flags], Flags_VIBR_Detection
     685   test    byte ptr [si+LocIPT_Flags], Flags_VIBR_Detection
    620686   jz      PSP_NoVIBR
    621687   ; ---------------------------------------------------------- CHECKS FOR VIBR
    622       push    ds si
    623          push    ExecBaseSeg
    624          pop     ds
    625          mov     si, offset ExecBasePtr
     688      push    si
     689         mov     si, offset PartitionSector
    626690         mov     bx, 4B4Dh               ; Magic: 'MK'
    627691         call    MBR_GetCheckOfSector
    628       pop     si ds
    629       cmp     cs:[si+LocIPT_BootRecordCRC], bx
     692      pop     si
     693      cmp     [si+LocIPT_BootRecordCRC], bx
    630694      je      PSP_NoVIBR
    631       mov     bx, cs:[si+LocIPT_BootRecordCRC]
     695      mov     bx, [si+LocIPT_BootRecordCRC]
    632696      or      bx, bx
    633697      jz      PSP_NoVIBR
     
    645709   jz      PSP_NoMBRprotect
    646710   ; -------------------------------------------------- INSTALLS MBR-PROTECTION
    647    push    si                            ; We need SI later...
     711   push    ds si                         ; We need DS:SI later...
    648712      ; First subtract 1024 bytes from Base-Memory...
    649713      push    ds
     
    658722      ; Now copy in our code (to DX:0)...
    659723
    660       mov     ax, cs
    661       mov     ds, ax
    662       mov     si, offset MBR_Protection   ; DS:SI - Source Image
     724      mov     si, offset MBR_Protection  ; DS:SI - Source Image
    663725      mov     es, dx
    664       xor     di, di                      ; ES:DI - Destination
     726      xor     di, di                     ; ES:DI - Destination
    665727      mov     cx, 512
    666       rep     movsw                       ; Move 1024 bytes...
     728      rep     movsw                      ; Move 1024 bytes...
    667729
    668730      ; Now fill in variables...
     
    671733      mov     ds, ax
    672734      mov     si, 10h*4
    673       xor     di, di                      ; INT 10h Vector to MBR Protection
     735      xor     di, di                     ; INT 10h Vector to MBR Protection
    674736      movsd
    675       mov     si, 13h*4                   ; INT 13h Vector to MBR Protection
     737      mov     si, 13h*4                  ; INT 13h Vector to MBR Protection
    676738      movsd
    677       mov     al, CFG_IgnoreWriteToMBR    ; Option to MBR Protection
     739      mov     al, CFG_IgnoreWriteToMBR   ; Option to MBR Protection
    678740      stosb
    679741
     
    683745      mov     ax, 9
    684746      mov     ds:[si], ax
    685       mov     ds:[si+2], dx               ; Vector hardcoded at DS:0009
     747      mov     ds:[si+2], dx              ; Vector hardcoded at DS:0009
    686748      ; MBR-Protection now active :)
    687    pop     si                          ; Restore SI
     749   pop     si ds                         ; Restore DS:SI
    688750
    689751   ; ------------------------------------------------ SPECIAL PARTITION SUPPORT
    690752   ; needed by OS/2 Warp / eComStation
    691753  PSP_NoMBRprotect:
    692    cmp     bptr cs:[si+LocIPT_SystemID], 08      ; I hate Microsuck NTFS check
     754   cmp     bptr [si+LocIPT_SystemID], 08 ; I hate Microsuck NTFS check
    693755   je      PSP_NoSpecialSupport
    694756
    695       push    ExecBaseSeg
    696       pop     es
    697       mov     di, ExecBasePtr            ; ES:DI - Actual Boot-Record
     757      mov     di, offset PartitionSector ; ES:DI - Actual Boot-Record
    698758      ; Special Support Detection
    699759      mov     ax, wptr es:[di+24]
     
    707767      jne     PSP_NoSpecialSupport
    708768      ; Special Support needed
    709       mov     al, bptr cs:[si+LocIPT_Drive]
     769      mov     al, bptr [si+LocIPT_Drive]
    710770      mov     bptr es:[di+36], al        ; Write Actual Drive-Letter
    711       mov     ax, cs:[si+LocIPT_AbsoluteBegin]
     771      mov     ax, [si+LocIPT_AbsoluteBegin]
    712772      mov     wptr es:[di+28], ax        ; Fixing Hidden Sectors count
    713       mov     ax, cs:[si+LocIPT_AbsoluteBegin+2]
     773      mov     ax, [si+LocIPT_AbsoluteBegin+2]
    714774      mov     wptr es:[di+30], ax        ; Done by OS/2 BootMan as well...
    715775
    716776   ; ------------------------------------------------ LOGICAL PARTITION SUPPORT
    717777  PSP_NoSpecialSupport:
    718    test    byte ptr cs:[si+LocIPT_Flags], Flags_DriveLetter
     778   test    byte ptr [si+LocIPT_Flags], Flags_DriveLetter
    719779   jz      PSP_NoLogicalSupport
    720780
    721781      movzx   bx, BootPartNo             ; EntryNumber is straight view
    722       mov     al, bptr cs:[DriveLetters+bx]
     782      mov     al, bptr [DriveLetters+bx]
    723783      mov     bptr es:[di+37], al        ; Write Drive Letter (OS/2 only)
    724784
     785   ; -------------------------------------------- COPY BOOT-RECORD TO STARTBASE
     786  PSP_NoLogicalSupport:
     787   push    si
     788      mov     ax, StartBaseSeg
     789      mov     es, ax
     790      mov     cx, 256
     791      mov     si, offset PartitionSector
     792      mov     di, StartBasePtr
     793      rep     movsw
     794   pop     si
    725795   ; ---------------------------------------------------- NOW START BOOT-RECORD
    726   PSP_NoLogicalSupport:
    727796   xor     ax, ax
    728797   xor     bx, bx
     
    732801   xor     dh, dh                        ; Drive supported by BIOS
    733802   mov     dl, cs:[si+LocIPT_Drive]      ; Drive Physical No
    734    db      0EAh                          ; JUMP TO Entry Point...Bye Bye
    735    dw      ExecBasePtr
    736    dw      ExecBaseSeg
     803   IFDEF ReleaseCode
     804      db      0EAh                          ; JUMP TO Entry Point...Bye Bye
     805      dw      StartBasePtr
     806      dw      StartBaseSeg
     807   ENDIF
    737808PART_StartPartition             EndP
    738809
     
    740811;        In: DL - Partition to hide
    741812; Destroyed: None
    742 PART_HidePartition              Proc Near   Uses ax bx cx dx si es di
     813PART_HidePartition              Proc Near   Uses ax bx cx dx si di
    743814   call    PART_GetPartitionPointer      ; Pointer to partition (DL) -> SI
    744815
    745816   ; First load the partition table of that partition...
    746    mov     ax, wptr cs:[si+LocIPT_AbsolutePartTable+0]
    747    mov     bx, wptr cs:[si+LocIPT_AbsolutePartTable+2]
    748    mov     cx, wptr cs:[si+LocIPT_LocationPartTable+1]
    749    mov     dh, bptr cs:[si+LocIPT_LocationPartTable+0]
    750    mov     dl, cs:[si+LocIPT_Drive]
     817   mov     ax, wptr [si+LocIPT_AbsolutePartTable+0]
     818   mov     bx, wptr [si+LocIPT_AbsolutePartTable+2]
     819   mov     cx, wptr [si+LocIPT_LocationPartTable+1]
     820   mov     dh, bptr [si+LocIPT_LocationPartTable+0]
     821   mov     dl, [si+LocIPT_Drive]
    751822   call    DriveIO_LoadPartition
    752823   ; Partition-Table now LOADED
    753    push    ExecBaseSeg
    754    pop     es
    755    mov     di, ExecBasePtr
    756    add     di, 446                       ; DS:SI - 1st partitionentry...
     824   mov     di, offset PartitionSector+446 ; ES:DI - 1st partitionentry...
    757825
    758826   ; Put our partition's location into registers...
    759    mov     ax, wptr cs:[si+LocIPT_AbsoluteBegin+0]
    760    mov     bx, wptr cs:[si+LocIPT_AbsoluteBegin+2]
    761    sub     ax, wptr cs:[si+LocIPT_AbsolutePartTable+0]
    762    sbb     bx, wptr cs:[si+LocIPT_AbsolutePartTable+2]
     827   mov     ax, wptr [si+LocIPT_AbsoluteBegin+0]
     828   mov     bx, wptr [si+LocIPT_AbsoluteBegin+2]
     829   sub     ax, wptr [si+LocIPT_AbsolutePartTable+0]
     830   sbb     bx, wptr [si+LocIPT_AbsolutePartTable+2]
    763831   ; BX:AX - absolute position of partition relative to partition table
    764832   ; ...and search for it...
     
    771839     PHP_SearchMismatch:
    772840      add     di, LocBRPT_LenOfEntry     ; 16 Bytes per partition entry
    773    cmp     di, 500+ExecBasePtr
     841   cmp     di, 500+offset PartitionSector
    774842   jb      PHP_SearchLoop
    775843   jmp     MBR_HaltSystem                ; not found, something is wrong here
     
    792860;  *not* the BIOS. This one *could* cause havoc to some systems, but I can't
    793861;  do anything else.
    794 ; =In this routine DS may not be equal CS=
    795 PART_MarkFirstGoodPrimary       Proc Near   Uses ax si es di
    796    push    ExecBaseSeg
    797    pop     es
    798    mov     di, ExecBasePtr
    799    add     di, 446                       ; DS:SI - First Partition-Entry
     862PART_MarkFirstGoodPrimary       Proc Near   Uses ax si di
     863   mov     di, offset PartitionSector+446 ; DS:SI - 1st partitionentry
    800864   ; First action to do: Remove the active flag from every partition
    801865   push    di
     
    827891     PMPP_Search1NoHit:
    828892      add     di, LocBRPT_LenOfEntry     ; 16 Bytes per Partition-Entry
    829    cmp     di, 500+ExecBasePtr
     893   cmp     di, 500+offset PartitionSector
    830894   jb      PMPP_Search1Loop
    831895
    832    mov     di, ExecBasePtr
    833    add     di, 446                       ; DS:SI - First Partition-Entry
     896   mov     di, offset PartitionSector+446 ; DS:SI - 1st Partition-Entry
    834897   ; Second Search, hit on anything that is not an extended partition
    835898   ;  (05 or 0Fh)
     
    844907     PMPP_Search2NoHit:
    845908      add     di, LocBRPT_LenOfEntry     ; 16 Bytes per Partition-Entry
    846    cmp     di, 500+ExecBasePtr
     909   cmp     di, 500+offset PartitionSector
    847910   jb      PMPP_Search2Loop
    848911   jmp     PMPP_SearchFailed
     
    859922;            SI - Pointer to Name (8char)
    860923; Destroyed: *none*
    861 PART_SearchFileSysName          Proc Near  Uses ds bx dx
     924PART_SearchFileSysName          Proc Near  Uses bx dx
    862925   movzx   bx, al
    863    push    cs
    864    pop     ds
    865926   mov     si, offset FileSysIDs
    866927  PSFSN_SearchLoop:
     
    892953;        In: AL - FileSysID
    893954;       Out: AL - Hidden File-System-ID
    894 PART_SearchFileSysHiddenID      Proc Near  Uses ds bx
     955PART_SearchFileSysHiddenID      Proc Near  Uses bx
    895956   movzx   bx, al
    896    push    cs
    897    pop     ds
    898957   mov     si, offset FileSysIDs
    899958  PSFSHI_SearchLoop:
Note: See TracChangeset for help on using the changeset viewer.