Firstos is a project mainly written in Assembly, it's free.
Tutorial:
http://mikeos.berlios.de/write-your-own-os.html