Did you try
c166-ghidra-module? Working in latest Ghidra v11.2.1.
Check the c164
User Manual and
Datasheet, it's probably used in alternate function mode, connected to a timer in Incremental Interface Mode.
Edit: I found
FUN_01dc52 doing
T3CON = 0x1b3 (0 1 1 0
110 011)
This effectively sets T3 into incremental interface mode. In this mode, the timer runs automatically from the encoder pulses.
If you want to know what uses the encoder, find what reads T3, but I wasn't able to find it out, neither anything setting T3 interrupts (T3IC reg) or anything else accessing T3, it might be using some sort of byte SFR addressing or indirect addressing that Ghidra isn't recognizing.
Attached the decompiled program.