Does ah 02h work with ssds when interrupting 13h
- User
Does ah 02h work with ssds when interrupting 13h
- Assistant
Does ah 02h work with ssds when interrupting 13h
Yes, invoking interrupt 13h with AH = 02h (the BIOS function to read sectors from a drive) typically works with solid-state drives (SSDs). The BIOS provides a layer of abstraction between software and the storage hardware, allowing software to perform disk operations without needing to know the specifics of the underlying hardware—whether it's a traditional spinning hard disk drive (HDD) or an SSD.
Here's why AH = 02h works with SSDs when using interrupt 13h:
BIOS Abstraction: The BIOS's disk services abstract the hardware details. When you call INT 13h with AH = 02h, the BIOS translates this request into the necessary commands to read sectors from the drive, regardless of the drive type.
Compatibility: To maintain backward compatibility with legacy software and bootloaders, modern BIOS (or UEFI firmware with Compatibility Support Module enabled) still supports these traditional BIOS interrupts and functions.
CHS Addressing: While SSDs don't have physical cylinders, heads, and sectors like HDDs, the BIOS emulates CHS addressing for compatibility. It maps CHS requests to Logical Block Addressing (LBA), which is how modern drives (including SSDs) are accessed.
Boot Process: During the initial boot phase, before any advanced drivers are loaded, the system relies on BIOS interrupts to read from the boot device. This process works with SSDs, ensuring that operating systems can boot from SSDs just as they do from HDDs.
Considerations:
UEFI Systems: On systems using UEFI without the Compatibility Support Module (CSM), traditional BIOS interrupts like INT 13h may not be available. In pure UEFI mode, disk access during boot is handled differently, using UEFI protocols instead of BIOS interrupts.
Extended INT 13h Functions: For drives larger than what can be addressed with traditional CHS (typically beyond 8GB), you might need to use the Extended INT 13h functions (with AH values starting from 41h). These functions support LBA and can handle larger drives more effectively.
In summary, when working within a BIOS environment (or UEFI with CSM), using AH = 02h with INT 13h to read sectors from a drive should work seamlessly with SSDs. The BIOS takes care of the necessary translations and hardware interactions, providing a consistent interface for disk operations.
Example Usage:
mov ah, 02h ; BIOS function to read sectors
mov al, number_of_sectors_to_read
mov ch, cylinder ; Cylinder number
mov cl, sector ; Sector number
mov dh, head ; Head number
mov dl, drive ; Drive number (80h for first hard drive)
mov bx, buffer ; Buffer to store data
int 13h ; BIOS disk service interrupt
jc read_error ; Handle error if carry flag is set
Note: Ensure that you handle potential errors and consider using Extended INT 13h functions for larger or modern drives when appropriate.
Not yet included in a published release.