Ok. First let me say that this is my first post here, so hi.
Second, let me say that I'm quite the experienced programmer, but in a language NO-ONE uses for normal programming. This language is in Gamemaker, and requires DirectX to do anything.
My goal with my OS: to create a platform that is DirectX (DirectDraw at least) compatible to run applications and such from Gamemaker, including the Gamemaker App itself.
Even if I can't achieve this goal, I'd at least like to get to a point where I can have a GUI.
Ok, that all said, I realize what a big undertaking OS dev is, and how long it takes, and the patience, etc, so please don't go rambling about that ^-^.
I need help with bootloaders. I'm an ASM noob, and a C noob, and a moderate Python user. I'd like to create (or use someone else's with their consent) a bootloader that can eventually lead up to a Python kernel. I'm not certain how hard this is or how to do it, and I don't know how to run a Python script w/o an interpreter, which is of course OS based. This said I may have to drop that dream. If it is possible, I'm sure I'd have to go from ASM to C to Python, in that order. If it's realistic, tell me. Otherwise:
I need help making a bootloader that can pass control of the OS to another file, bypassing the limit of 512k. I know that there are those out there, but I cannot find one that will compile and work correctly. I use FASM to write my assembly, and have NASM to compile most others' works. If someone can point me to a good tutorial and has reason (or code to use) for me to switch compilers, then feel free ^.^
After I've created this bootloader, I'll need to know how to get input besides just a "Press Any Key" function, which is all I seem to be able to find. I also need to know how to run external programs (load a .com file into memory and execute it, etc.) I have a loose grasp on how to do this in ASM, but if it can be passed to a C program to do this, explain.
Sorry if I've been too longwinded - please tell me if I have. Thanks - Yushatak (www.devportal.tk - under construction)
Writing an OS (well... duh? lol ^.^)
- xenos
- Member
- Posts: 1121
- Joined: Thu Aug 11, 2005 11:00 pm
- Libera.chat IRC: xenos1984
- Location: Tartu, Estonia
- Contact:
Re: Writing an OS (well... duh? lol ^.^)
I suggest using GRUB (http://www.gnu.org/software/grub/) - it is a free bootloader and loads several binary formats, including ELF. You can also load your own binary format if you include a small signature in your kernel file, known as the multiboot header. For more information, have a look at the GRUB documentation and the multiboot specification (http://www.gnu.org/software/grub/manual/multiboot/).
If you load your kernel with GRUB, the processor is already switched to protected mode, breaking the limit of 512k and using all of your computer's memory. But you can't siply load .com applications this way because they don't directly support protected mode.
A good place to start is http://www.mega-tokyo.com/osfaq2/index.php
If you load your kernel with GRUB, the processor is already switched to protected mode, breaking the limit of 512k and using all of your computer's memory. But you can't siply load .com applications this way because they don't directly support protected mode.
A good place to start is http://www.mega-tokyo.com/osfaq2/index.php
Re: Writing an OS (well... duh? lol ^.^)
I've tried GRUB before, but thus far I've found it to be quite a mystery. I'll try again now that I've a better grasp on assembly, etc., but I may need help implementing it - ecspecially the "Multiboot-header" part. I'm about to go read up/download what I need to, thanks!
Oh and I don't think I've mentioned this before, but I'm developing from Windows (XP)...
Edit #2 (yay) : I found a number of tools such as a precompiled GRUB disk with just GRUB and WinImage, which can be used to edit the FS of the image (put new files, etc). I also (of course) have rawrite, so I'm ready to make my kernel and learn how to use GRUB to run it. Going to read up on multiboot headers and how to use GRUB now..
Oh and I don't think I've mentioned this before, but I'm developing from Windows (XP)...
Edit #2 (yay) : I found a number of tools such as a precompiled GRUB disk with just GRUB and WinImage, which can be used to edit the FS of the image (put new files, etc). I also (of course) have rawrite, so I'm ready to make my kernel and learn how to use GRUB to run it. Going to read up on multiboot headers and how to use GRUB now..
Last edited by Yushatak on Tue Oct 11, 2005 11:00 pm, edited 2 times in total.
Re: Writing an OS (well... duh? lol ^.^)
And I quote:
The layout of the Multiboot header must be as follows:
Offset Type Field Name Note
0 u32 magic required
4 u32 flags required
8 u32 checksum required
12 u32 header_addr if flags[16] is set
16 u32 load_addr if flags[16] is set
20 u32 load_end_addr if flags[16] is set
24 u32 bss_end_addr if flags[16] is set
28 u32 entry_addr if flags[16] is set
32 u32 mode_type if flags[2] is set
36 u32 width if flags[2] is set
40 u32 height if flags[2] is set
44 u32 depth if flags[2] is set
Erm.. As I said, I'm a a newb at ASM, and am having trouble discerning this. It says below that the MAGIC field is a specific value (0x1BADB002), but I don't understand the FLAGS thing, I would assume that since I shouldn't require any special options I would set it to some sort of default value, but I don't know what. The checksum I vaguely understand, but that is dependent on the other two values which I haven't decided yet... Also, I haven't much of an idea of where to enter these values... can someone help me with this?
The site which I read this all on was:
http://www.gnu.org/software/grub/manual ... r%20layout
Thanks.
P.S. - What language would you all recommend as the language for my kernel? I plan to have a small program for every step of loading that will point to the next, this way it can point out exactly where the OS fails and I can branch out the OS by changing which programs load and such. I believe this is called a modular kernel. What language? T.Y.
The layout of the Multiboot header must be as follows:
Offset Type Field Name Note
0 u32 magic required
4 u32 flags required
8 u32 checksum required
12 u32 header_addr if flags[16] is set
16 u32 load_addr if flags[16] is set
20 u32 load_end_addr if flags[16] is set
24 u32 bss_end_addr if flags[16] is set
28 u32 entry_addr if flags[16] is set
32 u32 mode_type if flags[2] is set
36 u32 width if flags[2] is set
40 u32 height if flags[2] is set
44 u32 depth if flags[2] is set
Erm.. As I said, I'm a a newb at ASM, and am having trouble discerning this. It says below that the MAGIC field is a specific value (0x1BADB002), but I don't understand the FLAGS thing, I would assume that since I shouldn't require any special options I would set it to some sort of default value, but I don't know what. The checksum I vaguely understand, but that is dependent on the other two values which I haven't decided yet... Also, I haven't much of an idea of where to enter these values... can someone help me with this?
The site which I read this all on was:
http://www.gnu.org/software/grub/manual ... r%20layout
Thanks.
P.S. - What language would you all recommend as the language for my kernel? I plan to have a small program for every step of loading that will point to the next, this way it can point out exactly where the OS fails and I can branch out the OS by changing which programs load and such. I believe this is called a modular kernel. What language? T.Y.
Last edited by Yushatak on Tue Oct 11, 2005 11:00 pm, edited 1 time in total.
Re: Writing an OS (well... duh? lol ^.^)
Try this: http://www.osdever.net/tutorials/grub.php?the_id=5.
I would use C for most of my kernel, but I'd use ASM for the parts that would be most commonly used.
I would use C for most of my kernel, but I'd use ASM for the parts that would be most commonly used.