Page 1 of 1

Using more than one file?

Posted: Fri Feb 15, 2013 9:37 pm
by tlf30
I am new to developing OSs and was looking for some help.

I have several asm files that have methods in them. I need to run these from another asm file.
I think I need an %include, but I have had no luck in getting it to work.

Any help is great!

Re: Using more than one file?

Posted: Fri Feb 15, 2013 10:13 pm
by Nessphoro
Linking.

Re: Using more than one file?

Posted: Mon Feb 18, 2013 9:50 pm
by tlf30
Got it! Thanks!

How would I go about running a file on a floppy in a bootloader?
(I have no interest in using GRUB)

Re: Using more than one file?

Posted: Mon Feb 18, 2013 11:27 pm
by Minoto
One simple way is to not have a filesystem, and just treat the disk as a collection of sectors. Use a disk editor to write your file to a known location, then have your bootsector load it into memory and execute it. It's a quick way to get started, but it's also least flexible way.

An alternative route, which requires more work up front but makes things easier afterwards, is to write a bootsector that's capable of reading the root directory of a simple filesystem, locating a particular file, then doing the necessary work to load it into memory (however it may be laid out on the disk) before executing it. Assuming a simple FAT-formatted floppy, you can then just copy your file to it without resorting to special tools. And that file can be anything you want, from a simple "Hello, world!" test at first to a complete second stage bootloader capable of doing all the things you couldn't squeeze into your initial bootsector.

Re: Using more than one file?

Posted: Sat Feb 23, 2013 1:36 am
by tlf30
I got it working with your reading of the fat file system. Thanks!

Is reading off of a cd/dvd similar to a floppy?

Re: Using more than one file?

Posted: Sat Feb 23, 2013 12:50 pm
by Minoto
A quick forum search turned up this post, which sums things up rather well.

Re: Using more than one file?

Posted: Sat Feb 23, 2013 10:22 pm
by tlf30
Thanks!