Since Wraith wanted tick to be equal to 1 and 0 only, and reset to 0 when tick = 2, this does exactly that. Many moons ago, a user named moon had used something similar in an example he had posted on the forums. These are called "bitwise functions", and come in 3 flavors:
And, Or, and Xor
What the code above is doing is taking tick + 1 and then perform the And function on it and the number 1. So what does the And function do? It takes the values of "tick" and "1" in their binary form and returns the values that match up in the same locations. For example, if tick = 5, in binary, it would look like: 0101, while 1 looks like 0001 (I'm only using 4 bits for this example). So what values are in the same location? 0X01 for "tick" and 0X01 for "1". The X represents a mismatch. A mismatch turns into a 0. We carry these down, and we get 0001. When tick = 1, then runs into this line of code, it really looks like: 1+1 And 1 -> 2 And 1 -> 0010 And 0001 -> result = 0
The Or function returns values if either bit is a 1, so using the first example (tick = 5) And 1 it would result in: 0101 Or 0001 = 0101. Because the bit is 1 in the first value Or the 2nd value, it returns a 1.
The Xor function (eXclusive Or) means it will return a 1 if only a 1 is present in either value in the bit location. Using tick = 5 again: 0101 Xor 0001 = 010X Xor 000X = 0100
I would also like to see that, i'm killing myself trying to get the it with "hex$(VdpRamRead(address)" and decoding it...but it only (kinda) works with backgrounds when we use unique tiles to screen X, Y and the VdpRamWrite, but again it's a mess beyound what I can understand 1 hour later after coding (I'm laughing on the outside, but crying on the inside)