Page 1 of 1
CDROM Boot emulates Floppy: Size?
Posted: Sat Sep 27, 2008 9:28 am
by sebihepp
Hello everyone,
if the system boots from a CD-ROM, then it will emulating a floppy-device. But do I
have access to the hole 1440 KByte? Or is only less data accessible?
TIA Sebihepp
Re: CDROM Boot emulates Floppy: Size?
Posted: Sat Sep 27, 2008 9:39 am
by Steve the Pirate
You don't have to emulate a floppy to boot from CD - far easier is to use the El Torito standard. If you use Grub, making a boot cd image (that can be booted in Bochs, QEMU etc. or burnt to a disk) is as easy as doing the following (on Linux with Grub installed):
Code: Select all
cp /usr/lib/grub/i386-pc/stage2_eltorito image/boot/grub
mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -input-charset utf-8 -boot-info-table -o image.iso image
That's taken from the install target in the makefile. Image is the directory that has the boot directory and my kernel in it. image.iso is the resulting bootable CD image.
Re: CDROM Boot emulates Floppy: Size?
Posted: Sat Sep 27, 2008 10:11 am
by Combuster
If you use El-Torito emulation, then the BIOS will give you the space you told it to give you.
If you emulate a 1.4M floppy, then it will give you access to 1.4M
If you emulate a 720k floppy, then it will give you that
If you emulate a 30M harddisk, then it will give you that
If you ...
Re: CDROM Boot emulates Floppy: Size?
Posted: Sat Sep 27, 2008 10:14 am
by sebihepp
Thanks Combuster.
@Steve: I really want to use GRUB but I didn't get it work. I am using Windows Vista, cygwin and Bochs.
I don't know where to get a working image...
Re: CDROM Boot emulates Floppy: Size?
Posted: Sat Sep 27, 2008 12:15 pm
by Dex
It is much simpler to use floppy/hdd emulation, as all you have to do is get a working floppy image and use your cd/dvd burn software to make the cd bootable, simply click on make bootable, point it to the floppy image, it will then add 2 bin file to the cd, click to burn and you have a bootable cd, as long as your in real mode the emulation will stay as floppy (eg any code that reads the floppy using int 13h, will read from the cd), once you go to pmode emulation stops, but if you return to real mode emulation starts again.
What could be simpler ?.
Re: CDROM Boot emulates Floppy: Size?
Posted: Sat Sep 27, 2008 12:21 pm
by sebihepp
That's the way I do it right now.
Hmmm, I can't access the emulated Floppy in PMode, right? I could load the entire
floppy into memory. Very efficient.
But... why not... Only for testing ^^
Re: CDROM Boot emulates Floppy: Size?
Posted: Tue Sep 30, 2008 8:17 am
by Dex
sebihepp wrote:That's the way I do it right now.
Hmmm, I can't access the emulated Floppy in PMode, right? I could load the entire
floppy into memory. Very efficient.
But... why not... Only for testing ^^
In my OS i have two floppy drivers, one a normal pmode driver and the second a go back to real mode and back every 512bytes, this may seem slow but is not noticable slower than read/writing from pmode.
This mean i can read files from the cd (under floppy emulation) just like as if it was a normal floppy.
The above also works fine for read/writing to USB fobs.
Re: CDROM Boot emulates Floppy: Size?
Posted: Tue Sep 30, 2008 8:53 am
by AJ
Hi,
I know that the RMode -> PMode -> RMode switches probably don't affect percieved speed as Dex says, but personally, I would recommend reading as much as possible from the disk for each RMode switch rather than just 512b.
My floppy reading routine reads a single sector at a time, but is wrapped in RMode and it increments the destination buffer segment in a loop, allowing the driver to read 508K per real mode switch (I use physical memory between 0x1000 and 0x80000 bytes as my buffer). Although the end user will see about the same speed for a FDD or CD, the CPU is having to do far less work and I guess could give a speed benefit with USB key drives.
Cheers,
Adam
Edit: This assumes you are able to reserve such a large low memory buffer, of course! The RMode code for this is really quite small, though, and can be either copied down to the 0x500->0x1000 location before you perform disk access, or can reside there permanently having been linked there as part of your ELF/COFF executable.
Re: CDROM Boot emulates Floppy: Size?
Posted: Tue Sep 30, 2008 12:26 pm
by Dex
I would agree with you there AJ, but it does help keep interrupts being off in pmode down to the smallest time, so its swings and round abouts.
Re: CDROM Boot emulates Floppy: Size?
Posted: Wed Oct 08, 2008 5:30 am
by mystran
Alternatively, once you are in protected mode, can't you just read the CD as if it was a CD?
Ok, you need a CD driver for that.. but still..