> Wow, that's really great. Where do you even start to learn to program this kind of thing? Like accessing hardware
This: https://www.amazon.com/dp/0596005903/ should cover most of it.
This is the one I have:
I had previously bought these books on recommendation for the same purpose but I never got to studying them myself so only take them as second-hand advice.
For Windows drivers also see this blog: http://blogs.msdn.com/doronh/
For Linux based development, two good books come to mind: Linux Device Drivers and Linux Kernel Development. The Linux Device Drivers book can be a bit daunting so a good introduction to the Kernel is a useful starting point.