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.
I have already made my kernel, and it works great, but I was wondering how to execute programs and how to start them... Here is my compile script and I was wondering how I could get a simple program like this to run:
Although I will ignore your sarcasm, as I am a beginner at this i will say the following
A) I can do that through the kernel
B) I want to be able to execute with the kernel already linked so I dont have to re-link the kernel each time
Its really not a good idea to have both the kernel and a program execute from the same linear address... (I'm referring to the -Ttext option here).
If you're using grub then you can have it provide a module for you. It details where it loads it in the multiboot header, otherwise you're probably going to need some file system support to load a program. You generally load an image of the program, then assuming its in, e.g. elf format (which I see yours isn't) you either copy or map each section to the place in memory where it expects to be (i.e. where the linker puts it) and then jump to the entry point (again specified in a decent executable format). I suggest you read the sections on ELF and/or PE in the wiki.
You are probably another person trying to learn assembly language by writing an operating system, and that really is like trying to run before you can walk - big time. Most of the beginner's assembly language projects I see on other sites are MS-DOS programs. Probably that is the only way to learn assembly language, especially at systems level, because then you haven't got a protected mode operating system like Windows getting in your way all the time.
Absolute disk reads and writes via int 25h and 26h were functions built into MS-DOS, and they are not available if an operating system is the very thing you are trying to write. You can use the BIOS interrupts until you switch into protected mode, if you are trying to write a protected mode OS, but once in pm you are really on your own without any support from pre-written software, either in the BIOS or MS-DOS. Those kinds of services are the very thing you are supposed to be providing to other programs by writing an OS, and the OS itself can only access disks by directly programming the chips which control the floppy and hard disks.
One of the services your OS would need to provide is the ability to allocate memory, read an executable file into that memory, do whatever initialisation is necessary, and then jump to the entry point of that program (as well as making that functionality available to other applications via a call to your OS). The exact details would depend upon the design of your operating system, and have you even thought of that yet?
When the computer is first switched on it always starts executing at the real mode address F000:FFF0, and it is running in real mode. When it loads your boot sector it is still running in real mode, and when the boot sector loads your OS it will probably still be running in real mode. If you are writing a protected mode OS it is then up to that OS's initialisation code to switch into pm at and appropriate point. But really, if you are thinking of writing an OS, you should know all that already.