Note that we do REG_VALUE(r) * 9 because we learned that each xor a register with itself is nine opcodes away from the next one. What’s in between? If you want to xor a register with a different register.

That’s a really confusing way to put it. It’s really (R<<3) | R. R is a 3-bit register identifier; the low 3 bits of the result are the destination register, and the next 3 bits are the source register. But of course, since (R<<3) and R have no bits in common, oring them is the same as adding them; and R<<3 is the same as R*8; so the original expression is equivalent to (R*8)+R, which is equivalent to R*9.

That’s a really confusing way to put it. It’s really (R<<3) | R. R is a 3-bit register identifier; the low 3 bits of the result are the destination register, and the next 3 bits are the source register. But of course, since (R<<3) and R have no bits in common, oring them is the same as adding them; and R<<3 is the same as R*8; so the original expression is equivalent to (R*8)+R, which is equivalent to R*9.