If this type of thing interests you, check out <a href="http://wiki.osdev.org" rel="nofollow">http://wiki.osdev.org</a>. I cannot recommend this site enough for someone who is interested in writing their own toy OS.
You can go all the way to protected mode, enable paging, and then page in the rest of your kernel in just 512 bytes, and without touching the BIOS: <a href="https://github.com/charlesap/bootpager/blob/master/oiuboot.asm" rel="nofollow">https://github.com/charlesap/bootpager/blob/master/oiuboot.a...</a>
I'm really digging the systems posts that have been cropping up on HN recently; this and the toy OS post that was floating around are both really interesting.
This brings back memories of reading through Norton's programmer's guide to the PC, figuring out how all the various interrupts worked. It was always faster to write to b800:0000 than use int 10h (assuming a color display of course!).
Similar guide to write a small kernel <a href="https://news.ycombinator.com/item?id=7588205" rel="nofollow">https://news.ycombinator.com/item?id=7588205</a>