Can individual pins of different port of a microcontroller be mapped to a register and their values be changed when changing the register value?
It appears your question comes down to having a 8 bit value in the firmware, and wanting to read and write that from and to a arbitrary collection of port pins.

There is no direct hardware way to do this.  You have to write two routines, one to read the 8 bit value and one to write it.  Others have mentioned using unions, but that is a bad idea.  With unions, you have to deal with every bit separately, and the code becomes dependent on the bit order of the micro.  This might be the way to go anyway if all the 8 bits are scattered completely independently.  If so, there is little you can do but to make special code for each bit.

The better way to do this, especially if you can group the bits in a few contiguous chunks on the physical ports is to use masking, shifting, and ORing.  For example, if the low three bits of the internal byte are on bits &lt;6-4> of a port, right shift that port value by 4 and AND it with 7 to get those bits into their final position.  Shift and mask (or mask and shift) bits from other ports into place and assemble the final 8 bit byte by ORing the results into it.

This kind of low level bit twiddling is easier to do in assembler than C.  I'd probably put the byte read and write routines in a single assembler module and make the interface callable from C.