I can not help much on th decoding but there is a problem with your setup. PORT.A is analog so you will need to turn the ADC off.
http://www.picbasic.co.uk/forum/showthread.php?t=561