What happens first?
What happens first?
Alright everyone, I'm a 13 year old Kid named Dave and have been interested in computers since I was 7! I know HTML, BASIC, C, most of C++, and some of JAVA. However, I have never before tried to build and compile my own OS. I just started learning about the contents of an OS such as Drivers and Aplications about 1 1/2 weeks ago. I know all of the components and am learning how to write them. My problem is that I don't know in which order they come. Please Help, It would be greatly appreciated!
Thanks!
Thanks!
RE:What happens first?
With all due respect, you're naive to think that 1.5 weeks of research is enough to develop an opearating system.
However, if you insist; learn assembly, first. Then look into protected mode architecture, and the boot process. IF you can get a kernel up and running after that, then you can start thinking about applications and drivers... but... it's not nearly as simple as I'm sure you think it is.
Cheers,
Jeff
However, if you insist; learn assembly, first. Then look into protected mode architecture, and the boot process. IF you can get a kernel up and running after that, then you can start thinking about applications and drivers... but... it's not nearly as simple as I'm sure you think it is.
Cheers,
Jeff
RE:What happens first?
Good advise.
My OS was my very first assembler project. I did take a break from it long enough to write a working bitmap file view for DOS...but then started back into the OS. But since then my asm coding habits have improved. My code has become legible. I've started using procedures and includes correctly to keep the code clear and so on.
But I've had to rewrite the whole system at least 4 times that I can remember and the latest version isn't yet working. I should have refined my assembler skills writting application for DOS instead of tackling such a huge project right off. And I've done all my OS research as I coded it. Which I guess is normal. But I didn't start off with PMODE stuff.
So now I'm sitting on a real mode command line OS. Half written. And want to start doing PMODE coding (which I don't fully understand at all, especially paging and memory management in general). That means a fifth rewrite!
I wish I'd known what I know now before I'd ever started! But on the bright side, I'm very clear now on how systems are designed and run (I've done 2+ years of research on everything from user interface design to filesystems to networking to hardware specs).
Get good at assembly. Then do your research (starting with PMODE and the basics like booting and stuff). Then start writting the important crap...like a memory manager. LOL. Don't do what I did.
-Robert
My OS was my very first assembler project. I did take a break from it long enough to write a working bitmap file view for DOS...but then started back into the OS. But since then my asm coding habits have improved. My code has become legible. I've started using procedures and includes correctly to keep the code clear and so on.
But I've had to rewrite the whole system at least 4 times that I can remember and the latest version isn't yet working. I should have refined my assembler skills writting application for DOS instead of tackling such a huge project right off. And I've done all my OS research as I coded it. Which I guess is normal. But I didn't start off with PMODE stuff.
So now I'm sitting on a real mode command line OS. Half written. And want to start doing PMODE coding (which I don't fully understand at all, especially paging and memory management in general). That means a fifth rewrite!
I wish I'd known what I know now before I'd ever started! But on the bright side, I'm very clear now on how systems are designed and run (I've done 2+ years of research on everything from user interface design to filesystems to networking to hardware specs).
Get good at assembly. Then do your research (starting with PMODE and the basics like booting and stuff). Then start writting the important crap...like a memory manager. LOL. Don't do what I did.
-Robert
RE:What happens first?
Once you know about assembler basics, you will need some hardware stuff. Things like 'How do I put a character on the screen?' may sount simple - but they are not if you switch to PMode and your BIOS is gone - it was written for real mode... With this knowledge, you can try to write a simple bootsector that puts 'Hello world!' on the screen - and then continue step by step. Teach your bootsector program to load a file into memory (you may use the BIOS here - we are still in real mode). These things are a good training to write in assembler and show the interior parts of hardware programming. (Probably you will need lots of hardware guides. A good starting point is the 'Programmer's Reference for MS-DOS and the IBM PC', have a look at http://www.o3one.org/hwdocs/bios_doc/dosref22.html)
That's how I started my OS six months ago - by the way, I am 19.
That's how I started my OS six months ago - by the way, I am 19.
RE:What happens first?
The age doesn't matter. I started coding when I was 10 but I learnt writing something more than a simple "Hello world" program when I was 14.
IMHO, writing an entire OS in assembly is better than coding it in an higher level language because you understand how does a PC works and how to optimize your code.
Then you must see how other OS are structured, read their code and understand how do they work.
Once this thing are done, you'll know what to do
IMHO, writing an entire OS in assembly is better than coding it in an higher level language because you understand how does a PC works and how to optimize your code.
Then you must see how other OS are structured, read their code and understand how do they work.
Once this thing are done, you'll know what to do
kernel in HLL or LLL
Although you can´t write a task manager in C, I don´t think you can write advanced GUIs or VFSs in assembly very simply. Perhaps you do learn about the hardware, but you code much more slowly, before you get for example to memory management.
I´m 15 and I started Pascal when I was 10.
Cheers,
Adrian
I´m 15 and I started Pascal when I was 10.
Cheers,
Adrian
RE:What happens first? (Ages!?)
If age doesn't matter, why include it in your reply?
Seriously though, why the hell do you people feel the need to "cleverly" insert your age into every message here. Half of you are just revealing your immaturity and need to bragg, and the other half are childishly challenging the first half!
Anyway, there's my _completely-OT_ rant...
Jeff
Seriously though, why the hell do you people feel the need to "cleverly" insert your age into every message here. Half of you are just revealing your immaturity and need to bragg, and the other half are childishly challenging the first half!
Anyway, there's my _completely-OT_ rant...
Jeff
RE:What happens first? (Ages!?)
Yeah you're right
Well I think I misexplained myself. I mean learn assembly code to learn how does a PC work but coding an entire OS in ASM is a bit unpractical. IMO, the best is writing the code is a medium-level language (not high like Basic or C# for example) like C and write time critical functions in assembly.
In my OS, i wrote the entire memory manager and the string functions in assembly and I've got it running very fast.
This is the strlen function written in C int strlen (char *str):
char *ptr;
for (ptr = str;*ptr;str++);
return (ptr - str);
and this is the code in assembly:
mov edi, [esp + 4]
xor eax, eax
mov ecx, 0xFFFFFFFF
repne scasb
not ecx ; Little trick
mov eax, ecx
ret
The assembly code is MUCH faster.
Well I think I misexplained myself. I mean learn assembly code to learn how does a PC work but coding an entire OS in ASM is a bit unpractical. IMO, the best is writing the code is a medium-level language (not high like Basic or C# for example) like C and write time critical functions in assembly.
In my OS, i wrote the entire memory manager and the string functions in assembly and I've got it running very fast.
This is the strlen function written in C int strlen (char *str):
char *ptr;
for (ptr = str;*ptr;str++);
return (ptr - str);
and this is the code in assembly:
mov edi, [esp + 4]
xor eax, eax
mov ecx, 0xFFFFFFFF
repne scasb
not ecx ; Little trick
mov eax, ecx
ret
The assembly code is MUCH faster.
RE:What happens first?
Although age itself does not directly matter, it does indeed matter indirectly. When you're younger, you simply haven't lived as long and haven't had quite as many experiences. Unless you're a remarkable person, I find it difficult to believe that someone who is 13 would know all that is needed to start such a project. I won't say, however, that exceptions do not exist, I am positive that they do.
Just because one knows C, doesn't mean that one knows how to use C. I believe part of creating an effective system is also having a vast knowledge when it comes to data organization and processing. Examples of such organization would be structures and unions. Additionally, processing would include things such as multi-dimensional arrays, linked lists, binary trees, and sorting algorithms, such as insertion sort. You can get by without knowing all of these, but efficiently? Doubtful.
Others have indeed pointed out assembly and it is a definite key point to bring up. You won't get very far without knowing it. However, if you decide to write your kernel in C, you aren't likely to get very far either without knowing something about how your code is generated or will be generated. In
short, knowing your compiler is important. Does the compiler support packed structures and does it optimize? Can you turn off optimization? There is a multitude of things which may play into your kernel writing, even at a higher level than assembly.
One of the major parts that people recommend starting on, as far as the kernel is concerned, are libraries. Indeed, this is the place to start. Without a decent library, you'll find yourself performing duplicate operations, and creating code that is messy and void of structure.
Who knows though? You may be an exception to my first paragraph.
Just because one knows C, doesn't mean that one knows how to use C. I believe part of creating an effective system is also having a vast knowledge when it comes to data organization and processing. Examples of such organization would be structures and unions. Additionally, processing would include things such as multi-dimensional arrays, linked lists, binary trees, and sorting algorithms, such as insertion sort. You can get by without knowing all of these, but efficiently? Doubtful.
Others have indeed pointed out assembly and it is a definite key point to bring up. You won't get very far without knowing it. However, if you decide to write your kernel in C, you aren't likely to get very far either without knowing something about how your code is generated or will be generated. In
short, knowing your compiler is important. Does the compiler support packed structures and does it optimize? Can you turn off optimization? There is a multitude of things which may play into your kernel writing, even at a higher level than assembly.
One of the major parts that people recommend starting on, as far as the kernel is concerned, are libraries. Indeed, this is the place to start. Without a decent library, you'll find yourself performing duplicate operations, and creating code that is messy and void of structure.
Who knows though? You may be an exception to my first paragraph.
RE:kernel in HLL or LLL
Who says you can't write a task manager in C? I did in C++, with only a few lines of assem. The only reason to write anything in pure assem is if you want to learn assem or you want it highly optimized (which are both pretty good reasons, might I add). If you really wanted to (which I don't know why you would) you could even write a VERY SIMPLE bootloader in C.
RE:What happens first?
I too am building an operating system, which I started from scratch for the first time, 4 weeks ago. Before then, I had never constructed an os of any great significance, and I had only being learning C for 2 weeks before I started. People who say you need years of experiance to make an OS are wrong, although I did have previous programming experiance (7 years) with Delphi and some assembly.
My OS is built using assembly code (vital) and C (also vital if you wish to get anywhere). Here are the features of the OS, all of which I learn't myself with no help other than internet resources.
32bit PMODE
SVGA 1024x768x24 Graphics
Hard Disk Driver
Memory Management (Paging)
A Vitrual File System (very powerfull, everything is based on it).
Keyboard Driver
Floppy Driver
Multi Tasking.
If I can do it (I am only 18), then you can at least attempt it. Back to your question, this is what you need to do at the beginning.
Create a bootsector and boot from floppy
- Use bios to load OS off of floppy to memory
Setup GDT
Enable A20 line
Move to PMODE
Jump to loaded kernel code.
Kernel sets up IDT
Create functions for writing to screen.
Memory Management
Scheduling (If doing multi tasking)
File system
Device Drivers (Keyboard, HD, FD etc).
All can be researched on the internet (as I did). Also refer to early version (first version) of Linux, as it is simple and is a good place to start, although I did not copy any code from it or anyone else.
My OS is built using assembly code (vital) and C (also vital if you wish to get anywhere). Here are the features of the OS, all of which I learn't myself with no help other than internet resources.
32bit PMODE
SVGA 1024x768x24 Graphics
Hard Disk Driver
Memory Management (Paging)
A Vitrual File System (very powerfull, everything is based on it).
Keyboard Driver
Floppy Driver
Multi Tasking.
If I can do it (I am only 18), then you can at least attempt it. Back to your question, this is what you need to do at the beginning.
Create a bootsector and boot from floppy
- Use bios to load OS off of floppy to memory
Setup GDT
Enable A20 line
Move to PMODE
Jump to loaded kernel code.
Kernel sets up IDT
Create functions for writing to screen.
Memory Management
Scheduling (If doing multi tasking)
File system
Device Drivers (Keyboard, HD, FD etc).
All can be researched on the internet (as I did). Also refer to early version (first version) of Linux, as it is simple and is a good place to start, although I did not copy any code from it or anyone else.
RE:What happens first?
There's nothing wrong with a complete rewrite of an operating system when you're just learning and experimenting. I have no idea how many rewrites I've done on my OS. I've lost count. The point is, just make sure you learn what you're trying to learn.
RE:kernel in HLL or LLL
I think I misexpressed myself of course, it is the way I will probably do task manager. I meant one cant write a task manager totally _without_ asm.
cheers,
Adrian
cheers,
Adrian
RE:What happens first? (Ages!?)
Damn! I sorry I caused so much troble by stating my age in my question. I mean, who would think that if someone put their age on a frign' message bord that everyone else would kepp on talking about it! Anyway, thank you for all of your "positive" answers they helped (some more than others) ! I now have my friend Brian helping me, and we have started developing the kernel. It is faily exiteing!
Thanks, Dave
Thanks, Dave
RE:What happens first?
Okay, Thank you everyone who replied to my inqury about where to start on my OS. I had already created a boot sector and was indeed able to boot from the floppy, as I said before the kernel is "sort-of" in development. I had also previously written several various drivers. Some including the HDD Driver, Mouse Driver and the Keybord Driver. If I ever complete my OS your screenames will be in the "credits". Thank you all!