UniROM Vic20 e C64
13 July 2023THE SUPER NINTENDO / SUPER FAMICOM AND ITS PROTECTIONS
7 October 2023Mouse for C64/128 restoration
I was given this mouse to repair with a strange defect.
Let's see what it had, but first let's figure out what it is!
This mouse produced by Commodore in 1986 is the successor to the 1350 mouse, which is not really a full-fledged mouse, how come? The 1350 was a mouse with a digital output, this connected to the port of the C64 or 128 and it was as if a joystick was connected to it, when you went right the mouse closed the contact of the right joy port, and ditto for the other directions, the left button was the fire and the right was a second button (pin 9). What is the difference between this mouse and a traditional mouse? well, this one emulating the joystick directions always moves at the same speed!, try it with a cartridge like "The Final Cartridge 3" and the joystick or the mouse, you will find that to get to the bottom of the screen takes several time. If you use a proportional mouse this problem does not exist, if we move the mouse slowly, the pointer will move slowly, while if we move it quickly we will get to the end of the screen in no time.
All the traditional mouse does is keep track of how many steps (movements) you take and tell the computer what the position is for the X and Y axis.
Here we come to mouse 1351, this in fact by default is a proportional mouse with the left button as the fire and the right as the joystick direction on. In a nutshell it works like the paddles, those have a potentiometer that adjusts the voltage on the potX (pin 9) and potY (pin5) inputs. But this mouse does not have a variable resistor or even a pvm signal then stabilized, how does it pass this information to the SID?
Yep, the SID in addition to dealing with audio, handles analog signals by then providing the computer with a value between 0 and 255 on the X and Y axes.
How does the proportional mode work?
Come detto prima dobbiamo passare una tensione al pin X e Y che verrà letta dal SID e convertita in digitale, tipo un moderno ADC converter, questo funziona così:
Il SID utilizza il clock del processore per campionare l’ingresso analogico e in tutto impiega 512 cicli di clock,
per i primi 256 clock il SID applica una resistenza interna al pin che deve leggere, facendo così scaricare il suo condensatore interno al chip. Successivamente scollega la resistenza di pull-down e aspetta che il condensatore interno alla porta si carichi raggiungendo una tensione soglia, ma per caricarsi il condensatore impiega del tempo in base a quanta tensione è applicata all’ingresso della porta che sta leggendo. Per ogni clock passato il SID aumenta il suo registro della porta fino a che non rileva che il condensatore è carico, ma se questo non raggiunge la soglia entro i 256 clock rimasti, per il registro il suo valore è 255, nulla collegato. If the capacitor charges before the end of the count then it will have a value less than 255, in fact if it charges instantly (first clock cycle) its value will be 0.
Well, now that we know how the SID thinks and how it reads this value, we can make sure that we charge the capacitor by applying a voltage on the port, at any time--or almost any time!
The mouse reasons like this:
The heart of it all is the MOS5717 which controls the movements of the mouse via the usual photodiodes (like an encoder) and keeps track of the position of the pointer, like a modern mouse, but to pass this information to the computer it uses this method.
It waits for the signal on the potY port to go down, a sign that the SID is beginning its cycle of discharge and subsequent charge.
It monitors the mouse movements and counts 256 clock cycles, but how does it do that? well it too has a 1Mhz quartz like the C64/128
When these cycles have passed, it just gives a positive pulse to the X and Y port at the appropriate time, counting how many cycles pass and instantly charging the capacitor when the number of clocks corresponding to the value to be given to the register has elapsed.
Clever, isn't it!
Another thing to mention is that the mouse does not work only in this mode, it is designed to be compatible with its predecessor as well.
Holding down the right mouse button while turning on the computer or connecting it to it, the mouse goes into 1350 mode and reasons as a digital mouse, closing the joystick directions based on how we move the mouse.
Most frequent faults
This mouse is simple but at the same time critical; it takes little to make it not work well.
This is the schematic of revision A, unfortunately I have revision B and could not find its schematic which is slightly different. The most critical part is really the encoder and photodiode wheels that with dirt can decrease their efficiency and not operate the mouse. Other cases are the misalignment of these photodiodes that no longer point correctly or the wheels that have become deformed. It may happen that even after cleaning and verifying that the diodes are working, the mouse does not move one or all directions, this is the case where it is worth checking the voltages at the ends of the resistors R6~R9 because if these are below about 3.4V it may not be interpreted as a high signal. It will be necessary in this case to find a higher value that brings the voltage back above 4V.
In my case
As mentioned above, most of the time the mouse will not move in one or all directions in any mode if the problem comes from the photodiodes, partitions, etc.
This mouse in fact did not work well in the proportional mode, not that it didn't work at all, it would move on all directions but after about a 1-2 centimeter travel it would return to the starting position, and it did so with all directions.
It could not have been a problem with encoder signal recognition, otherwise it would not have moved, plus in the joystick mode it worked fine.
I had later found that by keeping it connected for at least 30 seconds, it would start working properly even in proportional mode. It seemed to be a synchronism defect, see description of operation.
Well, in the end I also changed some capacitors that were no longer in good condition (C3,C5), but the rest were all working and the problem remained. The clock was perfect, nothing seemed to be wrong with it, even the transistor that is not in the schematic was good. Eventually I discovered that the resistor that is listed here as R11 of 5.1K while in my mouse it was 1M, was the one that made the micro recognize the sync signal. I tried lowering its value by replacing it with others of 820k, 470k ... and I noticed that the waiting time for it to work well was getting shorter and shorter. I finally got it down to 100k and the mouse works fine right away.
Watch the video to see all the steps and subscribe to the channel to help us move forward with these videos and repairs!!!