Once again, the Analytical Engine taught by my professor was simplified for lecture and brevity which resulted in me making Babbage Lite. Babbage Lite programs contain the following:
- Number cards (
N<address> <value>) - Variable cards (
L<address>,S<address>) - Operation cards (
+,-,*,/,%) - Action cards (
P,B,H) - Combinatorial cards (
CB+<skips>,CF+<skips>,CB?<skips>,CF?<skips>)
N<address> <value>Declares a constant or variable in the specified address of store. Value is the initial value stored.
- Allowable addresses are only from 0 to 999.
- By default, values of all addresses in store is 0.
Examples:
N000 0
N111 1
N5 8L<address>Loads the value from the specified address of store into the mill.
- Two loads supply the left (first ingress axis) and right (second ingress axis) operands of arithmetic operations.
Example:
L1
L2S<address>Stores from the egress axis (mill’s result) into the specified address of store.
Example:
S3+ . addition
- . subtraction
* . multiplication
/ . division
% . moduloSets the arithmetic operation to be performed.
Example:
+
L1 . load into the first ingress axis
L2 . load into the second ingress axis
S3 . store from egress axis into store `003`PPrints the value from the egress axis (mill's result).
BRings a bell.
HHalts the machine.
CF+<skips> . jump forward skips + 1 (from current line) cards
CB+<skips> . jump backward skips - 1 (from current line) cardsWhy the + 1/- 1? To put it simply, the reader must move for a card to be read.
At least, that's what I remember my professor telling us.
CF?<skips> . jump forward skips + 1 (from current line) cards if the run-up lever is set
CB?<skips> . jump backward skips - 1 (from current line) cards if the run-up lever is setRun-up Lever is set/unset on every arithmetic operation:
- Addition: Run-up Lever only when sign differs between the first ingress axis and egress axis.
- Subtraction: Run-up Lever sets only when sign differs between the first ingress axis and egress axis.
- Division: Run-up Lever sets only when the divisor is 0.
- Multiplication: Run-up Lever never sets.
- Modulo: Run-up Lever sets only when the divisor is 0.
-
x
y
CF/CB+/?...is roughly equivalent to:
- If x is non-negative:
- If
x < y, thenCF/CB+/?...
- If
- If x is negative:
- If
x ≥ y, thenCF/CB+/?...
- If
Example:
N0 5 . counter
N1 1 . constant 1
N2 0 . constant 0
# DO { ...
-
L0
L1
S0
P
-
L2
L0
CB?9
# ... } WHILE (0 < counter)
HN2 0is only helpful in outlining your intentions as002is already 0, by default (as with all addresses).0 < counteronly works as a mental model because 0 is non-negative.