THE MILL:

Basic Parts : The basic parts in the mill that were to be used in most of the action are called Ingress Axis 1, Ingress Axis 2, and the Egress Axis. An axis is simply a column that represents a 50 digit number, just as are found in the store. The engine could only perform arithmetic on two numbers at a time. The Ingress Axis 1 would store the first value, the Ingress Axis 2 would store the second, and the Egress Axis would store the result from the desired operation. So, if we wanted to perform the equation 15+17, we would first set up the machine for addition (as will be explained later), load 15 onto Ingress Axis 1, load 17 on Ingress Axis 2, and the result would appear on the Egress Axis.

Primed Axes : On top of these axes, both Ingress Axis 1 and the Egress Axis had an additional primed axis. Ingress Axis 1's Primed Axis was used because Babbage wanted to make it possible for the machine to compute the quotient of a 100 digit number divided by a 50 digit number. The result of such an equation is still a 50 digit number. The first 50 digits of the 100 digit number would be stored on the normal Ingress Axis 1, and the second 50 digits would be stored on the Primed Axis of Ingress Axis 1.

The Primed Axis of the Egress Axis makes it possible to store remainders of division. If the machine were told to calculate 20 / 7, it would not give 2.85714. It would give 2 as the answer on the Egress Axis' Primed Axis, and leave 6 as the remainder on the Egress Axis.

Run-Up Lever : The Run-Up Lever is important for evaluating booleans and loops. The lever switches from its normal down position into its up position in either of the following two cases :

    1. The sign on the result of the equation is different then the sign on the first number in the equation, on Ingress Axis 1. Thus, if you do the equation 4 – 9, the run up lever will be set because the result (-5) has a different sign then Ingress Axis 1 (the number 4.)
    2. The resulting answer is greater than 50 digits long. If you try and divide a 100 digit number by a 2 digit number, the run up lever will be set.

Basic Diagram of parts :

PROGRAMMING CARDS

*The cards used to program the engine were based upon those by 18th century French inventor, Jacques Jacquard.

3 different kinds of cards :

    1. Operation Cards –
    1. Basic Operation Cards : used to set up the mill to perform the specified arithmetic operation (+, -, x, %).
    2. Combinatorial Cards + Index Cards : used to perform loops and jumps in the program.
    3. Special Cards : used to halt the engine, ring a bell, or give comments to the engine operator.
    1. Number Cards –
    2. used to put numerical values in the store at the specified wheel number. Each card can represent a number from -9.999x1049 to 9.999x1049.
    3. Variable Cards –
    1. Normal Variable Cards - used to transfer values from the Store to the Mill, or from the Mill to the store. The machine can either erase the number as it transfers it, or leave it intact to use again.
    2. Special Variable Cards – in case the Store is full, or the mill needs a special variable, special variable cards can be used to either punch a result on a card, or read in a variable from a card instead of the store.
  • What might each of these cards have looked like?
      1. Operation Cards – require only 4 holes to represent +, -, /, x. Combinatorial cards will be shown later.
      2. Number Cards – require 50 columns of 10 possible punches, to represent a 50 digit numeral, plus one column to express whether the number is positive or negative. Three more columns of 10 possible punches are necessary to express the address in the store at which the number should be placed.
      3. Variable Cards - One column of 5 possible punches, representing whether a number should be read from the store, read from the store and erased in the process, read from the mill and put in the store, read from the card reader, or punched onto the card reader. Three more columns of 10 possible punches would be needed to express the destination if a number is being put in the store.

    *Each card was to have its own kind of reader, but Babbage never fully decided as to how he was going to integrate the separate readers.

    EXAMPLE PROGRAMS AND HOW THEY WORK

    Brief Lexicon : This code is modeled off of the code examples found at www.fourmilab.ch/babbage, where the author has constructed a wonderful JAVA emulator of the difference machine.

  • N001: (Number Card) The N represents a number card, and the following number specifies the address in Store where the number should be loaded, much like an array index.
  • /,*,+,x : (Operation Card) sets the Engine to perform this operation, before any of the axes are set.

    L001 : (Variable Card) The L means that the value at the following memory address, (001 in this case), should be loaded onto either Ingress Axis 1, or Ingress Axis 2, depending on which is available. Once Ingress Axis 2 is filled, the calculation specified is begun automatically.

    S002: (Variable Card) The S commands the engine to save the current value on the Egress Axis at the specified memory location in the store.

    S002': (Variable Card) The apostrophe transfers the value on the Primed Egress Axis onto the the specified location in the store.

    P : Special Operation Card to print the result on the Egress Axis.

    H: Halt the engine.

    CF?5 : The C means this is a combinatorial card. The F tells the card reader whether to move forward or backward if the run up lever has been set. The ? checks to see if the run up lever has been set, and the 5 tells the card reader how far to go in the case that the lever is up.

    CB?5 : This is the same as above, but this will go backwards if the run up lever has been set.

    1. Simple Computation - Compute 500 / 30
    2. N001 +500 // Puts 500 into memory address 001 in the store

      N002 +30 // Puts 28 into memory address 002 in the store

      / // Sets the machine to divide

      L001 // Loads the number at 001 in the store on Ingress Axis 1

      L002 // Loads the number at 002 in the store on Ingress Axis 2

      // operation is commenced once Ingress Axis 2 is set

      P // Prints the current value on the Egress Axis

      S003' // Stores the primary result on the Primed Egress Axis

      // at address 003 in the store.

      S004 // Stores the remainder from the division at memory

      // address 004 in the store.

      B // Rings a bell to tell operator that it is finished

      H // Halts the engine.

    3. Introducing Loops – Compute 4!
  • a) Without Loop :

    N000 4

  • N001 1

    N002 1

    x

    L002

    L000

    S002

    -

    L000

    L001

    S000

    x

    L002

    L000

    S002

    -

    L000

    L001

    S000

    (etc… on down until 4 x 3 x 2 x 1 has been calculated. It should be seen how the code repeats.)

  • b) With loop, compute n! In this case, n = 4.

    N000 4

    N001 1

    N002 1

    x

    L001

    L000

    S001

    -

    L000

    L002

    S000

    L002

    L000

  • CB?11 // This statement is executed as long as the current value

    // of n, when subtracted from 1, results in a negative

    // number. So, in the case of 4!, 1-4 will set the lever,

  • // 1-3 will set the lever, 1-2 will set the lever, and 1-1

    // will not set the lever. So, 4 x 3 x 2 x 1 will be

    // calculated.

    B

    H

    3) Evaluating booleans. Perform the following line of C code :

    " if (x > 0) " letting x be 10 for this example.

    N000 10

    N001 0

    +

    L001

    L000

    CF?2

    P

    H

    B

    H

    CURVE DRAWING APPARATUS

    *Babbage conceived that the machine could have a curve drawing apparatus, to plot the points of functions it computed. The apparatus was never submitted in any sort of final form, though occasional notes refer to the possibility of it.