About USB Disk Drives

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.
darklight
Posts: 11
Joined: Mon Oct 15, 2007 3:12 am

Post by darklight »

Thanks everybody that heard my voice )))

I want to talk about simulation.
Simulation is doing BIOS. But can Windows do simulation? If yes, I think that it doing by another way, isn't it? If so, whence can I know how many heads, etc. simulates BIOS??? If I'm reading by LBA there is no problem. But I don't think so...
And please tell me how can I access Flash Disk through LBA?(or give a link to tutorial)

Here is the BPB generated by Windows Formatter:

Code: Select all

4D 53 44 4F 53 35 2E 30 00 02 20 04 00 02 00 02 00 00 F8 F2 00 3F 00 FF 00 3F 00 00 00 C1 3B 1E 00 00 00 29 F0 18 71 FC 4E 4F 20 4E 41 4D 45 20 20 20 20 46 41 54 31 36 20 20 20
Here is partition table:

Code: Select all

80 01 01 00 06 FE 3F 7A 3F 00 00 00 C1 3B 1E 00 00 00
P.S. I know that in my code is a logical bug))), and thanks to Dex for links

And my bootloader(nasm -f bin ....)(I'm replaceing only first needed bytes of sector with my bootloader):
Attachments
bootloader.zip
(620 Bytes) Downloaded 175 times
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Candy wrote:
Dex wrote:Yes it users CHS, but i can not understand the problem ?, do you want to know the "how many cylinders, heads, heads per cylinder, tracks per head, sectors per track" for your USB fob if so, do as i pointed out above to this:
You only answer the subset where the USB disk is FAT16 formatted and not partitioned - half the disks I've had were partitioned and I've regularly formatted them with something else (ext3, ntfs, *fs) which all don't happen to have a BPB.

Any ideas on how to do it other than reading nonpresent information in a specific file system?
Your right candy, but in my defence, the available info in his partion table, pointed to the first partion be bootable and fat16.
But for his real bootloader, he would need to do more.
darklight
Posts: 11
Joined: Mon Oct 15, 2007 3:12 am

Post by darklight »

Has anybody seen my code? (sorry for short question)
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

Post by os64dev »

nope(sorry for short answer) :wink:
Author of COBOS
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Yes, where do you popa here ?

Code: Select all

        pusha ; This is the pusha, but wheres the popa ?
        mov		bp, loaded
		mov		ax, 0x1301
		mov		bx, 7
		mov		cx, 10
		mov		dx, 0x0302
		int		0x10
		;call	waitkey

		jmp		0x0000:0x1000
darklight
Posts: 11
Joined: Mon Oct 15, 2007 3:12 am

Post by darklight »

LOOOL(I forgot to place there). But I tried and with popa but IT IS NOT WORKING. I think that problem is in int 13h ah=2. How can I use lba? I've read somwhere that int 13h have ah=0x4 function that is using lba. But when I read The Art of Assembly Language, there was written, that ah=4 func is doing anything else(I can't remember that).
User avatar
elderK
Member
Member
Posts: 190
Joined: Mon Dec 11, 2006 10:54 am
Location: Dunedin, New Zealand
Contact:

Post by elderK »

Hey Darklight, This question interested me so, I did some searching around online and this, so far, this is the only nugget of glee I could find...

Hopefully it helps out.

http://www.ctyme.com/intr/rb-0677.htm

~Z
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

darklight wrote:LOOOL(I forgot to place there). But I tried and with popa but IT IS NOT WORKING. I think that problem is in int 13h ah=2. How can I use lba? I've read somwhere that int 13h have ah=0x4 function that is using lba. But when I read The Art of Assembly Language, there was written, that ah=4 func is doing anything else(I can't remember that).
I think that should be
IBM/MS extended BIOS disk services (INT 13h services 4?h)

As in this link http://freedos-32.sourceforge.net/showd ... e=biosdisk
Try int 13h ah = 42h or 43h or 48h etc, See here: http://www.ctyme.com/intr/rb-0708.htm#Table272

[EDIT] This may help you
Attachments
lba.asm
(6.25 KiB) Downloaded 107 times
1234
Posts: 24
Joined: Sat May 26, 2007 7:58 pm

Post by 1234 »

[post deleted]
Last edited by 1234 on Wed Nov 21, 2007 4:23 pm, edited 1 time in total.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

mikegonta wrote:
  • offset 3 (OEM ID) must be db "NTFS"
or
  • offset 24 (Sectors Per Track) must be non zero
    offset 26 (Number Of Heads) must be non zero
    offset 53 (File System Type) must be db "FAT"
I haven't tried all possible file system acronyms, but it seems strange that the bios would require a file system identifier in order for the media to be bootable.

Mike Gonta
I have know idea if this is true, but it make sence, as i have alway found that formating the fob + add sys files under windows, works best for booting from usb fobs.
darklight
Posts: 11
Joined: Mon Oct 15, 2007 3:12 am

Post by darklight »

Hi people. I have successfully booted from usb. I have played with int 13h AH=2 function parameters and it worked. I think that between floopy and hdd simulation the difference is very small))) My BIOS is simulating as hdd and also as floppy. I tried without declaring partition table, and with declaring partition table, both are working!!!

Thanks every body for information and help! See you later...
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Post by JAAman »

darklight wrote:Hi people. I have successfully booted from usb. I have played with int 13h AH=2 function parameters and it worked. I think that between floopy and hdd simulation the difference is very small))) My BIOS is simulating as hdd and also as floppy. I tried without declaring partition table, and with declaring partition table, both are working!!!

Thanks every body for information and help! See you later...
the bios doesnt care if there is a partition table or not -- the bios will quite happily boot a FDD with a partition table, or a HDD without one...

the only difference between FDD emulation and HDD emulation, is that the later will allow you to use the HDD bios calls (which can use either CHS or LBA) and FDD emulation will only use the FDD bios call (which cannot use LBA, iirc)

for information on the bios calls (including the LBA calls) check the ultimate BIOS call reference -- the RBIL -- http://www.cs.cmu.edu/~ralf/files.html -- there is a online version, but i seem to have lost my link to it...
Post Reply