OSDev.org https://forum.osdev.org/ |
|
int 0x13 mov ah, 0x02 mov dl,0x00 (floppy) https://forum.osdev.org/viewtopic.php?f=15&t=33064 |
Page 1 of 1 |
Author: | GeGuNa [ Sun Jul 08, 2018 10:37 am ] |
Post subject: | int 0x13 mov ah, 0x02 mov dl,0x00 (floppy) |
hello everyone , i have one question , how to read all sectors in the floppy disk (usb/cd-dvd/usb) (1.44/2.88/360/720) ? sorry for my bad english ... |
Author: | BenLunt [ Sun Jul 08, 2018 2:28 pm ] |
Post subject: | Re: int 0x13 mov ah, 0x02 mov dl,0x00 (floppy) |
Hi, Since you have stated in the subject line, int 0x13, I will assume that you mean using the BIOS. First, using Ralf Browns Interrupt list or another reference, look at service 0x02: Code: AH = 02h AL = number of sectors to read (must be nonzero) CH = low eight bits of cylinder number CL = sector number 1-63 (bits 0-5) high two bits of cylinder (bits 6-7, hard disk only) DH = head number DL = drive number (bit 7 set for hard disk) ES:BX -> data buffer Please note that you can only read from a single track at a time. You must not assume that the BIOS will increment the C/H/S values and read past the End of the Track (EOT). It is best to code your driver/boot sector/whatever to use LBA addressing and then at the "read" level, convert to CHS values. This way you can keep track of sectors as 0,1,2,3,4,5,...2879 instead of 0/0/1, 0/0/2, 0/0/3, ... 0xFF/0xFF/0xFF. Ben - http://www.fysnet.net/media_storage_devices.htm |
Author: | azblue [ Sun Jul 08, 2018 8:14 pm ] |
Post subject: | Re: int 0x13 mov ah, 0x02 mov dl,0x00 (floppy) |
Use functions 48h and 8h to get drive parameters (so you know how big your drive is). Here's how you convert LBA to CHS: C = LBA ÷ (HPC × SPT) H = (LBA ÷ SPT) mod HPC S = (LBA mod SPT) + 1 If you're rolling your own bootloader you'll want to become familiar with Ralf Brown's Interrupt List: http://www.ctyme.com/rbrown.htm |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |