Loading a memory address from a cd rom

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.
Jabus
Member
Member
Posts: 39
Joined: Sun Jan 07, 2007 7:54 am

Loading a memory address from a cd rom

Post 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.
Otter
Member
Member
Posts: 75
Joined: Sun Dec 31, 2006 11:56 am
Location: Germany

Post 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
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

related topic you might want to read:
http://www.osdev.org/phpBB2/viewtopic.php?t=12583
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post 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.
Otter
Member
Member
Posts: 75
Joined: Sun Dec 31, 2006 11:56 am
Location: Germany

Post 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.
Jabus
Member
Member
Posts: 39
Joined: Sun Jan 07, 2007 7:54 am

Post 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?
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post 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:
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

If you have used a fat12 for your bootable floppy, that will work fine under emulation.
Jabus
Member
Member
Posts: 39
Joined: Sun Jan 07, 2007 7:54 am

Post 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.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post 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 ?.
Jabus
Member
Member
Posts: 39
Joined: Sun Jan 07, 2007 7:54 am

Post 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.
Attachments
loader.asm
loader source code
(4.29 KiB) Downloaded 24 times
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post 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
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Jabus
Member
Member
Posts: 39
Joined: Sun Jan 07, 2007 7:54 am

Post by Jabus »

Thank You. I'll try tommorrow as I've used up all my writable cds. (Forgot to buy re writables)
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Post 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
Post Reply