CONFUSING POKES Usually, when you see a POKE and a PEEK to and from the same byte, it's done in conjunction with an AND or OR command. Each byte is composed of eight bits. Each of the eight bits is like a light switch: It can be either on (1) or off (0). Each of the eight bits has its own value. BIT 7 6 5 4 3 2 1 0 VALUE 128 64 32 16 8 4 2 1 Any byte can hold a value from 0 to 255. The value of the byte is deter- mined by which bits are on or off, and is derive d by adding the values of each of the on bits. This is called a binary number. When you use the AND and OR commands, it's like placing a mask over the 8 bits in the byte. The mask is, in effect, placed over the byte, and the bits in the byte are turned on or off according to the rules governing AND and OR. The mask can be thought of as an imaginary byte with bits set or not depending on the mask number. The bit pattern of the masking byte follows the same rules of binary number s just described. For example, if you'r e ANDing or ORing with a value of 21, th e bit pattern of the mask would look lik e 00010101 (16+4+1=21). When you AND a byte, you compare each bit of the byte with each bit of the mask. The result will be an "on bit" on ly if both bits (of the byte and the mas k) are "on" in that position. For example, ANDing a byte with a value of eleven (00001011) with a three (00000011) would result in 00000011 (three). This is because the 1 and 2 bits of both bytes were 1's, but the 8 bit in the mask was a 0. ORing a byte compares each bit in the same manner as the AND. But when you OR, if the bit in either the original or the mask byte is a one, then the resu lt is a one ("on"). For example, ORing a byte containing a value of 15 (00001111) with 240 (11110000) would result in 11111111 (255). This is because in all cases of the compare, at lest one of the bits was a 1.