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

Added function to validate BIOS disk number [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

    r119 r120  
    18701870
    18711871
     1872;------------------------------------------------------------------------------
     1873; Check if the BIOS disk number in DL is a harddisk and in range
     1874;------------------------------------------------------------------------------
     1875; IN    : DL BIOS disk number (80h etc)
     1876; OUT   : CF=1 if invalid disk number or out of range
     1877; NOTE  : Only modifies flags
     1878;------------------------------------------------------------------------------
     1879DriveIO_IsValidHarddisk     Proc    Near    Uses dx
     1880        cmp     dl, 80h                 ; BIOS disk number must be at least 80h
     1881        jb      @F                      ; Not a harddisk, exit with CY
     1882        mov     dh, dl                  ; Save to do compare
     1883        sub     dh, 80h                 ; Now 0 based disk number
     1884        inc     dh                      ; Now 1 based disk number
     1885        cmp     [TotalHarddiscs], dh    ; Out of range, exit with CY
     1886    @@: ret
     1887DriveIO_IsValidHarddisk     EndP
     1888
    18721889
    18731890; Values for sectors per track table corresponding to DriveIO_IsHugeDrive return value.
Note: See TracChangeset for help on using the changeset viewer.