Since PortA is at 00Ch and PortF is at 28Ch the "distance" between them would be 28Ch - 00Ch = 280h or 640 in decimal.

Now, LOOKUP can only retrieve 8bit values from its table so it's not going to work. You'll have to use LOOKUP2.
Next possible issue is that the registers for Ports F and G are not in the same bank as those for Ports A-E so I'm not sure it's work....

/Henrik.