---
# System prepended metadata

title: "\n    Binary Adding Machine"

---

<h1>
    Binary Adding Machine</h1>
    <html><body><p><p><br/> Recently, I began reading the renowned "Code: The Hidden Language of Computer Hardware and Software" by Charles Petzold. You can find it here. I highly recommend this book especially if you're new at computer science. Charles does an amazing job of explaining difficult subjects in a digestible and user-friendly manner. You can also find an additional edition here.<br/></p><br/><p><br/> In chapter 12, Charles describes how to make a simple binary adding machine to add two binary numbers with 8 bits. I decided to create an implementation of this machine in Minecraft and also in JavaScript. You can download the complete JavaScript repository here.<br/></p><br/><p><br/> In this article we will go through the entire process step-by-step. I will demonstrate how I was able to follow the instructions in chapter twelve to build this machine in both JavaScript and Minecraft. I recommend reading chapter twelve of this book if require a more in-depth explanation of any of these subjects.<br/></p><br/><p><br/> Introduction<br/></p><br/><p><br/> First, we need to be able to add two binary numbers of 1 bit to make two binary numbers of 8 bits.  <a href="https://webarchive.one/">GAMING</a> The sum of these two 1-bit numbers will result in a two-bit number. The first bit of this 2-bit number will be called the "sum" bit and the second will be the “carry” bit. If you want to sing a song about it, you could say:<br/></p><br/><p><br/> 0 plus 0 equals 0.<br/></p><br/><p><br/> 0 plus 1 equals 1.<br/></p><br/><p><br/> 1 plus 0 equals 1.<br/></p><br/><p><br/> 1 plus 1 equals 0, so carry the 1.<br/></p><br/><p><br/> The following addition table shows the sum of our two 1-bit numbers.<br/></p><br/><p><br/> Logic Gates<br/></p><br/><p><br/> We need logic gates to accomplish this. We'll start with the AND gate because we can use it to calculate the carry part. This is the AND gate I've created in Minecraft (with a little help from Mumbo Jumbo).<br/></p></p></body></html>
</h1>