That is also possible. You can use the bit AND operator (&).

Code:
if (porta & %00010101)=%00010101 then
The purpose of (porta & %00010101) is to strip out the unwanted information. Only the bit where you see a 1 will be kept from porta. Then you compare that with the value you are looking for

Edit: Looks like skimask got there before me!