The trackball is type of controller that uses a quadrature encoder. This type of encoding is also used in the driving controller and mechanical mice.
There's code floating around to read various types of quadrature encoders including Atari and Amiga Mice (see Bob Colberts Stella Sketch for instance)
The basic idea is to have a sensor mounted on a rotating shaft to detect it's motion. If you've seen inside a mechanical mouse, you can see that this is done by passing a wheel with slot through a beam of light. The slots interrupt the light and generate an on/off state.
With one detector you only know that the shaft is turning and can deterimine it's speed. If however you place a second wheel / sensor that where the slots are 90 degrees out of phase with the first wheel/sensor you will be able to determine the direction by the order in which the two sets of signals go on/off.
There are four states 00 01 11 10 (this is where the quad in quadtrature is derived) and then it repeats. If the states happen in reverse order then the shaft is turning the other direction.
The output is also known as a 2 bit Gray code. A Gray code is a binary sequence where only one bit changes per change in state.
In the assembler listings I have seen it appears that the CX80 trackball follows the standard sequence I have listed above. However, it appears that Thomas was having some issues with the CX22 because there are several attempts at tables and the final version is very odd at 10 00 00 10 which only has a one bit encoding! Perhaps Thomas can enlighten us?
BTW a third signal is sometimes provided which gives an absolute reference for when the shaft passes the 'zero' point.
Here's the Missle command trackball source in question. It appears to also support building for mice.
http://www.atariage....ber/019265.html
For me it's attached as Missle_TC_1.2.obj but just rename it to .asm