Charles Petzold’s book Code: The Hidden Language of Computer Hardware and Software answered these questions. I really enjoyed his style of writing and sense of humor. The book guides you through the basics of code and some familiar codes that help you understand computer code. For example, he describes braille and Morse code in great detail. These foundations help make the information about telegraphs, relays, and gates more accessible.
The latter half of the book describes how we get from electric circuits to a system that can “remember” data, i.e. memory. From there, we learn about chips, disk drives, semiconductors, and more. The last few chapters deal with text encoding, fixed and floating point numbers, programming languages, and computer graphics.
Although the book was published in 2000, all of the material remains interesting and often applicable. I wish I had read this book a long time ago because it has given me a much better comprehension of what happens once my code is compiled and executed. If you are interested in how computers work or are a developer who wants to get “closer to the metal” this is a worthwhile read.