<!-- PDF page 233 -->

You can verify this actually changes things by doing a **RUN AT 2** and give the **OUT/IN** sequence again. As you will see from the list that follows, not every *NextREG* is dedicated solely to one function; in this case the only bits that concerned us were Bits **0** and **1** and that's why we used a 2-bit bitmask with the bitwise *AND* operator **&**. For the same example using just the **REG** command, our line would have been as simple as:

```
REG 7,3
```

In our example in *Chapter 17* where we read *NextREG* 5h we also used bit shifting which is a great way to get the value of a single bit in a register. In our case we only needed bit 2 of the register so after getting the specific bit by bitwise AND (**&**) the register value with a 3-bit bitmask, we shifted it two places (bits) to the right by using the right bit-shifting operator (>>). That way we were able to get the value of the single register bit.

Generally speaking, you will often want to modify individual bits in a *NextREG* without changing the remaining ones.

You can do this by first reading the NextREG and then *masking off* the bits you want to leave unchanged by using bitwise AND (**&**) and finally write that value with the new bits added in.

We'll list all of *NextREG*s below in numerical order. Not every register is accessible, so pay attention to the key at the start of the list to understand whether a register can be read, written or both.

