--- /dev/null
+// > Each byte contains an unspecified amount of information but it must be capable of holding at
+// > least 64 distinct values.
+// > A computer word consists of five bytes and a sign. The sign portion has only two possible
+// values, + and -.
+// u8 is the smallest standard primitive, no bounds checking for now.
+#[derive(Debug, Default, Copy, Clone)]
+struct Word {
+ sign: bool,
+ bytes: [u8; 5],
+}
+
+impl Word {
+ fn new(sign: bool, bytes: [u8; 5]) -> Word {
+ Word { sign, bytes }
+ }
+}
+
+// There are nine registers in MIX.
+// We shall use a small letter "r", prefixed to the neame, to identify a MIX register.
+#[derive(Debug, Default)]
+struct Registers {
+ // Accumulator
+ rA: Word,
+ // Extension
+ rX: Word,
+ // Index registers: Should only hold 2 bytes together with a sign.
+ rI1: Word,
+ rI2: Word,
+ rI3: Word,
+ rI4: Word,
+ rI5: Word,
+ rI6: Word,
+ // Jump: holds two bytes; it behaves as if its sign is always +
+ rJ: Word,
+}
+
+// hacing three values: LESS, EQUAL, or GREATER
+#[derive(Debug, Default)]
+enum ComparisonIndicator {
+ Less,
+ #[default]
+ Equal,
+ Greater,
+}
+
+#[derive(Debug)]
+struct Machine {
+ registers: Registers,
+ // Besides its registers, MIX contains:
+ // an overflow toggle
+ overflow: bool,
+ // a comparison indicator
+ comp: ComparisonIndicator,
+ // memory: 4000 words of storage, each word with five bytes and a sign)
+ memory: [Word; 4000],
+ // and input-output devices
+ // TODO?
+}
+
+impl Machine {
+ fn default() -> Machine {
+ Machine {
+ registers: Registers::default(),
+ overflow: false,
+ comp: ComparisonIndicator::Equal,
+ memory: [Word::default(); 4000],
+ }
+ }
+}
+
+fn main() {
+ println!("{:?}", Machine::default());
+}