Amiga 500 Mainboard

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.

Multiplication on a Z80 processor

The one thing computers are really good at is calculating. You might now expect that all CPUs are capable of the four basic arithmetic operations, but that isn't the case. The first 8 bit processors were only able to add and subtract numbers, and even the subtraction was performed by adding the negated subtrahend. Multiplication and division instructions first appeared on 16 bit processors, albeit they were still very slow in the first generation.

Simple multiplications and divisions with powers of two can be achieved by shifting a value bitwise to the left or right, respectively. This is, shifting a value by one bit to the left is the same as multiplying it by 2, while shifting by two bits to the left multiplies it by 4, and so on.

But how can we multiply any two numbers? It has to be done step by step, by using basic operations like addition or bit rotation. This article will explain how it works on a Z80 CPU.

Back at school, we have learned to multiply large numbers by long multiplication. Basically, we break up the problem by multiplying the multiplier with each digit of the multiplicand, and then summing the products. For example, if we want to compute the product of 27 and 12, we compute 27×2 = 54 and 27×1 = 27, and then sum the products 57+270 = 324.

  27 × 12
———————————
       54
 +    27∙
———————————
      324

We can use the same algorithm on a computer. But wait, wouldn't we still have to multiply, even if with smaller numbers? Actually, no! Since computers use binary digits, we only need to multiply either by 1, giving the value itself, or by 0, always giving 0.

This is the the same long multiplication of 27 (11011) and 12 (1100) with binary numbers:

  11011 × 1100
————————————————
         00000
        00000∙
       11011∙∙
 +    11011∙∙∙
————————————————
     101000100

The steps can be executed in a loop. At the beginning, a result register is initialized with zero. If the rightmost bit of the multiplicand is 1, the multiplier is added to the result register. After that, the multiplicand is rotated to the right by one bit, and the multiplier is rotated to the left by one bit. This loop is repeated until the multiplicand is zero, because the result won't change after that anymore.

The following Z80 assembler code example multiplies the values in the BC and DE register pairs, and returns the product in the HL register pair. If an overflow occured during multiplication, the Carry flag will be set.

The multiplicant is kept in the BC register pair. To rotate it one bit to the right, we first use the srl b instruction. It rotates the B register, moving the value of bit 0 to the Carry flag, and inserting a 0 to bit 7, so the multiplicant is filled up with zeros with each rotation. After that, rr c rotates the C register and moves the content of the Carry flag to bit 7. Both instructions combined rotate the BC register pair one bit to the right, insert a 0 to the highest bit. The lowest bit is moved to the Carry flag, where it can be tested.

image/svg+xml0010010110011010Carry0BCCarrysrl brr c7654321076543210

We essentially do the same with the multiplier in the DE register pair, but in the opposite direction. As a rotation to the left by one bit essentially just doubles the value, we also could have used add de, de. Sadly the Z80 does not offer such an instruction.

multiply:	ld	hl, 0		; clear the result register
.loop:		ld	a, b		; is BC == 0?
		or	c		;   (also resets carry flag)
		ret     z		; then we're done!
		srl	b		; logical right shift of BC
		rr	c		; bit 0 goes to carry flag
		jr	nc, .zerobit	; unless bit 0 was 0
		add	hl, de		; add multiplier to result
		ret	c		;   return on overflow
.zerobit:	sla	e		; shift multiplier to the left
		rl	d		;   topmost bit goes to carry flag
		ret	c		;   return on overflow
		jr	.loop		; next iteration

The example only multiplies positive integers. To multiply negative integers, we first need to change all factors to positive numbers and do the multiplication. The result then needs to be negated if one of the factors was negative, but not both.

Reading Amiga Harddisks with Linux

While cleaning up the cellar, I found my Amiga 500 and also a GVP Impact Series II SCSI host adapter. Inside, there was a Fujitsu M2611SA harddisk. After about 25 years, I had totally forgotten about it, and I wondered what was stored on it. So let me take you on the adventure trip of how to salvage old Amiga harddisks on modern Linux machines.

The Amiga ecosystem has always been very SCSI friendly. Commodore broke this tradition only with the final AGA models, where they switched to the IDE bus to reduce costs. The Amiga community never approved this change, and many accelerator cards that were sold for these machines also came with a SCSI host adapter. The SCSI bus was a lot faster than the IDE bus. Also a single ribbon cable could connect up to seven SCSI devices, where the IDE bus only permitted two devices.

Today this SCSI affinity turns out to be a problem though. SCSI was never a topic on consumer PCs, so there are no SCSI-to-USB adapters on the market (I wish they were), and SCSI cards for the PCIe bus are very expensive. I'm still having an Adaptec SCSI card in my cupboard that I bought many years ago, but it is for the old-style PCI bus. Luckily there are PCI-to-PCIe adapters available on the market, so I could reuse this old card in my computer. The card stack looks adventurous, but it will do for a few hours of operation to backup the data.

The big question is: Can a modern Linux machine even read Amiga formatted harddisks?

Mounting Amiga Harddisks

Yes, it can. It seems that there are a lot of Amiga fans among the Linux kernel developers. The Amiga uses a different partition table scheme than PCs, but if you're lucky, your Linux will still detect the Amiga partitions and offer them as e.g. /dev/sdg1. Then all you need to do is to mount the partition via mount.

It didn't work on Fedora though, so I had to do some more typing. First I had to find out the offsets of the individual partitions. GNU Parted can be used for that, as it is able to decode Amiga partition tables:

# parted /dev/sdg
GNU Parted 3.3
Using /dev/sdg
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) u
Unit?  [compact]? b
(parted) p
Model: FUJITSU M2611S (scsi)
Disk /dev/sdg: 45078528B
Sector size (logical/physical): 512B/512B
Partition Table: amiga
Disk Flags:

Number  Start   End        Size       File system  Name  Flags
 1      52224B  45078015B  45025792B  affs1        DH0   boot

(parted) q

So there is only one partition on the HD. It starts at offset 52224 and is Amiga FFS formatted. Luckily most Linux distributions are able to mount this file system out of the box. The start offset is needed to mount the partition. I also mount it read-only to make sure that I won't accidentally change or delete my precious old data.

mount -o ro,offset=52224 -t affs /dev/sdg /mnt/

Et voilà:

# ll /mnt/
drwx------. 1 root root    0 Apr 16  1997 C
drwx------. 1 root root    0 Jun 11  1994 Devs
-rw-------. 1 root root 1233 Apr 16  1997 Devs.info
drwx------. 1 root root    0 Apr 16  1997 Fonts
drwx------. 1 root root    0 Apr 16  1997 L
drwx------. 1 root root    0 Apr 16  1997 Libs
drwx------. 1 root root    0 Feb 27  1992 Locale
drwx------. 1 root root    0 Apr 16  1997 Prefs
-rw-------. 1 root root 1238 Apr 16  1997 Prefs.info
drwx------. 1 root root    0 Apr 16  1997 S
drwx------. 1 root root    0 Apr 16  1997 Storage
-rw-------. 1 root root 1233 Apr 16  1997 Storage.info
drwx------. 1 root root    0 Jan  4  1992 System
-rw-------. 1 root root 1233 Apr 16  1997 System.info
drwx------. 1 root root    0 Feb 27  1992 Tools
-rw-------. 1 root root 1233 Apr 16  1997 Tools.info
drwx------. 1 root root    0 Jan  4  1992 Trashcan
-rw-------. 1 root root 1588 Apr 16  1997 Trashcan.info
drwx------. 1 root root    0 Feb  3  1992 Utilities
-rw-------. 1 root root 1233 Apr 16  1997 Utilities.info
drwx------. 1 root root    0 Apr 16  1997 WBStartup
-rw-------. 1 root root 1233 Apr 16  1997 WBStartup.info

Disk Dumps

As old harddisks are quite noisy, it might be a good idea to dump the entire content first, and salvage the partitions later. dd is the classic tool for creating a dump:

dd if=/dev/sdg of=amiga-hd.dd bs=512 status=progress

Later a loop device will simulate a real harddisk device:

losetup /dev/loop1 amiga-hd.dd

/dev/loop1 can now be used for parted and for mount.

To remove the loop device again:

losetup -d /dev/loop1

Smart File System

Back in the Amiga days, the Smart File System was very popular as an alternative to the original Fast File System. It was freeware, it was a lot faster than FFS, and it even had a stateless defragmentation that ran in the background.

The Linux kernel does not support SFS out of the box. However, Marek Szyprowski implemented a kernel module in 2003, which (sadly) never left the experimental stage and thus never found its way into the official set of supported Linux file systems.

To use it, you first need to set up a Linux with a 2.6.27 kernel, for example Fedora 10. After that, download the kernel patch and compile it to a kernel module. If you managed that, you can also mount Amiga SFS partitions. I was able to recover all files from an SFS partition that way, though it wasn't much fun.

PS: Sadly the harddisk I've found didn't contain forgotten source codes or other secrets. It just had a standard Amiga Workbench on it, and a copy of the game Scorched Tanks.

Read this article...
#Advertisement? This blog is free of ads. All shown products have been paid by myself.
Saturday, January 16, 2021
Glühwein aus der Mikrowelle

Dieses Jahr sind die Weihnachtsmärkte mit ihren Glühweinbuden ziemlich rar. Was gibt es dann schöneres, als sich zu Hause selbst eine heiße Tasse Glühwein oder Fruchtpunsch zuzubereiten. Aber geht das auch in der Mikrowelle?

Klar geht das, und sehr gut sogar, wenn man ein paar grundsätzliche Dinge beachtet.

Wichtig ist, dass der Glühwein nicht kochen darf. Die perfekte Temperatur für Glühwein ist um die 72°C. Ab 78°C verkocht der Alkohol, ein wichtiger Aromaträger. Erhitzt man ihn weiter, verändert sich zudem das Fruchtaroma. Überhitzter Glühwein schmeckt fade und bitter.

Es kommt also darauf an, die richtige Zeit an der Mikrowelle einzustellen. Aber auch die richtige Leistung ist wichtig. Mikrowellen dringen in Flüssigkeiten nur wenige Zentimeter tief ein, der Rest wird indirekt durch Konvektion erwärmt. Wählt man einfach die höchste Leistung, verkocht der Glühwein am Tassenrand, während er in der Tassenmitte noch relativ kalt ist. Bei kleineren Leistungsstufen kann sich die Hitze im Getränk gleichmäßiger verteilen.

Machen wir uns also auf die Suche nach dem passenden Rezept für unsere Mikrowelle.

Wichtig ist, möglichst gleiche Startbedingungen zu haben. Der Glühwein sollte vor der Zubereitung also immer dieselbe Raum- oder Kühlschranktemperatur haben, und man nimmt am besten auch immer die gleichen (und natürlich mikrowellengeeigneten) Tassen.

Das Rezept für meine Mikrowelle: 2 Glastassen zimmerwarmen Glühwein à 0,2 Liter, 440 Watt, 4:30 Minuten.

Mit diesem Rezept als Ausgangsbasis kannst du nun die richtige Leistung und Zeit für deine Mikrowelle finden. Du bereitest den Glühwein zu, entnimmst ihn aus der Mikrowelle und prüfst mit einem Tee- oder Kochthermometer die Temperatur. Ist der Glühwein zu kalt, verlängerst du die Zubereitungszeit beim nächsten Mal um ein paar Sekunden. Wurde er zu heiß, reduzierst du die Zeit. Schmeckt der Glühwein verkocht, reduzierst du die Leistung oder die Zeit etwas. (Das Thermometer bitte nicht mit in die Mikrowelle stellen!)

Wenn du nur ein Glas zubereitest, halbiert sich die Zeit in etwa. Bei vier Gläsern verdoppelt sie sich. Das ist aber nur eine Faustregel. Es lohnt sich, auch für andere Mengen durch Versuche die optimale Zeiteinstellung zu finden.

Hast du dein Rezept gefunden, bereitet dir deine Mikrowelle quasi von selbst den perfekten Glühwein zu. Du musst nicht wie beim Herd ständig rühren und die Temperatur überwachen, sondern wartest einfach nur auf den Signalton.

Wichtig: Keinesfalls Flaschen, Dosen, Getränkekartons oder verschlossene Behälter auf diese Art erhitzen, sondern immer nur einzelne Tassenportionen. Und wenn der Glühwein versehentlich doch gekocht hat, lasse ihn mindestens eine Minute in der Mikrowelle stehen, bevor du ihn entnimmst.