Page 1 of 2

Loading a memory address from a cd rom

Posted: Sun Jan 07, 2007 8:04 am
by Jabus
Hi. I'm very new to OS developing and I have just made a bootloader that will load the address 0x2000 where the kernel is located. However as my computer does not have a floppy drive I can't make a bootable floppy. I have made a bootable cd using nero burning rom and put the basic bootloader on using the wizard. However is there a way of loading a memory address using Int 13h because as far as I'm aware Int 13h can only load addresses from a floppy drive or hardrive. Also is there a way to make sure that my kernel is written to 0x2000? Thank you for your help in advance.

Posted: Sun Jan 07, 2007 8:39 am
by Otter
Most BIOS can read data from cd rom, using extended functions of int 13h, for example ah=0x42 (extended read). There are also functions for checking if these functions are present ( ah=0x41, bx = 0x55aa ).

Check Ralph Browns Interrupt List

Posted: Sun Jan 07, 2007 9:15 am
by Combuster
related topic you might want to read:
http://www.osdev.org/phpBB2/viewtopic.php?t=12583

Posted: Sun Jan 07, 2007 11:40 am
by Dex
@Jabus, When you burn the CD with the floppy image, it emulates the floppy, so if you write your bootable floppy image to load from a address, it will work the same from the CD.
When your code is in real mode the real floppy drive becomes B:\ and emulated is A:\
Once you go to pmode emulation stops. you can also stop emulation in real mode by calling a certain int.
NOTE: If you do not stop emulation in real mode and go to pmode, if you return to realmode emulation starts again, this is good for loading from USB fobs that also use emulation of floppy/hdd.

Posted: Sun Jan 07, 2007 11:56 am
by Otter
If you don't want to use emulation:
El Torito does not define the first 16 sectors of the cd, that means if your kernel is not bigger than 32 kb, you can put it into the first sectors of the CD.

Posted: Mon Jan 08, 2007 2:50 am
by Jabus
Thank you very much for your help. I'm going to try it now.

EDIT: Just a quick question but a cd emulated as a floppy would use the fat12 file system wouldn't it?

Posted: Mon Jan 08, 2007 7:11 am
by Brynet-Inc
Jabus wrote:Thank you very much for your help. I'm going to try it now.

EDIT: Just a quick question but a cd emulated as a floppy would use the fat12 file system wouldn't it?
The cd-rom emulation of a floppy emulates a floppy.. the file system used on the floppy doesn't matter. :roll:

Posted: Mon Jan 08, 2007 1:23 pm
by Dex
If you have used a fat12 for your bootable floppy, that will work fine under emulation.

Posted: Tue Jan 09, 2007 12:23 pm
by Jabus
I'm sorry if the following question is a stupid question.

All the tutorials and articles on writing a bootloader seem to be about making a fat12 bootloader (at least this is what I think they are doing) when I made my own bootloader I made a bootable cd rom and usedmy bootloader as the image however it didn't work. I then tried a bootloader that was made in a tutorial and copied the image directly from the tutorial and used that image as the image for the bootable cd rom, however this also failed. Do I need to format the cd rom so that it usees the fat12 filesystem and if so how do I format it? Otherwise could you tell me what I am doing wrong.

Posted: Tue Jan 09, 2007 3:48 pm
by Combuster
The thread i posted previously should contain all the information to make a correctly bootable CD. If you have a 1.44MB floppy image that works, then making a CD image should work too. If its not exactly 1.44MB (2880 * 512 bytes) then mkisofs will complain, and probably some other programs would do so as well.

And if you did manage to burn a cd, I got a complaint about some BIOS not supporting my bootable CD's, which are built the same way. Maybe you just got unlucky :(

Sounds like its time to write a wiki page on this.

Posted: Tue Jan 09, 2007 4:07 pm
by Dex
1. First are you using some burn software to make it bootable ?, eg: Nero burn.

2. What are you using to make a image ?, the image needs to be a full bootable floppy image. eg: like this http://www.dex4u.com/DosBoxDex4u.zip

3. Is your BIOS set to boot CD, before Hdd ?.

Posted: Wed Jan 10, 2007 1:13 am
by Jabus
In answer to your questions I am using nero burning rom I am using the file loader.bin as the image (source code is included as attatchment) and it is said to cd before hdd. However when I boot from it it displays the bootloader welcome message and then appears to hang. I've included the source code of the bootloader as it might be the code. I haven't managed to test it on a floppy as I have no floppy drive on my computer. The loader source code is my code mixed with some open source code.

Posted: Wed Jan 10, 2007 2:40 am
by Combuster
I think i got it: You are making a no-emulation CD-Rom.

This means your code gets loaded without any floppy disk being emulated. Consequence is that you have to write a specially tailored bootloader to accomodate for it.

I suggest you use mkisofs instead of asking Nero to create a bootable CD. I put up a tutorial here

Posted: Wed Jan 10, 2007 1:14 pm
by Jabus
Thank You. I'll try tommorrow as I've used up all my writable cds. (Forgot to buy re writables)

Posted: Wed Jan 10, 2007 2:54 pm
by JAAman
if you have nero se (the version that comes free with many CD burners and computers) you can only burn floppy emulation bootdisks (makes my life difficult when im trying to slipstream windows...), if you use the full program, there will be an option in your dialog box, but i dont remember what it is (should be a check box)

just another option