Commands available to an OS?
- GeniusCobyWalker
- Member
- Posts: 65
- Joined: Mon Jan 12, 2009 4:17 pm
Commands available to an OS?
I have extensively looked this up and can not find an answer.
When making an OS what C commands are available? I know you cant draw or do normal string commands, so I was wondering what commands can you use? Are they Bios commands, Processor specific commands, 32, 64 bit commands, or what?
Is there somewhere that tells you?
Or is it like a code library of functions?
Thanks
(First OS )
When making an OS what C commands are available? I know you cant draw or do normal string commands, so I was wondering what commands can you use? Are they Bios commands, Processor specific commands, 32, 64 bit commands, or what?
Is there somewhere that tells you?
Or is it like a code library of functions?
Thanks
(First OS )
Full Knowledge in:
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: Commands available to an OS?
Pretty much all there is at your disposal are teh builtin parts of C, no functions. You have to write everything yourself.
-
- Member
- Posts: 524
- Joined: Sun Nov 09, 2008 2:55 am
- Location: Pennsylvania, USA
Re: Commands available to an OS?
The BIOS is out of the picture if you are in protected (32) or long (64) mode. And most compilers don't do 16-bit.Are they Bios commands, Processor specific commands, 32, 64 bit commands, or what?
Processor "commands" are mostly done through MSRs and control registers. Look at the Intel manuals. These just change the state of the processor. For the most part, they won't do work for you.
Like Troy said, no functions except for built in ones. There are 1000 implementations of the string functions on the internet, and they aren't hard to implement yourself. Here is a hint: rep movsb, rep scasb. Look up those two instructions and string functions will be easy.
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Re: Commands available to an OS?
All the information that you asked for is already available on the wiki, and in the intel manuals.
Please, research before you post.
-JL
Please, research before you post.
-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
Re: Commands available to an OS?
How about reading some tutorials. There are great ones like James M's OS dev tutorials that will explain this all to you or there is a tutorial here http://www.brokenthorn.com/Resources/OSDevIndex.html that later ventures into MSVC++ coding.
I am also goin to inform you of a little trade secret in the OS dev underworld. Its called GOOGLE http://www.google.com just in case you can't find it.
Happy Deving
I am also goin to inform you of a little trade secret in the OS dev underworld. Its called GOOGLE http://www.google.com just in case you can't find it.
Happy Deving
Gizmic OS
Currently - Busy with FAT12 driver and VFS
Currently - Busy with FAT12 driver and VFS
- GeniusCobyWalker
- Member
- Posts: 65
- Joined: Mon Jan 12, 2009 4:17 pm
Re: Commands available to an OS?
Did you all write games and lots of programs in C before starting a C Operating System?
If I look at more C Tutorials wouldn't that not help me at all because they teach to use an OS's C Commands and not just C Commands?
If I look at more C Tutorials wouldn't that not help me at all because they teach to use an OS's C Commands and not just C Commands?
Full Knowledge in:
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
-
- Member
- Posts: 524
- Joined: Sun Nov 09, 2008 2:55 am
- Location: Pennsylvania, USA
Re: Commands available to an OS?
The "OS's C commands" are called Application Programming Interfaces. They define how your program interacts with the OS.Did you all write games and lots of programs in C before starting a C Operating System?
If I look at more C Tutorials wouldn't that not help me at all because they teach to use an OS's C Commands and not just C Commands?
There are no "C Commands" in OS development. You MUST write everything yourself. There are no functions except the ones you write. Need to draw to the screen? Write a display driver. Need to access the disk? Write a disk driver.
You interface with these devices primarily through A) writing to certain memory locations and B) IO ports. You obvously are not reading or not understanding the tutorials, as they tell you this. Read the barebones tutorial. Build it and run it in an emulator. Mess around with it until you understand what every little bit does. Then you can worry about doing anything else.
- GeniusCobyWalker
- Member
- Posts: 65
- Joined: Mon Jan 12, 2009 4:17 pm
Re: Commands available to an OS?
I saw this in bar-bones
Tutorials on making drivers? Available drivers, how to use them?
Is there something that says what you can use?kernel.c
This is not exactly your average int main() (which is one of the reasons why you should not call it like that). Most notably, you do not have any library stuff available. As soon as you write so much as #include <, you have probably made the first mistake. Welcome to kernel land.
Tutorials on making drivers? Available drivers, how to use them?
Full Knowledge in:
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
-
- Member
- Posts: 524
- Joined: Sun Nov 09, 2008 2:55 am
- Location: Pennsylvania, USA
Re: Commands available to an OS?
That says it all. There is NOTHING. You have to make everything yourself. You can use stack variables, math/binary operators, your own functions, etc. but no external library functions, malloc, etc. Write your own functions to do the things you want to do. If that is too much, then OS dev isn't for you.Most notably, you do not have any library stuff available. As soon as you write so much as #include <, you have probably made the first mistake. Welcome to kernel land.
Re: Commands available to an OS?
There is no such thing as a "C command". I have not a clue where you got that from.If I look at more C Tutorials wouldn't that not help me at all because they teach to use an OS's C Commands and not just C Commands?
If you mean a "C command" as in printf(), then you are referring to a CRT (C Runtime Library) which depends on the systems user mode System API. In other words, its OS dependent. If you are referring to something else, please elaborate.
In kernel land, you can only use the BIOS's API via interrupts, and only in real or v86 mode. Every single thing else you will need to do yourself.Is there something that says what you can use?
Dont look for these tutorials until you have a good foundation for your OS. When making these drivers, look for tutorials on the hardware device you are looking for as well as the data sheets for the device. Google can be helpful here. Oh, and looking for generic driver tutorials will not be very helpful.Tutorials on making drivers? Available drivers, how to use them?
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Commands available to an OS?
Looking at driver interfaces however, is a different thing. But you need to have a good understanding of what's going on before looking into that. From your use of the word command, I'm ready to bet you don't know assembly, nor how the CPU handles code and data. If this is true, learn assembly first (where you have instructions, not commands).
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
- GeniusCobyWalker
- Member
- Posts: 65
- Joined: Mon Jan 12, 2009 4:17 pm
Re: Commands available to an OS?
heres a print command:
1) How did they know that video was oxb8000 and 0x0F was White on black? where is this info?
Thats what I was trying to ask before.
2)Also should I write a command-prompt OS before a GUI OS, and can I later add a GUI on top of my command-prompt if I do it first?
unsigned int k_printf(char *message, unsigned int line) // the message and then the line #
{
char *vidmem = (char *) 0xb8000;
unsigned int i=0;
i=(line*80*2);
while(*message!=0)
{
if(*message=='\n') // check for a new line
{
line++;
i=(line*80*2);
*message++;
} else {
vidmem=*message;
*message++;
i++;
vidmem=WHITE_TXT;
i++;
};
};
return(1);
};
1) How did they know that video was oxb8000 and 0x0F was White on black? where is this info?
Thats what I was trying to ask before.
2)Also should I write a command-prompt OS before a GUI OS, and can I later add a GUI on top of my command-prompt if I do it first?
Full Knowledge in:
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
Re: Commands available to an OS?
No its not. Its a routine, function, or a method. Please use the proper terminology.heres a print command
On most VGA hardware, text mode video memory begins at 0xB8000 or 0xB0000. Each character contains two bytes, the ascii character code and the characters attribute. Im sure there is something in the Wiki that describes it in more detail...1) How did they know that video was oxb8000 and 0x0F was White on black? where is this info?
Thats what I was trying to ask before.
I highly recommend the first method (console based then graphical based.) You can add a GUI shell later if you want. Much much later.2)Also should I write a command-prompt OS before a GUI OS, and can I later add a GUI on top of my command-prompt if I do it first?
Last edited by neon on Thu Jan 15, 2009 6:29 pm, edited 1 time in total.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Re: Commands available to an OS?
I think I may cry.1) How did they know that video was oxb8000 and 0x0F was White on black? where is this info?
Thats what I was trying to ask before.
2)Also should I write a command-prompt OS before a GUI OS, and can I later add a GUI on top of my command-prompt if I do it first?
It's at that location because thats where someone decided it should be. The information is readily available and you should know it.
Yes, that a much better method for you (and I like it better too). But realize that you have a LOT of work to do before that happens.
-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
- GeniusCobyWalker
- Member
- Posts: 65
- Joined: Mon Jan 12, 2009 4:17 pm
Re: Commands available to an OS?
Where is it at?. The information is readily available and you should know it.
Where did you see it at?
Full Knowledge in:
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs