Some C Syntax

To allocate and initialize a table in assembly, you would do the following:
tbird:   .db   0x00,0x08,0x0C,0x0E,0x0F,0x00,0x10,0x30,0x70,0xF0
To allocate and initialize a table in C, you could do:
unsigned char tbird[10];

tbird[0] = 0x00;
tbird[1] = 0x08;
      .
      .
      .
Or
unsigned char tbird[] = {0x00,0x08,0x0C,0x0E,0x0F,0x00,0x10,0x30,0x70,0xF0};
In C, array indices start at 0. Thus, to access the 0x0C element, you would refer to tbird[2].

To do a bitwise AND in assembly, you would load one of the operands into an accumulator and use the anda or andb instruction. For example,

    ldaa   PORTC
    anda   #0x03
To do the same in C, you would:
    PORTC & 0x03
Here are some more common operators in C:
 
 
Add
i + j
Is i equal to j? if (i == j)
Subtract
i - j
Is i not equal to j? if (i !=  j)
Multiply
i * j
Is i less than j? if (i < j)
Divide
i / j
Is i less than or equal to j? if (i <= j)
Bitwise AND
i & j
Is i greater than j? if (i > j)
Bitwise OR
i | j
Is i greater than or equal to j? if (i >= j)
Bitwise Exclulsive OR
i ^ j
Is i < 0 and j = 5? if ((i<0) && (j==5))
Bitwise Complement
~i
Is i < 0 or j = 5? if ((i<0) || (j==5))
Negate (2's Complement)
-i


Left shift
i << 1


Right shift
i >> 1