
Video: Redstone Calculator Tutorial Part 4 - Addition and Subtraction by mattbatwings
How to build it
- Extend the A and B 8-Bit Output Buses
Build a staircase extension from your calculator's A and B binary output walls so all 8 vertically stacked bit lines are easy to access. Place a column of redstone lamps along each output bus to visually verify the stored 8-bit values.
- Cross the B Bus Through the A Bus
Route the 8 vertically stacked lines of input B over toward input A, leaving a two-block gap between parallel sections and placing repeaters as needed to maintain signal strength. At the intersection, use a repeater feeding into a solid block so the B lines can pass cleanly through the A lines without cross-connecting, then step the A lines down by one block using slabs.
- Connect the 8-Bit Carry-Cancel Adder
Position your 8-bit carry-cancel adder at the end of the paired A and B input buses, ensuring both inputs enter the adder corners with equal signal strength (strength 15 from repeaters). Place 9 redstone lamps on the output (8 sum bits plus the 9th carry-out bit) to test addition.
- Branch A and B Inputs for the Subtractor
Continue the main A and B buses past the adder tap-off and create a second identical intersection further down the line. Step the A lines down with slabs and pass the B lines through with repeaters and blocks so you have a fresh pair of 8-bit inputs for subtraction.
- Invert Input B and Power Carry-In
Set up a fresh 8-bit adder for subtraction. Feed input A in normally, but invert all 8 lines of input B using a redstone torch followed by a repeater on each bit layer, then force the adder's initial carry-in line ON so it automatically adds 1 (converting B into two's complement).
- Add a Second Adder for Negative Results
Place a second 8-bit adder directly in front of the first subtractor adder to reconvert negative results into readable magnitude. Invert the 8 sum outputs leaving the first adder with torches and repeaters before feeding them into the second adder, and ensure the second adder's carry-in is also powered to add 1.
- Build Comparator Cancellation Gates on Both Outputs
Run the 8 output lines from the second adder through a column of comparators, and set up another set of comparators on the bypassed output from the first adder before merging both 8-bit buses into a single final answer bus. Next to each comparator bank, build a vertical slab tower with redstone dust and repeaters pointing into the sides of the comparators to mute (cancel) all 8 bits at once when powered.
- Wire the Sign Bit to Select Positive or Negative Output
Route the carry-out line from the first subtractor adder down a vertical spiral staircase of blocks and dust to act as the sign bit (1 = positive, 0 = negative). Connect this uninverted line to the second adder's comparator-cancel tower (muting it when the result is positive), and branch an inverted line via a redstone torch to the first adder's cancel tower (muting it when the result is negative).
- Install the Subtractor and Test Both Units
Connect the completed dual-adder subtractor module to the second A and B input branch and label the sign-bit lamp with a sign (1 = Positive, 0 = Negative). Enter test numbers into your A and B registers to confirm that the 9-bit adder output displays A + B while the subtractor outputs the exact magnitude of A - B alongside the sign bit.
How it works
This circuit performs both 8-bit binary addition and signed 8-bit subtraction simultaneously from the same two A and B input buses:
- Addition (A + B): The first module is a standard 8-bit carry-cancel adder. Adding two 8-bit numbers produces an 8-bit sum plus a 9th carry-out bit, allowing results up to 510.
- Two's Complement Subtraction (A - B): Instead of building a dedicated borrow circuit, the subtractor calculates
A + (-B). Each bit of B is inverted with a redstone torch (1s become 0s and 0s become 1s) and the adder's initial carry-in is locked ON to add1. - Sign Bit Detection: After the first subtractor adder adds A and the two's complement of B, its carry-out bit acts as the sign bit. If the carry-out is
1, the result is positive and the 8 output bits are already the final answer. If the carry-out is0, the result is negative and is still encoded in two's complement form. - Negative Reconversion & Multiplexing: When a result is negative (
A < B), the output from the first adder must be inverted and have 1 added to it a second time to reveal its true magnitude. The second inline adder performs this second two's complement conversion continuously. The carry-out sign bit from the first adder controls two vertical comparator-cancellation towers: when carry-out is1(positive), it powers the side of the second adder's comparators to mute them and lets the first adder's output through; when carry-out is0(negative), a redstone torch inverts the control line to mute the first adder's output and pass the reconverted second adder's output instead.
Tips & variations
- Equal Corner Signal Strength: If you are using a comparator-based carry-cancel adder, make sure both the A and B input lines enter the adder corners through repeaters at signal strength 15, otherwise the carry-cancel logic will miscalculate.
- WorldEdit Paste Tip: When copying and pasting large multi-bit buses in Creative mode with WorldEdit, always use
//paste -aso air blocks in your selection do not overwrite and break your existing input buses. - Watch Signal Strength on Merged Buses: When merging the positive and negative 8-bit answer buses after the comparator gates, count your dust length (up to 15 blocks) and place repeaters before the signal dies out, especially along the vertical spiral line for the sign bit.





