OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 9:39 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: int 0x13 mov ah, 0x02 mov dl,0x00 (floppy)
PostPosted: Sun Jul 08, 2018 10:37 am 
Offline

Joined: Sun Apr 02, 2017 11:43 am
Posts: 12
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 ...


Top
 Profile  
 
 Post subject: Re: int 0x13 mov ah, 0x02 mov dl,0x00 (floppy)
PostPosted: Sun Jul 08, 2018 2:28 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 934
Location: USA
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


Top
 Profile  
 
 Post subject: Re: int 0x13 mov ah, 0x02 mov dl,0x00 (floppy)
PostPosted: Sun Jul 08, 2018 8:14 pm 
Offline
Member
Member

Joined: Sat Feb 27, 2010 8:55 pm
Posts: 147
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group