Calculating CHS for USB memory
Posted: Tue Dec 10, 2013 2:48 am
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 ?
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 ?