Let's start describing the function of each register and then detailing one example.

**T register**

T is a "simple" temporary register with the output always available (meaning no 3state).

It serves many purposes:

- Some of its bits are wired to the control logic, to perform conditional jumps, and in particular the fifth one (half carry), the eight one (sign), and the (wired)OR of all its bits (used for conditional jump for zero/not zero condition)
- It allows to prepare the Program Counter page for long jumps (similarly as it is done with Y register in the "standard" gigatron)
- It allows the proper load of U, V (inputs for LUT operations), and W (output of LUT operations), all explained later

**U and V registers**

U and V are used to alternatively address the RAM, in the same way that X does.

These registers are wired in a way to permit to load in parallel values present in T register and the BUS (containing one of S, W, ROM D, etc); this load fills with a single instruction both V with high nibbles of T and BUS, and U with low nibbles as in this C pseudo syntax:

Code: Select all

```
U = (T << 4) + (BUS & $0F) ; V = (T & $F0) + ( BUS >> 4) # both assignment in a single clock cycle load operation
```

**W register**

W register is used to mix back the results from the lookup of the two nibbles operations.

It is wired in a way that one operation will get the values of the lower nibbles present in the T register and the BUS and combine them into a single byte. As before with pseudo C code:

Code: Select all

```
W = ( BUS & $F0) + (T & $0F) #
```

**Example**

In this example we'll follow the XOR of S holding value "$A1" with T holding value "$B2".

The code taken from first post is:

Code: Select all

```
1. U, V = S x T # pair the nibbles of the two input operands in U and V
2. Y = XorLutPage # point to the lookup containing in the low nibbles the XOR of the low and high nibble of the index
3. T = [Y,U] # calculate the XOR of the low nibbles
4. W = T + [Y,V] # calculate the XOR of the high nibbles and join them with low ones to store the result in W
```

- After first instruction we have inside V the value "$AB" (the high nibbles of S and T) and inside U the value "$12" (the low nibbles of S and T)
- The second step is just assigning to Y to the page where the lookup table of the XOR is located. The 256 byte table is built in a way that the value represented has in the low nibble the XOR of the high nibble and the low nibble of the index
- In the third instruction we put in T the value at address [Y,U], that as said contains XOR of the two nibbles of U, and since U is $12 the result of $01 XOR $02 will be $03
- In the fourth instruction we put in the low nibble of W the "3" coming from the low nibble of T, while in the high nibble of W will be put the low nibble of the lookup of the V value, and since V is $AB the value in the table at page Y would be $01 ($0A xor $0B); so W will contain $13, that is the result of the XOR of $A1 and $B2