You should look up how to do "real" port manipulation on the 4809.
What you're doing now uses a "compatibility package" that is ... quite slow, probably defeating whatever you had in mind.
And PORTx is (simulating) an output register, so perhaps it doesn't return values.