Results 1 to 30 of 30

Thread: why not an operating system?

  1. #1

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    Talking why not an operating system?

    Hi guys I want some informations on how the operating systems are made--just the basic of them. How they are constructed-- Do you have any information or any web site. I think that we can start building one from now. Please give some comments!
    Baaaaaaaaah

  2. #2
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544
    I don't know that much about them, but you would have to learn Assembly Language to write the Bootloader which much be 512 Kb.
    After that, you should be able to write the rest in C/C++.
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

  3. #3
    VirtuallyVB
    Guest

    Don't go too deep into programming! (Just joking)

    "Don't go too deep into programming! (Just joking)"? Programming an OS is pretty deep.

    Don't forget to write interfaces (drivers) for all the popular hardware. If you are writing your own custom OS for a smaller set of (custom) hardware, then you have an easier task.

  4. #4
    Megatron
    Guest
    You need to integrate both ASM and C++ to create this. Use ASM for low-level programming like the kernel and talking to the hardware, etc. and use C++ for the file system, running application software, etc.

  5. #5
    Lively Member
    Join Date
    May 2000
    Posts
    123
    if you are interested in operating systems, look into the linux kernel. it is of course open source and you can create your own modules to add to the kernel fairly easily.

  6. #6
    Lively Member
    Join Date
    Jun 2000
    Posts
    122
    If you want to get into OS development, my suggestion would be to start off with very simple "hello world" operating systems. And if you do, boot it from diskette. NEVER EVER modify your HD's bootsector cause you will never be able to boot Windows again unless you reformat it. I recently bought a book on ASM language that goes more into depth with BIOS and DOS interrupts. Something that you will need to master before you start writing an OS. Here are some links that you might be interested in...

    http://www.gaztek.org/osdev/
    http://www.acm.uiuc.edu/sigops/roll_your_own/1.html
    http://www.linuxdoc.org/LDP/tlk/tlk.html(VERY good)

  7. #7
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    How would you test an OS?

  8. #8
    denniswrenn
    Guest
    Put it on a floppy and boot..... Most 'hello world' operating systems should be smaller than 1.44mb...

  9. #9

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    Angry Sorry I was late

    I tried to learn the assembly language. It is really confusing. You just move the stacks or something like that in the register and I don't see anything visually happening. Where can I find a really easy tutorial on assembly. And also because this is a C++ forum then I am going to ask that let us say that you want to draw a circle, lines, write and get text, everything which you can do it dos, can you do that when you are developing the operating system?
    Baaaaaaaaah

  10. #10
    Megatron
    Guest
    Check the Assembly forums for some links to different Assembly sites.

  11. #11
    Lively Member
    Join Date
    Jun 2000
    Posts
    122
    Abdul
    Yes you most certainly can. Here is a very basic example of how to write text to the screen, in C, without the need of an operating system.

    Code:
    #include <dos.h>
    .
    .
    .
    void printtext(char* txt)
    {
       _AH = 0x13;   /* request displayy string */
       _AL = 1;  /* display attr. and string and advance the cursor */
       _BH = 0;  /* page number */
       _BL = 2;  /* green on black */
       _BP = txt; /* address of string to display */
       _CX = sizeof(txt); /* numbers of characters in string */
       _DX = 0;  /* start writing the text at the top-left corner of screen */
       geninterrupt(0x10); /* call the interrupt */
    }

  12. #12

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    problem with me

    Ok the problem with me is that I just know C++ for this kind of DOS programming. Do I need to learn C in order to develop(make would fit) a simple hello world operating system. The program which you wrote, Will I have to make an exe file from this and then boot from the floppy disk or it will work fine when I will boot with just c or cpp extention? Can you give an example in C++, and the procedures to run that program.

    I would really appreciate!
    Baaaaaaaaah

  13. #13
    Lively Member
    Join Date
    Jun 2000
    Posts
    122
    You can write an operating system in C++. I don't know why you wouldn't be able to. But I think it is better to write it in C so that there is minimal overhead. I ran the code above in Windows 98 console just fine as an EXE. BUT if it going to be the operating system it MUST be in binary form (.com, .bin, etc.). It cannot be in .c or .cpp extentions because the computer cannot execute C/C++ code. It can only execute 1's and 0's.

    To boot it from a diskette you must write a bootstrap that loads it when booting. It REALLY isn't that hard to write a bootstrap (once you know ASM).

    I made the program above with PowerC. It should work with any other C or C++ compiler so go ahead and give it a try. I changed a few things cause I couldn't get the other code to work properly so here is the new code along with an attached example...

    Code:
    #include <dos.h>
    #include <conio.h>
    
    /*----------------------------------------------------------*/
    
    void setVGAmode()
    {
       _AH = 0;  /* request change video mode */
       _AL = 0x12;  /* VGA 640x400 mode */
       geninterrupt(0x10);
    }
    
    /*----------------------------------------------------------*/
    
    void printtext(char* txt, int num)
    {  
       int cnt;  /* loop counter */
     
       _AH = 0x0E;   /* request display character */
       _BH = 0;   /* page number */
       _BL = 2;   /* green on black */
    
       for (cnt=0; cnt<=num; cnt++)
       {
          _AL = txt[cnt];   
          geninterrupt(0x10); /* call the interrupt */
       }
    }
    
    /*----------------------------------------------------------*/
    
    int main()
    {
       setVGAmode();
       printtext("Hello World!", 12);   /* print the text */
       getch();	/* wait until you are ready to exit */
       return 0;
    }
    Attached Files Attached Files

  14. #14
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140

    Re: Sorry I was late

    Originally posted by abdul
    I tried to learn the assembly language. It is really confusing
    Okay, I hate to say this, but that is a bad sign.

    Anyway, Assembly shouldn't be that hard, though if you would preffer, I suggest learning on an old Motorola chip first. The word order is more natural than the Intel series. There isn't an advantage either way, just preference. And you can grab an old Motorola box (Apple, Ami, VMI, maybe some old Sun boxes, I don't know). Though, I worked with a Motorola emulator that ran under Ultrix. I'm sure you can find the source for something like that to build it for Linux. There may be other emulators out there.

    For those of you who want to see something funny... look for Perlix. And OS written in Perl. It is more of a joke than anything else, kind of a hackers wet dream, going against the "right tool for the right job" mentality.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  15. #15
    Addicted Member Active's Avatar
    Join Date
    Jan 2001
    Location
    Lat: 13° 4' 46" N, Long: 80° 15' 20" E
    Posts
    209
    How about an OS written in javascript ??
    If you can't beat your computer at chess, try kickboxing !!!
    [Download Tag Editing Tools.]

  16. #16
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    There's an OS written in Java
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  17. #17
    Megatron
    Guest
    Which OS is it? And is it complete Java? Or a mixture?

  18. #18
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    JavaOS, which is written in Java and the only native part is the bytecode interpreter (apparently).
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  19. #19
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    This site helped me a lot with learning how an OS works: http://www.cybertrails.com/~fys/index.htm.

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  20. #20
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544
    The site doesn't work....
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

  21. #21
    Hyperactive Member kourosh's Avatar
    Join Date
    Aug 1999
    Location
    Vancouver, British Columbia, Canada
    Posts
    256

    THE DOT

    Originally posted by CyberCarsten
    The site doesn't work....
    Hey Just remove the dot after htm and it works.
    ===========================
    Kourosh Gonabadi
    VB Programmer
    C++ Newbie
    Graphic Designer
    ===========================

  22. #22
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544
    Thanks!
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

  23. #23
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    Hmmmmm....Not sure how the dot got there, but anyway, i have a few good bookmarks for ASM tutorials:

    http://webster.cs.ucr.edu/Page_asm/A.../ArtofAsm.html
    http://members.nbci.com/winasm/tutorials.html

    Hope they help!

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  24. #24
    Lively Member
    Join Date
    Oct 1999
    Location
    East Ballina,NSW,Australia
    Posts
    121

    Smile Some Source Code to get you started

    Hi All,

    I can't remember where I got it but I actually have some source code for a version of DOS, it includes all of the c++ side of things, however, does not contain any assembly code. So once you've got the asm code going you should be able to fiddle around with this and combine the 2 together to come up with an OS!

    I haven't really had much of a look at this so if anyone finds anyhting interesting please comment.

    Regards,

    Smithy.

  25. #25
    Lively Member
    Join Date
    Oct 1999
    Location
    East Ballina,NSW,Australia
    Posts
    121

    File didn't upload

    Oops! file was too big visit here in about ten mins...
    http://www.anarchy.au.com/mobsoft/files/kernal.zip

  26. #26
    Lively Member
    Join Date
    Oct 1999
    Location
    East Ballina,NSW,Australia
    Posts
    121

    it does have assembly

    Hi All,

    I just check over the os i got and it does have assembly with it, i still can't remember where i got it from though! It's amazing what you can find on and old software devleopers computer!

    Regards,

    Smithy.

  27. #27
    Lively Member Brandito's Avatar
    Join Date
    Nov 2000
    Location
    Here, There, Every Where!
    Posts
    106

    harder than what they say

    I have done heavey resurch into building your own OS. It is harder than what everyone is telling you. Of course you must know ASM. But you don't want to work with DOS!!!! So 90% of what every one previous to this post has said will not work!

    You don't want to go straight into c++ either. You want to do plain C.

    If I were you I would get a VERY VERY stripped down, non GUI, copy of Linux. Just the OS and some sort of Compiler for it. Scrap all of the aditional software. Use it as a guid line to writing your own OS but do not directly copy it. Once you build your OS/Kernel... then rewrite the compiler to work with your OS if it doesn't already. When you have a functional C compiler for your OS... then you can do anything you want. But note -- the open source for the compiler must be totally stripped down to a level that can work for you. You don't want it using "evil" headers.

    L8r,
    Brandon

  28. #28
    Lively Member
    Join Date
    Oct 1999
    Location
    East Ballina,NSW,Australia
    Posts
    121

    Talking Hehe, forgot about that part!

    Hi,

    Brandito is right, you have to write a compiler for your OS or else people won't be able to write programs for it! and niether will you.


    The Source that I have included in this forum is DOS-C which apparently is a GNU OS and from what I have just brielfly looked over it can read fat format so basically if you are able to fiddle around with this a bit and re-compile it you'll be at where Microsoft was when they brought PC DOS and edited it and release it as MSDOS 1.0

    So I guess if you really want to start heading down that path than this is a start.

    Regards,

    Smithy.

  29. #29
    Addicted Member KrishnaSantosh's Avatar
    Join Date
    Feb 2001
    Location
    Coimbatore
    Posts
    210
    EMail me for the PCGPE - An Assembly Language Help file. Extremly useful for leaning assembly programming.

  30. #30
    jim mcnamara
    Guest
    Lots of folks have written OS components. I've had students who did that - like write the HAL (microkernel) for a Unix flavor for a given hardware platform. Long ago, I wrote dispatchers, schedulers, and device queueing for other OS's.

    The short story is that you have to be able to write code at different levels. Like C and MASM, or A86.

    And you have to create re-entrant primitives (like api's) to keep code size down. Unix was written originally on PDP's using mostly C and assembler under another OS called RSX. That's why the Unix shell and command language is C-like.

    In Unix, the poor level of interactive help, cryptic error messages, and absurd command names (ls, anyone?) are all due to memory limitations on the old PDP's. You have to keep a lot of command table information memory resident. And if you have 8K of RAM you can't have commands like 'DIRECTORY' when 'ls' is a lot smaller and does okay.

    IF you are interested in this sort of thing, you can get OS source for Hurd & GNU/LINUX at GNU. You'll have to do several downloads. And hop to another page or three. Knock yourselves out....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width