The Joy232 is essentially a bitbang routine. Timing is controlled by software.
But count time in a standard MSX computer is tricky because the hardware inserts one wait state at each each machine cycle. Then it is necessary to check how many M1 cycles happens on each instruction and add them to know exactly how many clock cycles will be spent.
For instance, a NOP takes 4 clock cycles on a Z80, but it takes 5 clock cycles on a MSX.