Changeset 103


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

Its complement for writing to disk using INT13X [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

    r102 r103  
    773773
    774774DriveIO_ReadSectorLBA       EndP
     775
     776
     777
     778;##############################################################################
     779;# ACTION   : Writes a sector to disk using INT13 extensions
     780;# ----------------------------------------------------------------------------
     781;# IN       : AL    - write flags, AL.0 verify (1.0,2.0), AL.1 verify (2.1+)
     782;#          : BX:CX - LBA address of sector
     783;#          : DI:SI - SEG:OFF of transfer buffer
     784;# ----------------------------------------------------------------------------
     785;# OUT      : CF=1  - failure, AH failure code
     786;# ----------------------------------------------------------------------------
     787;# EFFECTS  : Modifies DAP structure and mofifies the disk
     788;##############################################################################
     789DriveIO_WriteSectorLBA      Proc Near  Uses bx cx dx si di ds es
     790
     791        ; Mask reserved bits for wrte flags -- should check version here
     792        and     al, 03h
     793
     794        ; One sector to read
     795        mov     cs:[DriveIO_DAP_NumBlocks], 1
     796
     797        ; Setup transfer address
     798        mov     wptr cs:[DriveIO_DAP_Transfer+0], si    ; offset
     799        mov     wptr cs:[DriveIO_DAP_Transfer+2], di    ; segment
     800
     801        ; Setup LBA64 address of requested sector
     802        mov     wptr cs:[DriveIO_DAP_Absolute+0], cx    ; low word lower part
     803        mov     wptr cs:[DriveIO_DAP_Absolute+2], bx    ; high word lower part
     804        mov     wptr cs:[DriveIO_DAP_Absolute+4], 0     ; low word upper part
     805        mov     wptr cs:[DriveIO_DAP_Absolute+6], 0     ; high word upper part
     806
     807        ; Address of packet
     808        mov     si, offset [DriveIO_DAP]                ; disk address packet
     809
     810        ; Do the extended write
     811        mov     ah, 43h                                 ; write function
     812        int     13h                                     ; transfer to bios
     813
     814        ; Error occured
     815        jc      DriveIO_WriteSectorLBA_exit
     816
     817        ; AH should also be zero
     818        test    ah, ah
     819        stc
     820        jnz     DriveIO_WriteSectorLBA_exit
     821
     822        ; Disk write succeeded, clear CF
     823        clc
     824
     825    DriveIO_WriteSectorLBA_exit:
     826        ret
     827
     828DriveIO_WriteSectorLBA      EndP
    775829
    776830
Note: See TracChangeset for help on using the changeset viewer.