Tandy Hi-Res Joystick Interface

Screen Shot 2022-03-27 at 12.20.09 AMI was recently told about a bug in MAME’s implementation of the Tandy Hi-Res Joystick interface. The author of C-III Pages (an early desktop publishing application for the Color Computer) discovered the mouse cursor would only go 7/8th across the width of the screen.
This means it is now time to really try to understand the device. Reading the code in MAME doesn’t really tell the whole story, and none of the values that are chosen are explained.
So I did what I always do, I wrote a test program to run on real hardware. https://github.com/tlindner/HiRes-Interface-Test
This program uses a slightly modified version of the sampling code found in most software. It does not do any scaling of the returned values to fit within the screen width or height. It leaves them raw.
I have in my possession four “joysticks” to test. A black beauty, a delux joystick, a C&H joystick, and a Koala Touchpad. The testing procedure was to start the program and wiggle the joystick while looking at the graphic screen (the G command). When I filled in as much as the four rectangles as I could, I returned to the text screen and took a screen shot.

Black Beauty Screen Shot 2022-03-26 at 9.48.38 PM capture17
Deluxe Joystick Screen Shot 2022-03-26 at 9.48.15 PM capture18
C&H Joystick Screen Shot 2022-03-26 at 9.49.04 PM capture19
Koala Touch pad Screen Shot 2022-03-26 at 9.49.20 PM capture20

The Kola touch pad had the weirdest response to both versions of the sampling routine. See the image below and notice how much noise is in the bitmaps:
capture21
Here is what MAME is doing as of today:

Speed Start Value End Value Length
Slow 99 805 706
Fast 99 805 706

After going over the data here is what I am going to change MAME to do:

Speed Start Value End Value Length
Slow 40 475 435
Fast 80 950 870

Hopefully this will fix the bug in MAME that affects C-III Pages and not cause any regressions.
If you want to run the program your self with your own interfaces and joystick, I would love more data. I am especially interested in what the 1 and 2 button Color Mice do.
I would also like to get values from the Color Max 3 hi-res interface. If uses the same method, but the RC values are different in the circuit.