Finally, a new blogpost about the original purpose of this blog; operating system development.
I came across a project I started in 2010, called ttOS. It was in a very bad shape and it was obvious that I didn't really know what I was doing back then. Nonetheless, I scrolled through it and figured out what had to be done to clean it up.
First of all, ttOS has a major upside compared to the one I started this blog with. The kernel is written using Visual Studio! So I could write my kernel using my favorite IDE, instead of some half-assed Linux text editor tool.
Second, it had some neat little tools in the folder structure to facilitate building a bootable image. Nice to have.
So I decided to abandon the old OS and continue this one. Luckily, the ttOS kernel already knew how to set up the GDT, so that wasn't much of a hassle anymore. The IDT was half implemented, so I continued on that subject.
After setting the CPU exception vectors 0-31 in the IDT, I began programming the PIC. Really neat little piece of code, nothing special. I just do the same everybody else does:
Great. Now on to testing the PIC by adding a IRQ handler!
Unfortunately, this is where I failed miserably. I had tried to use C to directly implement an interrupt routine. I thought if I used __declspec(naked), that it would be alright! This turned out to be so false! Ultimately, I used an assembly file called "comp_isrs.asm". Comp stands for "components", which originates from the way I organize my kernel source (more on that later, perhaps). Also, MASM is really weird if you're used to NASM. 😊