OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Mar 19, 2024 4:39 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: OSDev Floppy vs CD-ROM
PostPosted: Fri May 13, 2016 9:04 am 
Offline
Member
Member
User avatar

Joined: Sat Dec 27, 2014 9:11 am
Posts: 901
Location: Maadi, Cairo, Egypt
If you notice, most, if not all OSDev tutorials boot from a floppy disk because "it's simple." Actually, CD-ROMs are also very simple. In real mode, INT 0x13 function 0x42 is easy to use, ATA PIO mode is also easy, and ISO9660 is simpler than FAT12/16. Other than that, no PC sold today has a floppy drive.
So my question is: why do so many people still stick to floppy disks?

_________________
You know your OS is advanced when you stop using the Intel programming guide as a reference.


Top
 Profile  
 
 Post subject: Re: OSDev Floppy vs CD-ROM
PostPosted: Fri May 13, 2016 9:16 am 
Offline
Member
Member
User avatar

Joined: Wed Jul 13, 2011 7:38 pm
Posts: 558
Perceived simplicity.

People write floppy drivers because they think the old technology is going to be incredibly simple, and then their drivers work fine in emulators but completely fail on real hardware due to floppies becoming unreliable with age. They don't get the disconnect between a floppy drive that exists only in memory and one that has physical motors and magnetic fields to manipulate.

Floppies are pretty close to the top of the pile of unreliable crap. But it works in an emulator, and that's what matters.


Top
 Profile  
 
 Post subject: Re: OSDev Floppy vs CD-ROM
PostPosted: Fri May 13, 2016 9:36 am 
Offline
Member
Member

Joined: Sun Feb 01, 2009 6:11 am
Posts: 1070
Location: Germany
The one reason that would actually make sense is that floppies are writable and CD-ROMs aren't.

_________________
Developer of tyndur - community OS of Lowlevel (German)


Top
 Profile  
 
 Post subject: Re: OSDev Floppy vs CD-ROM
PostPosted: Fri May 13, 2016 10:02 am 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

omarrx024 wrote:
If you notice, most, if not all OSDev tutorials boot from a floppy disk because "it's simple." Actually, CD-ROMs are also very simple. In real mode, INT 0x13 function 0x42 is easy to use, ATA PIO mode is also easy, and ISO9660 is simpler than FAT12/16. Other than that, no PC sold today has a floppy drive.
So my question is: why do so many people still stick to floppy disks?


For floppy, I don't use any file system at all and just store "boot files" (e.g. compressed initial RAM disk thing, etc) in contiguous sectors (and use a few "LBA sector number for start of file" fields at a known location in my boot loader to find them). This is much simpler than bothering with any file system including ISO9660 (and is faster and more space efficient).

Note that (with El Torito and common tools) it's fairly easy to get CD to emulate floppy, so a boot loader for floppy is good enough to cover both device types in the early stages of an OS. The reverse (getting floppy to support El Torito and/or emulate a CD) is a little harder.

Also; it doesn't really matter what you start with. Eventually you're going to want to be able to boot from all kinds of devices (MBR partitioned disk/USB flash, GPT partitioned disk/USB flash, CD-ROM, floppy, network; then UEFI). The differences between boot loaders designed for different BIOS devices is relatively minor (it only effects the "loading from ..." and doesn't effect the code to get memory map, setup a video mode, initialise paging ready for kernel, etc); so once you've got (e.g.) a floppy boot loader it's easy to create a boot loader for the other device types because you've already done the majority of the code.

Finally; a lot of beginners simply don't have many real test machines, so what real hardware currently supports isn't as important as what emulators support. Note: for people that do have multiple real test machines, my advice is to setup PXE/network boot if you can (it makes a significant difference to the hassle and time testing takes).

Kazinsal wrote:
People write floppy drivers because they think the old technology is going to be incredibly simple, and then their drivers work fine in emulators but completely fail on real hardware due to floppies becoming unreliable with age.


Drivers have nothing to do with booting, and booting from floppy has nothing to do with writing a floppy driver. ;)


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: OSDev Floppy vs CD-ROM
PostPosted: Fri May 13, 2016 11:01 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 1150
Location: Scotland
I now work mostly on machines which have neither floppy nor CD/DVD drives, so using either of those involves having a box plugged in on a cable, making the machine less easy to pick up and move around. If you want to work on real hardware, the most sane place to start these days is therefore a USB flash drive, and it's safest to use one of the very small ones that only sticks out 5mm so that you'll never risk leaning on it by mistake, but you must do it properly using an MBR and at least one partition instead of treating it as a floppy disk.

However, there's still no harm in working with floppy disk images in an emulator to begin with, just so long as you're thinking ahead to the time when you'll want to boot from a USB flash drive instead (or from the internal hard drive): you just need to avoid creating a tangled mess where your OS is mixed into your loader, and any decent tutorial should make that clear. My own boot code can load from a floppy disk or from a partition on a flash drive without any modification (though that code isn't in the ancient version that's available online), so perhaps a tutorial setting out how to do that would be useful.

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


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: No registered users and 8 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