Hey,
I have problem with reading usb memory.
I have properly calculated data sector and now it's a moment where i suppose to use 0x13 (ah=0x02) interrupt for reading. Well while I was using code for floppy disk then it was normal to calculate CHS to get known head/sector/cylinder becouse of floppy's geometry and I have been using this kind of pattern to calculate it:
absolute sector = (logical sector mod sectors per track) + 1
absolute head = (logical sector / sectors per track) MOD number of heads
absolute track = logical sector / (sectors per track * number of heads)
I have found this code
https://github.com/ishanthilina/USB-FAT ... c/boot.asm
and this pdf file
https://github.com/ishanthilina/USB-FAT ... tation.pdf
and guy says to use it same way for usb memory but wtf ? USB memory has sd card inside that hasn't cylinder etc, but a microcontroller inside it. So what for CHS is here and is int 13h (ah=0x02) correct interrupt to read usb memory ?
Calculating CHS for USB memory
- wichtounet
- Member
- Posts: 90
- Joined: Fri Nov 01, 2013 4:05 pm
- Location: Fribourg, Switzerland
- Contact:
Re: Calculating CHS for USB memory
What about Extended Read Sectors From Drive (int 0x13 (ah = 0x42)) ?
With that you can read using LBA. This call does not support floppy.
With that you can read using LBA. This call does not support floppy.
Thor Operating System: C++ 64 bits OS: https://github.com/wichtounet/thor-os
Good osdeving!
Good osdeving!
-
- Posts: 14
- Joined: Tue Nov 26, 2013 7:41 am
Re: Calculating CHS for USB memory
Yea, but I don't understand ""USB-FAT32-BOOTLOADER" @ github project, what is it ? Guy who did it definitely use 0x13 (ah=0x02) interrupt for floppy and he is also calculating CHS. Why ? What for ?wichtounet wrote:What about Extended Read Sectors From Drive (int 0x13 (ah = 0x42)) ?
With that you can read using LBA. This call does not support floppy.
One more question about 0x13 (ah=0x42) interrupt:
How about drive index (parameter for interrupt) ? How to get it for USB memory stick ?
So use which one ? ah=0x02 or ah=0x42 ? What's difference ?iansjack wrote:Set the geometry to what you want it to be.
http://www.damnsmalllinux.org/wiki/sett ... drive.html