Using more than one file?

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.
Post Reply
tlf30
Member
Member
Posts: 35
Joined: Fri Feb 15, 2013 9:29 pm

Using more than one file?

Post 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!
Programming is like fishing, you must be very patient if you want to succeed.
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: Using more than one file?

Post by Nessphoro »

Linking.
tlf30
Member
Member
Posts: 35
Joined: Fri Feb 15, 2013 9:29 pm

Re: Using more than one file?

Post 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)
Programming is like fishing, you must be very patient if you want to succeed.
User avatar
Minoto
Member
Member
Posts: 89
Joined: Thu May 12, 2011 7:24 pm

Re: Using more than one file?

Post 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.
Those who understand Unix are doomed to copy it, poorly.
tlf30
Member
Member
Posts: 35
Joined: Fri Feb 15, 2013 9:29 pm

Re: Using more than one file?

Post 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?
Programming is like fishing, you must be very patient if you want to succeed.
User avatar
Minoto
Member
Member
Posts: 89
Joined: Thu May 12, 2011 7:24 pm

Re: Using more than one file?

Post by Minoto »

A quick forum search turned up this post, which sums things up rather well.
Those who understand Unix are doomed to copy it, poorly.
tlf30
Member
Member
Posts: 35
Joined: Fri Feb 15, 2013 9:29 pm

Re: Using more than one file?

Post by tlf30 »

Thanks!
Programming is like fishing, you must be very patient if you want to succeed.
Post Reply