All Im looking to do is make something that will call a c++ program. I am not really into learning everything about an OS, so I hope there is code somewhere that will let me do that. But its probably not as simple as that.....
Anyone have code to do that?
Call a C++ program
Re:Call a C++ program
Have written an startup-code for Turbo C++ (http://www.com-cabinet.de/progs/os0.zip)
that can simply linked like this:
TLINK /T /n ..\LIB\OS0T KERNEL,KERNEL.BIN,,..\LIB\CS
KERNEL ist the .OBJ file from the main-module.
The done linked file "KERNEL.BIN" can now called from bootstrap with base 0x0000. Example: jmp far 0x0100:0x0000 if the kernel is located there.
The C++ program begins as ever with main. Example:
int main(void)
{
// Kernel begins
cputs("Welcome to my OS.");
bioskey(0);
geninterrupt(0x19); // Reboot...
}
that can simply linked like this:
TLINK /T /n ..\LIB\OS0T KERNEL,KERNEL.BIN,,..\LIB\CS
KERNEL ist the .OBJ file from the main-module.
The done linked file "KERNEL.BIN" can now called from bootstrap with base 0x0000. Example: jmp far 0x0100:0x0000 if the kernel is located there.
The C++ program begins as ever with main. Example:
int main(void)
{
// Kernel begins
cputs("Welcome to my OS.");
bioskey(0);
geninterrupt(0x19); // Reboot...
}
Re:Call a C++ program
Im a bit new at this and Im hoping you can explain this a bit more.
I call this:
TLINK /T /n ..\LIB\OS0T KERNEL,KERNEL.BIN,,..\LIB\CS
Then call the kernel.bin somehow (how do I do that exactly)
So where does the c++ part come in?
I call this:
TLINK /T /n ..\LIB\OS0T KERNEL,KERNEL.BIN,,..\LIB\CS
Then call the kernel.bin somehow (how do I do that exactly)
So where does the c++ part come in?
Re:Call a C++ program
You write your C++ code, making sure not to call any OS functions. If you have a real-mode compiler, such as Turbo C++, you can call BIOS functions; otherwise, you have to interface to the hardware directly.
You compile your code with a normal compiler.
You link your code to flat binary format or, if your loader supports it, some more sophisticated format.
You set it up so that your boot loader will load your code, or you write your own boot loader.
You're not going to get very far without learning a lot -- there's a steep learning curve involved in OS development. But it's worth it...
You compile your code with a normal compiler.
You link your code to flat binary format or, if your loader supports it, some more sophisticated format.
You set it up so that your boot loader will load your code, or you write your own boot loader.
You're not going to get very far without learning a lot -- there's a steep learning curve involved in OS development. But it's worth it...