Quote Originally Posted by sheepdog View Post
"reversed_a = a REV 8 'reverse 8 bits of variable a in which I mirrored PORTA register"
B0 = portx
B1 = ^ B0 ' Reverse state of bits of B0
B0 = NCD B1
select case etc
B1 = ^ B0
B0 = NCD B1 check for other interupts exit if 0

Bruces would probably be the fastest way, I have an affliction for making thinks more complex than perhaps need be. Did not realise pins default high etc.
All the best
Interesting, it would be fine if I was scanning from MSB to LSB, it is not the case.
Pin0 is the head
...
Pin4 is the right arm
Default porta is %xx111111
If Pin0 is activated we will have %xx111110
Reversed it will be %xx000001

It will tell me it is pin0, okay. What if there are two activated pins, example, reversed it would be %xx001001, it will tell me the activated pin is pin 3, which is true but as I have to scan starting from pin0, I will think the left arm was hit and use that info while the head was hit too, which is much worst (lethal) and the player will get some damage while a hit in the head would tag him out. See?