OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 11:42 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Is int 13 extension for usb? [solved]
PostPosted: Tue May 12, 2020 11:11 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
Good day,

I tested that bios int 13h extension ah=42h work on emulators and my computer. But when I try to read from usb, it report error on my computer(on emulators I test my operation system as floppy disc, so I cant test reading by extension). Please, is there any way how read and write to usb on real computer by bios extension?

//EDIT: I think that bios emulate my usb like floppy because dl value after start is 0x00. Please how I can change my usb to hdd emulate or cdrom emulate?

_________________
https://github.com/VendelinSlezak/BleskOS


Last edited by Klakap on Thu May 14, 2020 6:29 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Is int 13 extension for usb?
PostPosted: Tue May 12, 2020 1:31 pm 
Offline
Member
Member
User avatar

Joined: Sun Feb 18, 2007 7:28 pm
Posts: 1564
Hi,

The firmware emulates USB devices in SMM as a floppy or hard disk device. Some systems only support one type of emulation whereas other systems support both and may even have an option to select in BIOS Settings. That is where you would go to check what type of emulation is enabled for USB boot -- BIOS Settings.

If it is emulated as a floppy device, use the standard int 13h function 2 service. If hard disk, use int 13h function 42h. Only use the device number provided by the BIOS in DL.

_________________
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}


Top
 Profile  
 
 Post subject: Re: Is int 13 extension for usb?
PostPosted: Tue May 12, 2020 9:05 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 934
Location: USA
neon is correct, though may I add a little more.

Some BIOSes will read the device and see what is already there. For example, if there is a FAT BPB that describes a 1.44meg floppy, the BIOS will use that emulation. If there is a FAT BPB that describes a hard disk drive, it will use a hard disk emulation.

If it doesn't recognize the media format, it may guess. However, more times than not, it will take the fail option.

There is not a standard to what the USB emulation must do, so it is up to the BIOS manufacturer to do as they wish.

Why no standard? The BIOS (firmware) manufacturers are trying to get away from the Legacy system. Why create a standard for something that is more than 20 years old?

With numerous tests, myself and others, the findings are that to be mostly compatible, make sure the USB thumb drive is formatted with a valid FAT file system, either as a 1.44meg floppy or a "smallish" hard drive image. The 1.44meg floppy image *must not* have a MBR and the hard drive image most likely must have a MBR.

Ben
- http://www.fysnet.net/the_universal_serial_bus.htm


Top
 Profile  
 
 Post subject: Re: Is int 13 extension for usb?
PostPosted: Thu May 14, 2020 6:03 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
BenLunt wrote:
With numerous tests, myself and others, the findings are that to be mostly compatible, make sure the USB thumb drive is formatted with a valid FAT file system, either as a 1.44meg floppy or a "smallish" hard drive image. The 1.44meg floppy image *must not* have a MBR and the hard drive image most likely must have a MBR.
Please don't listen to this advice. Forget about floppies already! We're in the XXI. century!

Don't waste your USB storage and limit its capacity to 1.44 M. If your BIOS has a floppy emulation option, turn it off; put a partitioning table in the first sector with 55AAh magic and the INT 13 / AH=42 lba packet reading will work, guaranteed. I've never seen any hw that didn't handle that. And if by any chance your hw won't handle USB storage like that, then you should update your BIOS anyway because it must have other bugs as well.

Cheers,
bzt


Top
 Profile  
 
 Post subject: Re: Is int 13 extension for usb?
PostPosted: Thu May 14, 2020 6:29 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
Thank a milion for all reply! It were very useful. After remove BPB BIOS emulate usb like hard disk with number 0x80 and all work fine.

_________________
https://github.com/VendelinSlezak/BleskOS


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 106 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