Changeset 110


Ignore:
Timestamp:
Apr 8, 2017, 12:27:07 AM (8 years ago)
Author:
Ben Rietbroek
Message:

Use the LBA read/write functions in load/save sector [v1.1.1-testing]

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.0-manual.pdf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bootcode/regular/driveio.asm

    r105 r110  
    475475; #########################################################################
    476476DriveIO_LoadSector      Proc Near  Uses ax bx cx dx ds si es di
     477
    477478        ; Is the drive not a harddrive?
    478479        cmp     dl, 80h
     
    504505        dec     di
    505506        jnz     DIOLS_ErrorLoop
     507
    506508        ; Sector load failed...
    507509        jmp     DriveIO_GotLoadError
    508510
    509511    DIOLS_UseExtension:
    510         push    cx
    511         mov     cs:[INT13X_DAP_NumBlocks], 1         ; Copy ONE sector
    512         mov     wptr cs:[INT13X_DAP_Transfer+0], si
    513         mov     cx, ds
    514         mov     wptr cs:[INT13X_DAP_Transfer+2], cx  ; Fill out Transfer Adress
    515         mov     wptr cs:[INT13X_DAP_Absolute+0], ax
    516         mov     wptr cs:[INT13X_DAP_Absolute+2], bx  ; Fill out Absolute Sector
    517         push    cs
    518         pop     ds
    519         mov     si, offset [INT13X_DAP]
    520         mov     ah, 42h                              ; Extended Read
    521         int     13h
    522         pop     cx
    523         jnc     DIOLS_Success
     512
     513        mov     di, ds                  ; segment for transfer address
     514        mov     cx, ax                  ; low word of lba
     515        call    DriveIO_ReadSectorLBA   ; extended read
     516        jc      DriveIO_GotLoadError    ; halt on error
     517
     518        ;~ push    cx
     519        ;~ mov     cs:[INT13X_DAP_NumBlocks], 1         ; Copy ONE sector
     520        ;~ mov     wptr cs:[INT13X_DAP_Transfer+0], si
     521        ;~ mov     cx, ds
     522        ;~ mov     wptr cs:[INT13X_DAP_Transfer+2], cx  ; Fill out Transfer Adress
     523        ;~ mov     wptr cs:[INT13X_DAP_Absolute+0], ax
     524        ;~ mov     wptr cs:[INT13X_DAP_Absolute+2], bx  ; Fill out Absolute Sector
     525        ;~ push    cs
     526        ;~ pop     ds
     527        ;~ mov     si, offset [INT13X_DAP]
     528        ;~ mov     ah, 42h                              ; Extended Read
     529        ;~ int     13h
     530        ;~ pop     cx
     531        ;~ jnc     DIOLS_Success
     532
    524533        ; Sector load failed...
    525         jmp     DriveIO_GotLoadError
     534        ;~ jmp     DriveIO_GotLoadError
    526535
    527536    DIOLS_Success:
     
    893902        cmp     bptr cs:[LBASwitchTable+di], bl
    894903        jbe     DIOSS_UseExtension
     904
    895905    DIOSS_UseNormal:
    896906        mov     di, 3
     
    907917
    908918    DIOSS_UseExtension:
    909         push    cx
    910         mov     cs:[INT13X_DAP_NumBlocks], 1         ; Copy ONE sector
    911         mov     wptr cs:[INT13X_DAP_Transfer+0], si
    912         mov     cx, ds
    913         mov     wptr cs:[INT13X_DAP_Transfer+2], cx  ; Fill out Transfer Adress
    914         mov     wptr cs:[INT13X_DAP_Absolute+0], ax
    915         mov     wptr cs:[INT13X_DAP_Absolute+2], bx  ; Fill out Absolute Sector
    916         push    cs
    917         pop     ds
    918         mov     si, offset [INT13X_DAP]
    919         mov     ax, 4300h                            ; Extended Write (No Verify)
    920         int     13h
    921         pop     cx
    922         jnc     DIOSS_Success
    923         call    MBR_SaveError
     919
     920        mov     di, ds                  ; segment for transfer address
     921        mov     cx, ax                  ; low word of lba
     922        xor     ax, ax                  ; no verify
     923        call    DriveIO_WriteSectorLBA  ; extended write
     924        jc      MBR_SaveError           ; halt on error
     925
     926        ;~ push    cx
     927        ;~ mov     cs:[INT13X_DAP_NumBlocks], 1         ; Copy ONE sector
     928        ;~ mov     wptr cs:[INT13X_DAP_Transfer+0], si
     929        ;~ mov     cx, ds
     930        ;~ mov     wptr cs:[INT13X_DAP_Transfer+2], cx  ; Fill out Transfer Adress
     931        ;~ mov     wptr cs:[INT13X_DAP_Absolute+0], ax
     932        ;~ mov     wptr cs:[INT13X_DAP_Absolute+2], bx  ; Fill out Absolute Sector
     933        ;~ push    cs
     934        ;~ pop     ds
     935        ;~ mov     si, offset [INT13X_DAP]
     936        ;~ mov     ax, 4300h                            ; Extended Write (No Verify)
     937        ;~ int     13h
     938        ;~ pop     cx
     939        ;~ jnc     DIOSS_Success
     940        ;~ call    MBR_SaveError
    924941
    925942    DIOSS_Success:
Note: See TracChangeset for help on using the changeset viewer.