Questo articolo, relativo alla riparazione della memoria di un Commodore 64 è parte di un restauro ben più ampio. Ho infatti trovato un vecchio retrocomputer Commodore 64 su Facebook Marketplace per pochi euro, ma presentava parecchi difetti. Innanzitutto mancavano tutti gli accessori (anche l'alimentatore). La tastiera aveva due tasti mancanti, il monitor mostrava caratteri strani e, infine, l'audio del computer non funzionava! A huge mess!


Initially I had thought of using this computer to withdraw the spare parts for another Commodore 64 that I wanted to adjust, but ... repairing such extensive damage would have been quite a challenge!
Commodore 64 memory defect diagnosis
Il difetto della memoria del Commodore 64 si presentava subito all'accensione:
- era presente l'errore "OUT OF MEMORY ERROR IN 0";
- the monitor showed strange characters in random positions.

Without memory available, because it was defective, it was not even possible to load a diagnostic program for the memory itself, to understand which was the faulty RAM chip. I then consulted the Commodore 64 service manual (attached at the bottom of this page) to retrieve the electrical diagram of the memory.

It can be seen that the RAM of the Commodore 64 is composed of 8 chips. Each chip contains 64K x 1 bit of memory - it does not contain integer bytes, but each chip takes care of a single bit. And so here is the correspondence between the RAM memory chips and the corresponding bits:

- D0 = U21
- D1 = U9
- D2 = u22
- D3 = U10
- D4 = U23
- D5 = u11
- D6 = U24
- D7=U12
A questo punto, dovevo solo capire quale bit fosse difettoso, che trasformava, sul monitor, il carattere "spazio" nel dollaro "$". Per questa analisi, si rende utile la tabella dei caratteri del Commodore 64, altrimenti chiamata CBM ASCII:

Il carattere "spazio" corrisponde al numero &H20 (in esadecimale), che è il 32 (espresso in numeri decimali). Invece, il carattere dollaro "$" corrisponde al numero &H24 (in esadecimale), che è il 36 (in decimale). Il numero del carattere si è quindi spostato da 32 a 36, con un incremento di 4. Esprimendo il numero 4 in potenze di 2, si ottiene 2^2. Da questo ragionamento, si evince che il bit difettoso della memoria RAM era il D2, corrispondente al chip U22.
Reading memory Commodore 64
Without fail, I replaced the C64's U22 chip with an identical one, an MT4264-15 purchased online. Obviously I bought a few more spare RAM chips, which, as we will see shortly, was useful to me.
To repair the memory of the Commodore 64, and then replace the RAM chip, I first removed the old defective chip, and then soldered a socket, where I housed the new MT4264-15 chip. I installed the new memory chip of the Commodore 64 on the socket, to do compatibility experiments of the various RAM memories, which I will describe shortly.


The replacement of the memory chip had positive effects, in fact the Commodore 64 started with the usual boot screen.
Another broken memory chip
Nonostante la sostituzione del chip, il Commodore 64 non aveva la quantità di RAM libera prevista: 38911 bytes. A volte erano disponibili solo 3K, a volte 12K. Insomma: c'era un altro chip di memoria difettoso. Ecco perché mi ha fatto comodo acquistare qualche chip RAM in più!
Sul monitor non vedevo caratteri strani, per cui i bit difettosi dovevano trovarsi in un'altra area di memoria, esterna alla memoria video. Ho quindi scritto un programma, in BASIC, molto compatto, per la scansione di tutti i byte della RAM ed individuare quelli difettosi. L'idea è semplice e si basa sul principio di funzionamento della memoria RAM:
- si scansionano i byte di RAM ad uno ad uno (esterni all'area del programma stesso!)
- you write the number 0
- you read the same box, which must return the number just written: 0
- you write the number 255
- you read the same box, which must return the number just written: 255
And here is my program to test the RAM memory of the Commodore 64 in operation.

Scanning the RAM detected some faulty bytes. The number 0 turned into 1, while the number 255 turned into 254. From the reasoning already described in the previous paragraphs, it is clear that the difference between the correct number and the wrong one is 1, corresponding to 2 ^ 0 expressed in powers of 2. So the second faulty MT4264-15 RAM chip was U21, corresponding to the D0 bit line. I then replaced this second chip as well, mounting the new one on the socket.
Finally the memory of the Commodore 64 was in place!
Commodore 64 memory experiments
While searching online for the Commodore 64's RAM memory chips, I came across several alternatives. My computer was fitted with the MT4264-15 memory chip. Online I also found other acronyms, which, from datasheet, seemed to have the same characteristics, if not for the different speed (RAS access time).
Initially I replaced the chips with other identical ones, but, having mounted the socketes to replace the chips very quickly and without damaging them, I also tried to mount chips with other acronyms, and then test the operation of the C64.

At the end of all the tests, I can conclude that it is possible to mount indifferently any RAM memory chip on the Commodore 64, even mixing the various acronyms on the same mainboard, as seen from the attached photo above.
E' possibile quindi sostituire i chip di memoria RAM con qualsiasi presente in questa lista: 4164-2, MT4264-15, MT4264-20, HM4864P-2, M3764-15RS.
Regarding the speed of the chip, it is good to choose one with RAS access time equal to or less than 200ns. The above abbreviations already take this into account.

Documentation
In support of this Article, I attach:
- il Commodore 64 Service Manual: it is a technical manual useful to understand the operation of the Commodore C64 and C64C circuits;
- the datasheet of the RAM chip MT4264-15.
interesting! Thanks for sharing.
Amedeo, I would like to see videos on how to repair the power supplies of the commodore 64 and C64C, as well as on the power supplies of the floppy drives 1541-II and the repair on the datassettes. Can you prepare them ??
And if you can best buy these products, or the power supplies just mentioned. Greetings
Sicuramente è un argomento interessante. La riparazione non è mai una cosa banale: i difetti possono essere tanti ed in diverse sezioni dell'alimentatore. Avevo realizzato 2 articoli/video in cui ho riparato due diversi alimentatori Atari e, come vedi, i difetti e le tipologie erano diverse:
https://www.valoroso.it/floppy-disk-drive-atari-1050-riparazione-alimentatore-prova/
https://www.valoroso.it/atari-800xl-atari-1050-con-alimentatore-in-corto-circuito/
Hi Amedeo
I am writing to you just to tell you that this page on repairing RAM memory C64 I was
very useful for which I wanted to thank you, very interesting also the reasoning you have
followed to find the failed ram based on the displayed characters.
I already follow you on Youtube and Facebook.
Hello Andrea, thank you very much! I am very pleased!
Complimenti, Amedeo. Io ho un commodore 64 con alimentatore, 3 registratori, 2 joystik. Lo acquistai nel 1983, ci giocai per un paio di anni e poi, ad un tratto, smise di funzionare. In accensione non mi dava piu' la scritta iniziale. Non ricordo piu' cosa scrivesse. Provai a chiedere all'epoca ad un tecnico e mi disse che aveva perso la memoria e che ci volevano 500.000 lire per ripararlo.(Se ricordo bene lo avevo pagato 450.000). Lo misi in garage, dove si trova tutt'ora. Mi piacerebbe poterlo rimettere in funzione ma senza spenderci un capitale. Qualche consiglio in merito? Grazie
Thank you! I'm sorry for your computer. Definitely worth getting it repaired. I do not repair on behalf of third parties, but if you contact me I can introduce you to someone who repairs professionally: https://www.valoroso.it/contatta-amedeo-valoroso