Ignore:
Timestamp:
Apr 13, 2014, 3:50:38 PM (12 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 !
Note: See TracChangeset for help on using the changeset viewer.