ps if you want to address pins as 0-7 then to turn on port b.3 without messing up the rest of the port:
Code:
bitindex = 1
bitindex = bitindex << 3
portbshadow = portb
portb = portshadow^index
It could be tighter, but I’m not sure what you can directly operate on a port value,
or if you can shift a constant to get the right result in bitindex.

Code:
bitindex = 1 << 3
portb = portb^index