Back to the future: The Impossible Amiga
The word "impossible" is something I hear quite often. It was impossible to create a compiler that would emit JavaScript rather than machine code, then it was impossible to use that technology to leverage languages like Delphi, making object pascal available for internet applications.
When our team delivered that, a proverbial basket of "impossibles" was waiting in line. It was impossible to have a object oriented (not prototype based, but true oop) run-time library for visual controls, it was impossible to render graphics faster or equal to a native application, it was impossible to have high-level constructs like classes, streams and databases using a vmt inheritance model -- well long story short: we bested them all and took object pascal to new heights with Smart Mobile Studio.
Back to the future
The other day I had a somewhat heated debate with a person who clearly had no idea what object pascal is capable of. Even on legacy systems like the Commodore Amiga. Commodore, the now defunked american technology company, made some truly amazing products; products that run like a clock 30 years after inception.
The individual that I had a heated but civil conversation with was younger than me, so he obviously did not grow up with Commodore products; nor did he learn to code on these machines. Well, I did. In fact it's thanks to Commodore that I am a software developer today. I also like to think that the environment of the Amiga, made myself and my generation better developers. Most of what I learned on the Amiga is universal code if you like, techniques that are just as valid today as they were 20 years ago.
It can be fundamental stuff like cpu registers, how instructions are counted in clock cycles, how the stack works, mmu (memory management unit) coding -- all the hardcore stuff you need to know to write good assembly code.
Well, the guy I was talking with managed to propose that running modern software on an Amiga was impossible. Especially object pascal (!). When I question him why - he listed the most common missunderstandings about this fantastic platform: lack of memory, lack of colors (he underlined 32 colors as maximum), lack of threading and lack of network access. He finished with "It's impossible OK? I know what im talking about. It doesnt even have a browser!".
Oh boy; faced with arrogance on that level you just have to teach him a lesson. It's not often I meet people who manage to get so many fundamental aspects of a computer and language wrong, but this guy sure did. It became painfully visible that he knew nothing about the Amiga, never owned an Amiga and had never written a line of code for this fantastic machine. And clearly Delphi and freepascal was out of his league.
Listen up kid
The Amiga had two aspects to its architecture: a custom chipset which was designed for games and multimedia, and secondly an OS that was designed to be extremely efficient. We have to remember that back in the early 80s and 90s RAM was costly. So costly that the original A1000 model shipped with a humble 256kb ram. You had to get an expansion board to give it a full 512kb. The second entry model, the A500 that most people remember, shipped with 512kb by default - but most upgraded it to 1mb.
The Amiga was great for games of it's time and some amazing titles were written for it. But games rarely used the OS and instead hit the hardware directly. The other side of Amiga was the OS, a dead serious development platform decades ahead of it's time. This last part, the extremely well written operating-system, is what interested me (and still does). Its said that the Amiga chipset was 10 years ahead back then, but the OS was 20 years ahead. It was only recently that Apple OSX added functionality that the Amiga had back in the mid 80s (REXX support and Layers library).
The 32 colors thing is absurd. The Amiga had several screen modes that used the native chipset. This was a chipset designed for 2d gaming so obviously there was a limit to how much it could do. Taking the extreme memory-conditions into the equation and yes, a standard Amiga did not support 32-bit graphics. It had 2, 4, 8, 16 and 32 color modes which were suitable for gaming on a television. It also supported HAM mode that gave you 4096 colors on screen. Which for the 1980s was leaps and bounds ahead of the curve. But again, this was just the chipset side of things.
But if you owned a big-box Amiga, which most serious developers did, you had little use for the built-in chipset. Its a bit like PCs today: you buy a dedicated graphics card and just use the built-in graphics adapter as a fallback should something go wrong. The big-box Amiga machines had full support for RTG (re-targetable graphics) which is what people are used to for PC's and Mac's. This simply means that the graphics cards takes care of the display, and you get screenmodes more akin to normal standards. I remember 1280 x 1024 in 16-bit was my favorite. I would scale down to 1024 x 800 x 24-bit when doing pixel art. You have to remember that back then Microsoft Windows used 16 colors and you had to exit to DOS to fire up a game! Most games ran on 1024 x 800 x 15/16 bit on the PC. So the big-box Amiga machines just anihilated the PC when it came to graphics and sound.
When it comes to the internet: not true! The Amiga was one of the first machines to get Internett connectivity. And before that everyone used modems to call up BBS's. Nasa used Amigas for both graphical analysis, networking and more. In fact - most of the satellites that went up in the 80s and 90s had Amigas inside them (!). These machines were sturdy and reliable (old school American quality) and could take more radiation before they gave up the ghost. So satellites like Voyager is powered by Amiga, not a PC or Mac. Food for thought!
Make it so number one
To demonstrate just how brilliant the OS architecture is, I am simply going to show you. What I did was take a Raspberry PI 3b and installed a package called Amibian. This is a package that contains a minimal Linux distro, just enough to boot up and get bash / aperture going. When you boot the device Amibian runs the standard Linux boot sequence, and at the end of that it starts UAE4Arm; which is the Amiga emulator.
Inside the emulator I installed Workbench 3.9, which gives us a normal window based desktop. I will then installed a modern compiler, in this case Freepascal 3.1.1 which is just one revision behind the current trunk. So much for "outdated software".
With modern coding tools installed, it's time to pimp the desktop a bit. We have to remember that the desktop was written to handle anything from 2 colors to 16 million colors. By default it runs in 16-color mode. By installing Picasso, which is a set of drivers for graphics boards, we get access to all the high-color modes the hardware can deliver. In this case the modes the Raspberry PI has to offer, uae4arm registers the GPU as a graphics card on the amiga, so you get raw access. This is no different than using a real Amiga.
I decided to go for 32-bit icons, just to demonstrate that this is indeed possible (it was one of the points that was underlined as "impossible" after all). Im not too fond of hacks and patches, so I have left those out. This is now a vanilla Amiga 4000, Workbench 3.9, 128 mb conventional ram, 16 mb graphics ram; with mmu and fpu on-board.
Not too shabby! I have seen Linux distros with far worse desktops. So here we have demolished the myth that the Amiga only had 32 colors. We are here using 1280 x 960 x 32-bit graphics. The Icons are also 32-bit with alpha masking (icons.library v46.4). Let's see if we can get a browser going.
Not bad! Obviously it's not HTML5 capable, but not because the operating system cant handle it. Its because the browser havent been updated in close to 2 decades. A more modern browser exists called OWB that is webkit based, but I didnt want to waste too much time on this so AWeb will have to do. Right, that was the second "impossible" blown out of the water.
OK, now lets compile something modern and see if it runs! For this I have copied over the latest http framework from the freepascal distribution. This also contains mechanisms for REST and websocket. let's compile it and see what happens!
The server is running in the console on the left, its set to just serve files from whatever directory it's started in. So in this case I used the browser to display the source code for our little server.
What is the point?
This post was not about bragging or showcasing some old computer. The point was that many developers regard everything older than 5-10 years as obsolete. They fail to see the amount of knowledge a system like this represents. Commodore evolved and sold the Amiga machines for close to 15 years, and the level of creativity it generated is unpresidented in computing history. It was not the machine that failed but rather mismanagement, greed and the utter incompetence of the administration. The brand itself kept on going all the way to this day.
Can you imagine just how much awesome code you can find in an archive spanning 20+ years? Im into modern computers and cloud services these days, but I never forget my roots. And I keep going back for inspiration. And more often than not I find code written for the Amiga that solves problems today. It is an amazing machine, and the community around it is equally amazing.
Just because something is old doesnt mean its bad. The C programming language is 3 years older than Pascal, does that mean that C/C++ is obsolete? How about Unix? OSX is after all unix beneath the polished, graphical exterior.
If I was to give some advice to new programmers it would be this: go back and learn from the truly great developers of the 80s. Study their code and learn from it. It will make you a better developer and teach you things left out of modern day curriculums.
Head over to The Internet Archive and browse around, you will find that 20 years of excellence is a massive undertaking. The Tosec collection of software is 40 gigabytes in size. That is a lot of code, programs, demos and knowledge to digest.
And Aminet, the biggest software archive in the world, is still running strong. No other platform has a living community 30 years down the line.
The language Amiga E is probably the best suited language for cloud development. It was written from scratch to work with networking, ipc and to delegate tasks between entities. But people dont know this because they are so blindly focused on whatever garbage apple or ms spits out. Had i had the time I would port E over and make a million bucks