How can I read other sectors from USB disk?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Levent
Posts: 4
Joined: Thu May 23, 2013 7:13 am

How can I read other sectors from USB disk?

Post by Levent »

I mean I can wirte my boot to the first sector of USB and In my boot code I will read other sectors which contains the 2nd stage(loader) . But I don't know how to read these sectors . which Bios int should I use ? Are there other ways ?Who can help me ?
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: How can I read other sectors from USB disk?

Post by Mikemk »

Levent wrote:I mean I can wirte my boot to the first sector of USB and In my boot code I will read other sectors which contains the 2nd stage(loader) .
(SIC). That's the common method...
But I don't know how to read these sectors .
Obviously.
which Bios int should I use ?
Try 0x13, ah = 2 or 0x42
Are there other ways ?
Yes, but they won't fit in a bootloader.
Who can help me ?
Yourself.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
Levent
Posts: 4
Joined: Thu May 23, 2013 7:13 am

Re: How can I read other sectors from USB disk?

Post by Levent »

Thank you ,m12! I will have a try. Hopefully it will work.
Levent
Posts: 4
Joined: Thu May 23, 2013 7:13 am

Re: How can I read other sectors from USB disk?

Post by Levent »

I did it ! I use int 0x13, ah=0x42 (LBA mode), drive number is 0x82 (0x80 is the hard disk in my computer,0x81 may be the slave hard disk from which I failed to read a sector. So I tried 0x82,and it worked!)
Different motherboards support different ways of usb boot, the bios on my motherboard read the first sector of usb disk.But other bioses may not read the first sector of usb disk. You'd better figure out which sector bios reads . :D :D :D
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: How can I read other sectors from USB disk?

Post by Griwes »

Don't "try" disk numbers, use what was passed in dl upon passing control to the bootloader. It's 101 of every sane bootloader tutorial...
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
Levent
Posts: 4
Joined: Thu May 23, 2013 7:13 am

Re: How can I read other sectors from USB disk?

Post by Levent »

Griwes wrote:Don't "try" disk numbers, use what was passed in dl upon passing control to the bootloader. It's 101 of every sane bootloader tutorial...
Can you tell me more about it ? I am a newbie.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: How can I read other sectors from USB disk?

Post by Mikemk »

Levent wrote:
Griwes wrote:Don't "try" disk numbers, use what was passed in dl upon passing control to the bootloader. It's 101 of every sane bootloader tutorial...
Can you tell me more about it ? I am a newbie.
Try learning assembly...
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
Post Reply