CanI use int 13h function 42h to read more than 1mb of disk
CanI use int 13h function 42h to read more than 1mb of disk
theoretically you can specify the number of sectors you want to read from 0 - 65535 but how many can you actually read at once ? is this interrup limited to addressing memory that it's linear locarion is no bigger than 1mb ( 2 ^ 20 default real mode maximum memory size ) or does it using unreal mode or something like that and can read even 65535 sectors (16mb to the ram).
Last edited by elad on Sat Oct 26, 2024 7:42 pm, edited 1 time in total.
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: CanI use int 13h function 42h to read more than 1mb of d
Theoretically, you can read up to 65535 sectors using this function, as the sectors count fields in the disk address packet structure is 16 bits wide. However, in practice, the majority of BIOSes, including Bochs, QEMU and one of my real PCs, don't allow you to cross a segment boundary. This depends on your segment:offset combinations. Assuming you're using a specific segment with offset 0, the maximum value is 127 sectors for most BIOSes. For compatibility's sake, you should split up large accesses into smaller accesses, each 127 sectors (or less) in size.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: CanI use int 13h function 42h to read more than 1mb of d
Hi,
For "absolute theoretical maximum", if you can invent/create a device where each sector is 4 GiB and find a computer where EDD is "very broken", you could load 262140 GiB.
Also note that I'd expect the firmware to use the controller's DMA/bus mastering to load data directly into the physical address you requested without using the CPU (and without needing unreal mode or protected mode); but there's no guarantee that the BIOS will do that, and there's no guarantee that the BIOS won't (e.g.) switch to protected mode or long mode (and do the transfer with PIO) and switch back to real mode after.
Cheers,
Brendan
The maximum you can read at once depends on multiple things (which firmware, which device, etc). If you look at the Enhanced Disk Drive Specifications (at least up to version 3.0) you'll find that the "number of blocks to transfer" field is a 1 byte field (followed by a reserved byte that must be zero), and the specification will say:elad wrote:theoretically you can specify the number of sectors you want to read from 0 - 65535 but how many can you actually read at once ? does this interrup is limited to only addressing memory that it's linear loc is no bigger than 1mb ( 2 ^ 20 default real mode maximum memory size) or does it using unreal mode or something like that and can read even 65535 sectors (16mb to the ram) sorry for my english.
- "Number of blocks to transfer. This field has a maximum value of 127 (7Fh). If a value greater than 127 is supplied the request is rejected with CF=1 and AH=01. A block count of 0 means no data will be transferred."
For "absolute theoretical maximum", if you can invent/create a device where each sector is 4 GiB and find a computer where EDD is "very broken", you could load 262140 GiB.
Also note that I'd expect the firmware to use the controller's DMA/bus mastering to load data directly into the physical address you requested without using the CPU (and without needing unreal mode or protected mode); but there's no guarantee that the BIOS will do that, and there's no guarantee that the BIOS won't (e.g.) switch to protected mode or long mode (and do the transfer with PIO) and switch back to real mode after.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.