PS/2 Mouse on DTV

I found myself wishing for a mouse on my Commodore DTV. However, Commodore mice are very difficult to find. Besides, it wouldn't be compatible with the DTV anyway as the POT lines are not connected. a 1350 mouse might work on a Version 1 DTV or a PAL DTV. But a Hummer has no joystick ports so it would have to connect to the userport.

Well, I found myself reasoning that the userport could probably run a PS/2 mouse. So with the help of this site : http://www.computer-engineering.org/ps2protocol/ and Hannu Nuotio, we set off to design a driver for the mouse. At first it seemed impossible. The data was comming in too quickly and there was always at least 1 bit of corruption in the serial datastream. However, we found that enabling the DTV's burst mode and turning off the badlines seemed to cure the problem. At the moment, the routine is extreemly stable on the DTV but will not currently work on a C64. It might be possible if the right person with knowledge of C64 timing were to modify the code so that it could operate without badlines and without turning the screen off.

The connection to the DTV is very simple:
PS/2 Clock - User 6
PS/2 Data - User 7
PS/2 +5V and Ground to the usual places.


Source code: POINTER2.ASM - Version 0.9 (updated on 10-01-2006)
Binary: POINTER2.PRG (execute by SYS 49152)
PS2DRAW.PRG - a small BASIC program to demonstrate the idea.

Blocks II - An all-in-one ML program demonstrating the use of the mouse.
BLOCKS2.PRG - Ready-to-try binary
BLOCKS2.ASM - Source code for above.

The driver will automatically install itself on the interrupt routine and place a 2-color mouse pointer on the screen. (It is two sprites, a white pointer with a black outline) Then you will be returned to BASIC. The pointer will continue to move even while you are typing in BASIC. This allows you to use the mouse from BASIC by doing PEEKs to specific locations to find the X, Y coordinates, and the status of the buttons.

If you start the program and the border of the screen just flashes forever, that means the driver did not get the expected response when initializing the mouse - Check your connections. An easy mistake to make is accidently connecting the mouse to the Cassette-sense line which is right next to the user-port on the DTV. Also, when I say lines 6-7, that is counting from 0 to 7, not from 1 to 8. So 6 and 7 are the last two lines of the userport.

Here is a screenshot of the pointer on the screen. Watch the video here: http://video.google.com/videoplay?docid=-1335380959309899934


Back to main DTV Hacking Page