Inari figures

Amiga 500 Restauration, Part 3

After the test run was successful in the previous part, it's now time to put my Amiga back together.

Whitening

I've got the case parts and keycaps back from whitening at the CBM Museum Wuppertal. And the mandatory before-after photos proove that they did a great job:

Before whiteningAfter whitening

Sadly the PSU case is made of a cheaper material, and could not be whitened any further without risking the dreadened "nacre effect", so it stills look a bit yellowed. (I forgot to use a ring light for the photos, but I did my best to make both pictures comparable.)

Removing the Rust

Due to my careless storage in the cellar, the metal shielding got a bit of rust over the years. I removed the worst rust spots with a fiberglass pen. Then I polished the shields with Nevr-Dull wadding polish, which removed a lot of the rust film. The result is still far from perfect, but it's hard to impossible to restore the original look of the shielding, so I decided to keep it that way.

The upper shield after removing the rust and polishing.

PSU

I have already prepared the PSU in in the last part. Now that I also got the PSU case back, it's time to put it together. I've first replaced the power switch, as the old one got broken over the years. Luckily it's a standard switch that can still be found at electronic shops.

The RT-65B in its new housing. The photo shows an early attempt with swapped mains and power cables.

The Mean Well RT-65B fits into the case surprisingly well, almost as if it was made for it. I only had some difficulties to find a proper position for the wires. I tried different positions, and also tried to switch the sides of the mains and Amiga power cables.

The best result seems to be the original orientation of the cables (mains cable at the side of the power switch). With a bit of tweaking, I could finally route all the wires properly, make the RT-65B fit in, and close the PSU case.

I recommend to check the correct wiring (especially of the earthing) and the voltages once again. Also make sure that the terminals are firmly closed, and that no wires are overly bent, squeezed, or punctured.

GOEX Drive

The GOEX drive optionally comes with an OLED display that sits on top of the Amiga case and shows the currently selected file, and the current disk track. I can really recommend to order that display with the drive, as it makes selecting a file a lot easier. Unless of course you use the "GOEX on pills" version that offers a disk menu on the screen as OSD, but I wasn't sure how this version would interfere with the RGB-to-HDMI converter I am using.

The display is readily assembled, and already has crimp connectors at the end of the cable. The idea was to push them through an opening of the ventilation grille, but they just were too big for that. I had to cut them off, push the ribbon cable through an opening, and then solder new connectors to the cable.

HDMI Connector

Next problem was the HDMI connector. I use c0pperdragon's RGB-to-HDMI converter to connect my Amiga to a TV or monitor via HDMI. But where should I put the HDMI connector so I can reach it from the outside of the case?

My original idea was to cut a matching hole into the back of the Amiga case, but later I dismissed the plan and decided against disfiguring the case even further than I already did in the 1990s. A better idea was to print an expansion port cover with a hole for a HDMI cable, even though I disliked the thought that a cable would then loosely hang out of the case.

Then I noticed that the GOEX drive left a hole where the floppy drive's eject button has once been. And this hole is actually big enough for a HDMI connector, almost as if it has always been meant for that purpose.

The HDMI connector fits amazingly well!The holder frame (white) sits within the frame of the GOEX drive (grey) and does not need any screws.

I designed a 3D printed frame that holds the connector of a Delock 85463 panel-mount HDMI connector. You can find the STL file at Thingiverse for reprinting.

It looks a bit weird when a HDMI cable is plugged into that place where once the disk eject button has been, but it is working amazingly well, and saved me from cutting further holes into the Amiga case.

Completed

Now everything was mounted in its place. I couldn't close the upper shielding though, because the HDMI converter is in the way, so I decided to leave it out.

Everything is completed and in its final place.

And that concludes the restauration project. Welcome back, Amiga 500. With this hardware upgrade, you should be fit for at least the next decade.

Welcome back, Amiga!

The Kickstart Dilemma

Well, not quite. There is a Kickstart 2.04 ROM installed in this Amiga, and while playing some old games, I found out that a surprisingly large number of them crash on that version of the AmigaOS. It was indeed a big problem of the Amiga back in these days. In the previous generation of home computers, the operating system was static and was never updated, so programmers assumed to find certain routines at fixed positions. When the Amiga got popular, programmers continued to use the operating system like that, ignoring documented rules. Then in 1990, Commodore released Kickstart 2.0, a major AmigaOS upgrade. And suddenly, many poorly programmed games crashed, but instead of the programmers, the Amiga was blamed for it.

I still have an original Kickstart 1.2 ROM here, along with a ROM switch. Maybe I will use that board again. Luckily, I haven't yet closed the holes that I once drilled into the case, so I can use one for the switch again.

Amiga 500 Restauration, Part 2

In the first part, I dusted off and checked my old Amiga 500. I've also ordered all parts for the project, and they have been delivered by now. Let's start with the restauration!

Recapping

All home computers of the 1980s and 1990s have been designed for common households, and thus had to be cheap. Commodore did not expect that the Amiga would become an "old dame" some day, so they used standard components. A common problem is that electrolyic capacitors dry out over the years, losing their capacity. Some may even leak and, in worst case, damage the board. So the first restauration step is always to replace all electrolytic capacitors, even if they should still look fine.

As I don't want to repeat that process in a decade or so, I ordered premium capacitors with an expected lifetime of 10,000 h, which is probably tenfold of the standard caps' lifetime. At the bottom of this article, I have listed all the caps on my Amiga 500 Rev 6A board.

On the first sight, all capacitors seemed to be fine. Still, after removing one of them, I found traces of dried electrolyte on the board and at the bottom of the component. It really shows that a superficial inspection can be deceiving.

I also removed the wires of my self-made NMI button, and looked for cold solder joints and other potential problems. As final step, I carefully washed the mainboard with IPA.

Recapping completed!

HDMI Output

Let's start with the next construction site. As it gets more and more difficult to find TVs with a SCART connector (and I never liked them anyway), I want to connect my Amiga 500 via HDMI. Luckily there is a project by c0pperdragon that adds a pixel-perfect HDMI output to the Denise chip. The converter cannot be bought at shops, but you need to assemble it yourself. It consists of a few standard components that can be bought at good electronic shops, while the board can be ordered at PCB manufacturers. The assembly requires some fine-pitch SMD soldering though. If you don't feel comfortable with that, you maybe find a private seller for a readily assembled board.

To install the adapter, the Denise chip is removed from its socket first. Then the adapter is placed into the socket, and Denise into the adapter. A button can be connected for changing the configuration and taking screenshots, but that is not really required for operation.

The RGB to HDMI adapter. Denise is already plugged in, but the Raspberry Pi Zero is missing.

The RGBtoHDMI firmware needs to be extracted to a FAT formatted MicroSD card. Make sure to use release 20210322_f771e51 or later. Earlier releases will not work, but only show four colored rectangles.

Finally the Raspberry Pi Zero is plugged into the socket. Be very careful here! The pin header will also fit if not aligned properly, and may then damage your Raspberry or (even worse!) your Amiga.

It's easy to make a mistake here, so be extra careful that the Raspberry is properly connected.

New Power Supply

In the first part I found some liquid at the bottom of the power supply's PCB. I suspected it was capacitor liquid, but my contact at the CBM Museum Wuppertal explained me that it was just a lot of flux. Still, the old power supply would need a technical overhaul, which I can only recommend to people who know exactly what they are doing.

WARNING: Switched power supplies may still contain high voltages hours after they have been disconnected from mains. I strongly advise against attempting repairs yourself. If you decide to keep your old PSU, please ask a trained technician to restore it for you!

As I am not "trained personnel" myself, I decided against restoring the original PSU, but for replacing it by a Mean Well RT-65B. It has sufficient power, and also fits nicely into the original Amiga PSU case.

Before I removed the wires from the old PSU, I took notes on what color is connected to what voltage. Then I removed the wires, put crimp shoes on the wire endings, and connected them to the corresponding output of the new PSU.

My original PSU had a separate SEN wire. It is connected to +5V at the power plug, and is used so the old PSU could compensate wire losses and provide exactly 5V there. The replacement PSU does not provide a sense connector, so I just connected the SEN wire to the +5V line to increase the total cross-section and reduce losses, but it can also just be left open.

The "shield" wire must be connected to earth.

ATTENTION: There were different variants of Amiga 500 power supplies on the market. Your number of wires, and the wire color code, may be different. Do not just rely on my photos!

This is how it looked like after the wiring:

Mains power below, Amiga power above. Shield is connected to earth.red: +5V – black: ground – brown: +12V – white: -12V – yellow: +5V sense. Your colors may be different!Amiga 500 power connector pinout.

Do not connect your PSU to mains yet! First switch your multimeter to continuity test mode, and test if your earthing is connected to the PSU case, and to the shield and the shield pin of the Amiga power plug. After that, test if the power lines are properly connected. Now you can power up your PSU, and use your multimeter to check the voltages at the Amiga power plug.

ATTENTION: Please be very careful when you test the PSU outside the case. Make sure you cannot accidentally touch the live terminals. Also do not open the shielding of the PSU.

Test Run

After I made sure all voltages are correct, it was finally time for a first test run.

As I don't have many disks any more, I had ordered a GOEX drive as a replacement for the original floppy drive. It emulates a disk drive, but uses ADF files from a SD card. It even emulates the mechanical noises of the head stepper motor, which actually sounds much better than expected. I connected it to the floppy header of the mainboard, and used a cardboard box to make sure it won't cause short circuits.

Then I checked everything again. Is the mainboard okay? Is the HDMI converter properly connected? Is the GOEX drive connected? Is the Raspberry properly seated and the MicroSD inserted? Is nothing there that might cause a short circuit? Is the PSU protected against accidental touching the live terminators?

And then, after almost 30 years, it was finally time to wake up my Amiga 500 again.

My test setup, as the case is not here yet.My Amiga is still working! And a quick hardware test also shows no damage.

I first booted an Amiga Test Kit disk and checked the RAM and the CIAs. After that, I ran some demos. The picture quality of the HDMI converter is stunning!

Meanwhile I also got the case and keyboard back from the whitening service. I cannot wait to put it all back together, and enjoy my shiny new Amiga 500.

Capacitor List

The caps list of my Amiga 500 Rev 6A, and the replacement parts I used:

Qty Type Reference Manufacturer Number
2 3300µF 10V C401 C402 Panasonic EEU-FR1A332
1 470µF 16V C307 Panasonic EEU-EB1E471
6 100µF 16V C811 - C816 Panasonic EEU-FR1E101B
2 47µF 16V C821 C822 Panasonic EEU-FR1H470B
4 22µF 35V C303 C304 C324 C334 Panasonic EEU-FR1H220
2 10µF 35V C306 C712 Panasonic EEU-FR1H100B

Notes:

  • All capacitors are radial and have a lead spacing of 5mm.
  • C401, C402: Height should be 24mm or less to fit under the shielding.
  • C324, C334: Bipolar caps may enhance audio quality. I haven't tested that though.
  • You can use any fitting capacitors with the same capacity and the same (or higher) voltage.
  • Temperature rating should be 85°C or, even better, 105°C.
Amiga 500 Restauration, Part 1

My first Amiga was an Amiga 500. A classmate already had one, and when I visited him and saw the Amiga for the first time, I just had to have my own. So I pestered my parents until they gave in and bought one for me. With this computer I learned 68000 assembler, programming in general, and blind ten-finger typing.

A few years later, I bought an Amiga 4000 from the pay I got doing my civilian service. My good old Amiga 500 spent a few grace months in a closet, and was then stowed away in a box in the basement, forgotten for about three decades.

I would like to restore this machine, make it beautiful again, and give it a subtle technical overhaul. This project is a work in progress. I will report in my blog whenever there is something new. And in the end, I can hopefully share a feeling of success with you.

These are my goals for the restauration project:

  • The case has likely got a yellow tint over the years, like all white computer cases of that era. The yellowing has to go, the case should look as good as new again.
  • I will give it a technical overhaul. The electrolytic capacitors may have leaked and will be replaced. But after all the years, there may be even more technical problems that need to be fixed.
  • Since I have almost no floppy disks left, the floppy drive will be replaced by a drive simulator.
  • The old 1084 CRT monitor is long broken and disposed of (I hated these old flicker boxes anyway). I want to connect the Amiga to a modern TV instead, preferably via HDMI, so I will have a closer look at this Raspberry Pi Zero based converter that will be connected to the Denise socket.

After the restauration, the Amiga should feel (more or less) like it did when I got it in 1988. This means that there will be no accelerator card or harddisk controller. Apart from the HDMI output and the floppy simulator, the only acceptable "tuning" is the chip RAM extension to 1 MByte.

Okay, so let's get the computer out of the box and have a first look at it:

My Amiga 500 before restauration.

The case is not quite as yellowed as I had feared, nevertheless the ugly "nicotine yellow" has to go. On the right side of the case I had added four switches. At that time the Amiga was rather a commodity, and I didn't care much about it. Today I scolded my old self for drilling holes into that beautiful case. So there's one more item on my to-do list: fill the holes.

As for the case, I couldn't decide if I should have it dyed black, or have it bleached at the CBM Museum Wuppertal (CMW). I couldn't find a paint shop who would dye plastic though (they only offered varnishing), and the contact to the CMW turned out to be nice, so the case will now be bleached by the professionals there.

I have to admit: My fingers were itching to plug the Amiga into the wall socket and the TV right away. Fortunately I didn't do that. The circuit board of the power supply looks like it has been soaked in coke:

There is some dried liquid all over the PCB.

There are no traces of that liquid inside the case, so my guess is a leaked capacitor. Maybe it was this one:

There are also traces of liquid on this capacitor.

A homemade repair is totally out of the question if mains voltage is involved. Modern switching power supply modules are simply too cheap for that. So the next item on my to-do list is: get a new power supply.

Let's have a look inside the Amiga. The metal cage is a bit rusty here and there, but all in all still in good shape. The circuit board smells a bit of cellar mustiness, but everything is in its place and nothing seems to be damaged. It all certainly does look very good!

The mainboard looks good. The self-made PCB is for an NMI button and is connected to the IRQ lines of the CPU.

For recapping I inspected all the electrolytic capacitors and listed their values. After that I found out that someone else did that work already. I will replace all the capacitors with premium ones, which sounds more dramatic than it is for cent items. I chose Panasonic caps with a lifetime of up to 10,000 h. The old capacitors were standard types with maybe a tenth of that lifetime.

What's next? The case is now on its way to the CMW for whitening. I've also placed multiple orders for the new power supply, the capacitors, the HDMI adapter and the floppy drive simulator. So let's wait for the deliveries.

R Tape loading error, Part 2

In the first part I showed how the Sinclair ZX Spectrum stored data on tape. This second part explains what is stored, and what causes a tape loading error.

The ZX Spectrum BASIC offers a SAVE command for saving all kind of data. It can be used to save a BASIC program, variable arrays, but also arbitrary parts of memory. These files are always saved in two separate blocks. The first block is called header. It contains the file name, data type, and other meta information. The second block follows about a second later and contains the data itself.

The internal structure of each block is identical. The first byte distinguishes between header ($00) and data blocks ($FF). The final byte is a parity checksum. Everything between these two bytes is the payload.

A header block always contains a payload of 17 bytes. The first byte identifies the file type, followed by the file name (10 characters), followed by the length of the data block, and closed by two optional parameters that have different meanings depending on the file type. The length and the two parameters consume two bytes each, with the lower byte coming first because the Z80 CPU is little endian.

This is an example header block of a screenshot:

00$00 = Header
0003$03 = Binary file (Code or SCREEN$)
0153S
0268h
0372r
0465e
0564d
062E.
077Az
086Fo
096En
1065e
11001BLength: 6912 bytes ($1B00)
130040Parameter 1, here: starting address ($4000)
150000Parameter 2, here: unused
20Parity

A screenshot is actually just a memory dump that starts at address $4000 (which is the starting address of the screen buffer) and is exactly 6912 bytes long (the ZX Spectrum has a resolution of 256×192 monochrome pixels plus 32×24 bytes color attributes, giving a screen buffer size of 6912 bytes).

For other file types, the two optional parameters have different meanings. For example, a BASIC program file stores the line number to start at after loading.

The final byte is the parity. It is used for error detection, and computed just by XOR-ing all the bytes that have been read. The result must be $00, otherwise a "R Tape loading error" is reported.

This kind of error detection is rather weak. Due to the nature of the XOR operation, two wrongs give a right. This means that when the block contains an even number of bad bits at the same position, they will be undetected. It is also not possible to correct reading errors, as the XOR operation only allows to identify the position of the bad bit, but not the actual byte that contained the error. More sophisticated error correction algorithms would have slowed down the loading process, though.

The parity is computed as a final step, after all the bytes have been read from the block on tape. For that reason, the loader can only decide at the end of the recording whether the loading was successful or not.

But then, why does the tape loading error sometimes appear while the block is still loading? Well, in the first part I have explained that the loading routine just reads an unknown number of bytes. It ends when waiting for a pulse change took to long. Now, if there is an audio gap on tape, the signal seems to end just in the middle of the block. It is then very likely that the parity checksum is wrong because there are still bytes missing.

Some simple copy protections made use of the way the Spectrum loads data from tape. A very common way were “headerless” files, where the header block was left out and only the data block was recorded on tape. The BASIC LOAD command was unable to read those files because of the missing header.

R Tape loading error

In the early time of home computers, at the beginning of the 1980's, hard disks and even floppy disks were too expensive for home use. The cheapest way for storing large amounts of data was the cassette tape. Cassettes and tape recorders were affordable and available in almost any household.

In this blog article, I'm going to explain how the Sinclair ZX Spectrum stored programs on cassette tapes. Other home computers of that time, like the Commodore 64 or Amstrad CPC, worked in a similar fashion.

Cassette tapes were designed to store audio signals like voice or music, so the inventors of the home computers had to find a way to convert data to audio signals. The easiest way is to serialize the data to a bit stream of 1's and 0's, and generate a long rectangular wave cycle for "1" and a short rectangular wave cycle for "0". This is what the ZX Spectrum actually does!

A short wave cycle is generated by giving power to the audio output for 855 so called T-states, and then turning off the power for another 855 T-states. A "T-state" is the time of a single clock pulse of the Z80-A CPU. As the CPU of a classic ZX Spectrum is clocked with 3.5 MHz, a T-state has a duration of 286 ns. The duration of a short wave cycle is thus 489 µs, giving an audio frequency of about 2,045 Hz. The long wave cycle is just twice as long.

Due to all kind of filters in the analog audio path, the rectangular signal is smoothed to a sinusoidal signal when played back. A Schmitt trigger inside the ZX Spectrum's hardware converts the audio signal back to a rectangular shape. Since the audio signal can have different amplitudes or could even be inverted, the hardware only cares for signal edges, not for levels. All that the loader routine now has to do is to measure the duration of the pulses, regenerate the bit stream, and put the bytes back together.

If you think that things cannot be that easy, you are right. 😄 The most difficult part for the loader is to find the start of the bit stream. If it is off by only one cycle (or even just a pulse), all the bytes are shifted by one bit, and the result is useless. All kind of noise on the tape makes it impossible to just wait for the signal to start, though.

For this reason, the recording starts with a leader signal, followed by a sync wave cycle, followed by the bit stream itself. The leader signal is just a continuous wave with a pulse length of 2,168 T-states, giving an 806 Hz tone that is displayed by red and cyan border colors on the TV. The sync wave cycle is a pulse of 667 T-States "on", followed by 735 T-states "off". After that, the actual data stream begins, which is displayed in blue and yellow border colors. When the last bit was transmitted, the data stream just ends.

So when the ZX Spectrum loads a file from tape, it first waits for the 806 Hz leader signal. If it was detected for at least 317 ms, it waits for the sync pulses, then it starts reading the bit sequence until there is a timeout while waiting for the next pulse.

It is a very simple way to store data on tape. And still, it is surprisingly reliable. After 30 years, I could recover almost all files from my old cassette tapes. Some of them were of the cheapest brands I could get my hands on back in 1987.

The only disadvantage is that this method is very slow. With 489 µs for a "0" and 978 µs for a "1", saving just 48 KBytes of data can take up to 6 minutes, giving an average bit rate of 1,363 bps (yes, bits per second). If we were to save a single 3 MBytes mp3 file that way, it would take almost 5 hours (and 5 cassettes with 60 minutes recording time each).

Some commercial games used speed loaders and copy protections. Speed loaders just reduced the number of T-states for the pulses, which increased the bit rate. Some copy protections used a "clicking" leader tone, where the leader signal was interrupted before the minimal detection time of 317 ms was reached. The original loader routine could not synchronize to these kind of signals, so it was impossible to read those files into copy programs. Those protection measures could still be circumvented by copying directly from tape to tape, but this only worked a few times due to increasing audio noise.

In the next article, I will take a deeper look at the bit stream contents, and I will also explain where the dreaded "R Tape loading error" comes from.