I don't know anything about your trackball setup, but the hex inverter ICs are pretty simple. Wire up +5 volts to the Vcc pin, ground to the ground pin, the input you want to invert to one of the inputs, and the desired output to the corresponding output pin.
You should be able to google "inverter pinout" or something similar.
7404: Hex Inverter
7405: Hex Inverter with Open Collector Outputs
7406: Hex Inverter Buffer/Driver with 30V Open Collector Outputs