Where to start to write OS?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
NewOSdever
Posts: 2
Joined: Tue Dec 13, 2016 6:04 am
Libera.chat IRC: nikitka555

Where to start to write OS?

Post by NewOSdever »

Hi,my name is Nikita! I'm new. Where to start to write OS on C and assembler.?
I am not catnikita255, do not confuse me and him.
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

Re: Where to start to write OS?

Post by NunoLava1998 »

Nikitka555 wrote:Hi,my name is Nikita! I'm new. Where to start to write OS on C and assembler.?
Welcome to OSDev!

You should start on Bare Bones. If you're running Windows and don't feel like making a cross-compiler, use ghost-i686-elf-tools, which works.
Though, you will need some dll's for that.

The zip is too large (600 KB), so i'll upload it on mediafire:
http://www.mediafire.com/file/a5k9nzkb4 ... ll%27s.zip
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Where to start to write OS?

Post by Solar »

I would start with the Wiki. No, seriously. That's what it is there for.
Every good solution is obvious once you've found it.
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: Where to start to write OS?

Post by SpyderTL »

Specifically, I would start by setting up a virtual machine, like VirtualBox.

Then, if you are going to be coding in assembler, I would download NASM, and try to create an OS that simply displays text to the screen when you boot it up in your virtual machine.

If you can get that far, then everything else is just adding more features.

Good luck. Let us know how it goes.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
User avatar
osdever
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am
Contact:

Re: Where to start to write OS?

Post by osdever »

He's going to write OS in C. I know him and real cause he went there is to get help with setting up cross-compiler on Windows. By the way I don't believe that his project will get more advanced than just a toy :(
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing

OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Where to start to write OS?

Post by Solar »

Given that his next post was to ask "how to write a 'hello world' in C", I implore you, talk him out of OSDev. This is really not the place to start learning your first programming language. That is just setting up for failure and frustration -- not only his frustration, I might add.

Programming should be learned in user space, not by writing kernel startup code.
Every good solution is obvious once you've found it.
User avatar
osdever
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am
Contact:

Re: Where to start to write OS?

Post by osdever »

Solar wrote:Given that his next post was to ask "how to write a 'hello world' in C", I implore you, talk him out of OSDev. This is really not the place to start learning your first programming language. That is just setting up for failure and frustration -- not only his frustration, I might add.

Programming should be learned in user space, not by writing kernel startup code.
Yep, I thought the same when he asked his last question. I'll talk to him.
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing

OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
irvanherz
Member
Member
Posts: 27
Joined: Mon Sep 19, 2016 5:34 am

Re: Where to start to write OS?

Post by irvanherz »

Level 1 :
Print hello world boot sector using NASM. Run it.

Level 2 :
Prepare virtual disk. Load other files from your boot sector. Do something from that file.

Level 3 :
Do simple experiment, related to protected mode; GDT, A20, IDT, etc

Level 4 :
Install bootloader, or develop your own bootloader. With protected mode support

Level 5 :
Convert your ASM to C
andrewthompson555
Member
Member
Posts: 27
Joined: Thu Oct 13, 2016 2:07 pm

Re: Where to start to write OS?

Post by andrewthompson555 »

Welcome to the world of OS development!

We encourage you to start OS development.

Start learning DOS assembly first. It's a great way to start! Learn Assembly and the interrupts. That's how I'm learning right now and I understand most of the code I do. YouTube will have nice tutorials. Boot DOS from a floppy or VirtualBox and use MS-DOS DEBUG. Do your research. I don't think C is really good when you're a beginner. Start learning Assembly!

Remember. Use NASM as the assembler. Don't forget that you can't use INT 21 (MS-DOS API) on your OS. You can look on Wikipedia for references. I know things look hard but don't give up. I nearly did but I didn't.

Here's something to get you started:

BITS 16
org 0x7C00

jmp start

Print:
lodsb
cmp al, 0
je Done
mov ah, 0eh
int 10h
jmp Print

Done:
ret

start:
mov si, msg
call Print

msg db 'Hello World!', 0

times 510-($-$$) db 0
dw 0xAA55

Save it as boot.asm (it doesn't have to be boot.asm, you can make it myos.asm

Then, install nasm (search it)
And do:

nasm -f bin boot.asm -o boot.img

Install VirtualBox and create a virtual machine. Then, test it.
glauxosdever
Member
Member
Posts: 501
Joined: Wed Jun 17, 2015 9:40 am
Libera.chat IRC: glauxosdever
Location: Athens, Greece

Re: Where to start to write OS?

Post by glauxosdever »

Hi,

andrewthompson555 wrote:Start learning DOS assembly first. It's a great way to start! Learn Assembly and the interrupts. That's how I'm learning right now and I understand most of the code I do. YouTube will have nice tutorials. Boot DOS from a floppy or VirtualBox and use MS-DOS DEBUG. Do your research. I don't think C is really good when you're a beginner. Start learning Assembly!
DOS assembly isn't really relevant. YouTube tutorials shouldn't be followed, since they can't be community-edited and tend to be made by those who don't know well. Whether C or assembly is better for a beginner, it's debatable, but let's rather not discuss it here.
andrewthompson555 wrote:Remember. Use NASM as the assembler. Don't forget that you can't use INT 21 (MS-DOS API) on your OS. You can look on Wikipedia for references. I know things look hard but don't give up. I nearly did but I didn't.
There are valid reasons to use another assembler, for example if you use GCC, then it's easier to use GAS since the OS will have less dependencies.
andrewthompson555 wrote:Here's something to get you started:

BITS 16
org 0x7C00

jmp start

Print:
lodsb
cmp al, 0
je Done
mov ah, 0eh
int 10h
jmp Print

Done:
ret

start:
mov si, msg
call Print

msg db 'Hello World!', 0

times 510-($-$$) db 0
dw 0xAA55

Save it as boot.asm (it doesn't have to be boot.asm, you can make it myos.asm

Then, install nasm (search it)
And do:

nasm -f bin boot.asm -o boot.img

Install VirtualBox and create a virtual machine. Then, test it.
I don't think you are qualified to give advice.


Regards,
glauxosdever
Post Reply