Glitch Chronicles

Coding an Operating System from scratch.

Published: (Updated: ) in The corner of Yuriy Georgiev (aka jeux), , , , by .

I started coding an operating system from scratch just for fun in Assemler and C.

It turned out to be way less complicated than what I expected as long as you know (or find out) some of the BIOS interrupts.

It really comes down to coding a bootloader in 16 bit real mode (which can’t really go wrong as its limited to 512 bytes and a small magic number that acts as a signature) just to be able to take the control and then switch to 32 bit protected mode (or 64 long).

The only tricky part is the GDT I guess (global descriptor table) which is a small structure that instructs the CPU how to manage its memory model when switching to protected mode.

I really love the fact that the VGA has a fixed memory address to which you can write directly and see your screen reacting. It’s whole lot of fun. I will definitely mess a bit more with it.

If anyone wants to mess around with it, here is the link to the src on my github: https://github.com/jeuxdemains/vector-os

I just made the repo public. Fork it, test it, improve it and most importantly have fun with it. You may need to install the build-essentials package to get the 32 bit GNU dev tools on 64 bit host OS. You will also need NASM and QEMU or Bochs. If you code something fun and useful let me know.

Spread the fun

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *