Simple of the Simple

Posted:
in General Discussion edited January 2014
OS's talk to the processor and other parts of the system...how? What language do they use, how would you make a super simple OS?



Are there any books I could read...lets say even if i just wanted to have the computer display a color on teh screen, how would I even come close to figuring out how to talk to the processor?



[ 09-30-2002: Message edited by: ast3r3x ]</p>

Comments

  • Reply 1 of 10
    Ok, you changed your question...



    If you want to "play arround" with hardware. I'd sugest starting with a mirocontroler. It's basicly an extramly simple computer. They, like computer hardware are programed using assimbly language. You can do stuff like make lights flash to more complicated things. Good geek fun.



    [ 09-30-2002: Message edited by: smithjoel ]</p>
  • Reply 2 of 10
    ast3r3xast3r3x Posts: 5,012member
    [quote]Originally posted by smithjoel:

    <strong>Getting your masters or PhD in Computer Engineering would be a start. Or you could just buy an extisting OS. That's how Bill Gates "wrote" DOS.</strong><hr></blockquote>



    haha i can't wait that long, i am curious now...they learned through teachers and books...the teachers just teach whats in the books, somone who knew wrote the books...how do i find the books!
  • Reply 3 of 10
    i recently became interested in making: larf: The FreakyOS. its a lot more crazier than i thot. assembly is definitely a requirement for the kernel (the pre-OS). [the] linux [kernel] is open source, so you can check that out. the fsf makes several OS's (gnu/linux, gnu/darwin, ..) and all their work is opensource (and fairly well commented/doc'd) so you can chk those out. i foudn the most difficult part to be finding a nice and easy bootloader tho. (the bootloader puts your kernel into RAM [from hd] and tells it to run)
  • Reply 4 of 10
    ast3r3xast3r3x Posts: 5,012member
    [quote]Originally posted by thuh Freak:

    <strong>i recently became interested in making: larf: The FreakyOS. its a lot more crazier than i thot. assembly is definitely a requirement for the kernel (the pre-OS). [the] linux [kernel] is open source, so you can check that out. the fsf makes several OS's (gnu/linux, gnu/darwin, ..) and all their work is opensource (and fairly well commented/doc'd) so you can chk those out. i foudn the most difficult part to be finding a nice and easy bootloader tho. (the bootloader puts your kernel into RAM [from hd] and tells it to run)</strong><hr></blockquote>



    where did you get this information on how to do this...and what is the bootloader programed in...assembly...and if so where can i learn assembly for a certin processor?
  • Reply 5 of 10
    well, i always thot of it as common knowledge that linux was opensource. i guess not. i learned about a few of the gnu OSes after poking thru their page incidentally one day. everything [everything] (everything) they make is open source (completely free of regulations, under one condition: that you release ur derivative source under the same condition). the major hackers at the fsf (free software foundation, which houses the GNU project) are very much in favor of completely free (meaning liberty not price) software.



    finding info on ppc assembly is kind of difficult, especially for free assemblers. there was an assembler called fantasm for classic (9-), i dont know if theres an osx vers. gcc (gcc.gnu.org, and bundled with all vers' of osx) can assemble assembly, but it has slightly diff syntax and shit from fantasm. i got the impression that each assembler requires a little different syntax. i know that ppc assembly is very different from x86. if u learn fantasm's assembly you can learn to translate it to gcc's assembly (and then use gcc to assemble the program).



    i saw a tutorial on ibm's site for 32 and 64 bit ppc asm, but it didn assemble with gcc, so i just kind of pulled basics from it.



    the important thing to remember when writing an OS is nothing is given (NOTHING!). no standard library. no "printf" or "scanf", "cout" or "cin". the kernel has to take care of everything. memory management, instancing binaries and programs, and lots lots more. its no small task.



    if u write a simple "hello, world" in gcc, you can look at what the corresponding assembly is. `gcc -S helloworld.c`. that'll produce helloworld.s. that's helloworld in assembly. but it depends heavily on standard library. it can give u an idea of how ppc assembly works tho. you can convert any source file that gcc can take (c, c++, objective-c, fortran, possibly more) into assembly with `gcc -S &lt;sourcefile&gt;`. that source is usually heavily dependant on stdlib and stdio and similar standard libraries, so unuseable in the actual OS, but can help to advance an already moderate assembly programmer.



    and, for all kinds of help: google.com. its got everything, and then some. there are already a large number of OSes for various platforms, so any probs u run into, someone will have already had them, and google should be able to find them.
  • Reply 6 of 10
    ast3r3xast3r3x Posts: 5,012member
    [quote]Originally posted by smithjoel:

    <strong>Ok, you changed your question...



    If you want to "play arround" with hardware. I'd sugest starting with a mirocontroler. It's basicly an extramly simple computer. They, like computer hardware are programed using assimbly language. You can do stuff like make lights flash to more complicated things. Good geek fun.



    [ 09-30-2002: Message edited by: smithjoel ]</strong><hr></blockquote>



    where can i get one of these...and how much do they cost?
  • Reply 7 of 10
    der kopfder kopf Posts: 2,275member
    and thus remains my question: when is the alpha of that FreakyOS released?
  • Reply 8 of 10
    ast3r3xast3r3x Posts: 5,012member
    [quote]Originally posted by der Kopf:

    <strong>and thus remains my question: when is the alpha of that FreakyOS released? </strong><hr></blockquote>



    I too would like to see this
  • Reply 9 of 10
    amorphamorph Posts: 7,112member
    You should probably start simple: Bootstrap loaders and kernels are tricky because they're so dependent on the hardware - and so what you're supposed to do depends on the hardware. There's always some bit of hardware (BIOS on PCs, OpenFirmware on Macs, the ROMs of older Macs) that knows where to go for the bootstrap loader, so you have to learn how to use that.



    I'd suggest starting simple, after that. No virtual memory, no memory protection, no threading, no inter-process communication, and a very simple filesystem. To give you some idea, the ur-UNIX was a kernel, a round-robin scheduler, a filesystem and a text editor, all fit into 4K of assembler. It took Ken Thompson 3 months to write it. But then, Ken Thompson is an unbelievably talented programmer.



    (A round-robin scheduler is the simplest kind that supports multitasking: If you have four tasks, A, B, C and D, then a round-robin scheduler runs A, then B, then C, then D, then A, then B... it has no sense of process priorities or anything like that. Every task is equal, and they all get their slice of processor time as if they were linked in a circle.)



    Once you've got your own ur-UNIX, you should probably pick up a text on operating system design. There are a lot of good textbooks on the subject, and they go into more advanced scheduling algorithms, how to implement protected memory and virtual memory - both of which require hardware support, and what to take into account when managing memory and disk space. For example, Mac HFS has a very elegant, and little-known, feature: When a file is deleted, the blocks that have been freed are timestamped. When a file is created, the blocks it takes up are allocated from never-used space if possible, and the longest unused blocks otherwise. This is so that if you accidentally delete or corrupt a file, you have the maximum possible amount of time to repair or recover it before it's written over. A very small, but very civilized thing.



    Also, I would urgently recommend that you look at a BSD - or even Darwin - in preference to Linux. Linux works, but Linus made a lot of questionable design choices, some of which are now coming back to haunt him. The BSD codebase is much nicer, better designed, and more consistent in quality. It's also open source.



    Last but not least: Don't expect to get anywhere fast.



    [ 10-05-2002: Message edited by: Amorph ]</p>
  • Reply 10 of 10
    ast3r3xast3r3x Posts: 5,012member
    you all make it sound like designing an OS is hard, I plan to have something about as advanced as OS 10.1 in about a month or so from now...minus the aqua look





    ok ok i was just joking, i don't have time now, i was just wondering how one would get started
Sign In or Register to comment.