Archive for September 18, 2014

Object Pascal, power computing at extreme budgets

September 18, 2014 5 comments

Being a programmer in 2014 –having been a coder through the 90’s and 2k’s until present day – is like living in disney land. When I was a teenager my most priced possession was my Amiga computer. It cost a fortune and was powered by a whopping 1Mhz MC68000 CPU (yet due to it’s custom chipset, it outperformed PC’s up until GPU powered 3d cards became standard around 1995). The Amiga was the bomb back then. And it’s memory capacity was jaw dropping 2 megabyte on-board chip-ram. I extended it with 8 megabyte additional ram, which set me back around $400, which for a poor student was a small fortune.

What can you get for $400 today? Well today you can pick up a second-hand Apple Mac G5 Dual-Core PPC for less than $200, complete with a decent monitor. And if you know how to use bit-torrent, you can pimp that machine so full of software that it has more value than a new $1995 iMac. Photoshop, pro-tools and gcc / x-code was awesome in the PPC as well, not just the Intel Mac’s.

Object Pascal on older hardware

Lately I find myself thinking that it has to be possible to re-cycle some of these old machines and apply them to new and modern purposes. I mean, a G5 PPC mac is a processing beast compared to it’s contemporary PCs 8 or 10 years ago. The G5 dual core processor was the final evolution of the PPC range of processors – so it’s a fine and powerful piece of engineering for a ridicules price. Making use of these machines with object pascal sounds both fun and interesting.

With this in mind I did a quick search on, which has a second-hand market; comparable to craigslist, ebay and sites of that genre. And the average price for perfectly usable, good condition second hand Apple G4 and G5 Macs were in the 500-100 NKR price range. Which is roughly between $100-$200! That is a lot of CPU power ladies and gentlemen, in fact, it’s almost sad to see these machines which look more like works of fine art than computers being practically thrown out the door for the price of a playstation game.

MorphOS looks like a blend of Amiga / Linux meets Windows

MorphOS looks like a blend of Amiga / Linux meets Windows

So what? I hear you say. No modern software will run on these machines – so they are useless. It’s just a heap of unusable iron taking up space.

Well, not quite. Linux happily runs on PPC hardware – some users argue that Linux runs better on these machines than Mac OS classic and OSX did to begin with. But if you are adventurous and able to mentally disregard the OS factor (for now) and would like to use Object Pascal for specific work related tasks, then you can include an alternative operative system called MorphOS.

Pimp up old hardware with a small, compact and lightning fast OS

Pimp up old hardware with a small, compact and lightning fast OS

Now before we continue, let’s look at a couple of tasks where old hardware can be recycled and which supports object pascal (freepascal and/or lazarus in a desktop environment). And lest we forget, there is a fork of lazarus called Code Typhoon which is rarely talked about yet enjoy a steady following around the world due to it’s stability and rich component base. And it’s free (!). But first, let’s look at some tasks suitable for re-cycled hardware:

Web server

The most common task for older hardware is, naturally, to be used as a vanilla web-server. Apache (the webserver for linux and other alternative operating systems) is for the most part hardware agnostic –and as long as the latest berkley tcp/ip stack is installed, compiling Apache from source is easy and hassle free (3 lines from the command prompt under linux/unix).

If you add NodeJS to the mix then you have yourself a paradise for Smart Mobile Studio development, since Smart Pascal allows you to write both client and server from the same codebase, running the server code under nodeJS and client in any HTML5 compliant browser. So building your own client/server environment for testing purposes at home for less than $200 is more than possible.

Note: nodeJS may not run on older versions of OS X, but it will almost certainly run if you install linux.

Backup server

Another form of server which is a must these days both at the office and in your home, is a dedicated backup server. A lot of people fork out $400-$600 for a network disk or NAS server (both for backup and movie streaming), but that’s actually a complete waste of money; Because you can as I mentioned, pick up a second-hand PPC mac for 1/6 of the price which is 50 times faster and with plenty of room for IDE disks (not to mention remote desktop options so you can control it from your work PC or Mac). OS X also have functions setting up a machine as a backup device for other computers – and a fileshare on the network for movies and music is a matter of flicking a switch.


If you work as a teacher, pupils dont really need access to the very best. In fact, learning to program in Lazarus on a second hand PC or Mac (the latter recommended) running linux or OSX is a fantastic way to broaden the pupils horizons. Delphi has become extremely large and heavy in terms of technology. Beginners without proper documentation can quite frankly get lost in Delphi XE 1 through 7. So starting with Lazarus and freepascal, which is a delight to use on Fedora Linux, is an excellent start!

A good object pascal programmer could make a network program for tests and exams, which makes sense for schools on a budget. You dont have to fork out thousands of dollars or pounds for a uniform computing environment + software.

Store front-end

If you work in technical retail your store-front is bound to run presentations, video and/or demonstration slideshows. It can cost as much as $2000 to buy a professional multimedia studio, adapter packages and cables, not to mention database integration for daily updates of prices and offers. With the help of Freepascal and a dedicated machine, an old iMac G5 is more than powerful enough to handle a full shop front-end, multiple monitors (chained even if you like) and/or database presentations. Graphics32 (which has been ported to Lazarus/FPC) makes effect programming extremely easy – and you can throw in openGL if that tickles your fancy.

Paint mixing and customer kiosk systems

Paint is one of those items which everyone uses, but we rarely think about it until we need it. Most stores that ship and sell paint have digital mixing programs where the customer can select and adjust (create) their own blend of paint. It’s actually a very easy application, at least those that i’ve seen, which I would complete in roughly 2 days work. The only time-consuming task for such a project, is coding the serial-cable protocol for transferring the RGB color values to the mixer. Again — old hardware is up for the task. A PPC G4/G5 is ample power for running a fullscreen, mouse driven, object pascal application — and Freepascal is very well evolved so you will find everything you need in the RTL.

Media Server / Center

A $30 Raspberry PI mini computer is more than enough to power the latest Linux media station (or server) software. Since Linux is extremely popular you will also find the latest versions of Freepascal and Lazarus in most distro’s (including Raspberry PI’s repo). If you don’t want to fork out for an Apple-TV or Google TV stick, then you can easily build one yourself with a raspberry pi.

Build server (SVN)

While perhaps a bit overkill for the lone hobby programmer, it can be a valuable exercise for professional and amateurs alike. I personally have my personal SVN server running and use that in combination with a backup server to keep my 15+ years of code safe and up to date. Using an old G5 or G4 to maintain your company source-code (if you represent a team of 2-10 programmers) is not just good practice – it’s a required minimum.

And if you are thinking, how can I do nightly builds on a PPC machine? Well, if you use freepascal then that wont be a problem (multi target compiler). But if you use Delphi you may want to run Windows under Bochs (a bare-bone windows XP is enough if all you want to do is compile):

Selecting hardware

If you can get your hands on a second-hand Apple iMac G5 workstation (PPC processor), which in Norway at least can be picked up for around 1000 NKR (US $200) that is an absolutely fantastic machine. It is also “modern” enough to run a good selection of alternative operative systems (alternative to Windows and OS X) as well as OS X up to version 4.5 if memory serves me right. This is a perfect machine to recycle for new tasks.

Pick up a Power Mac G5 for next to nothing

Pick up a Power Mac G5 for next to nothing

Apple G4 machines, which I find esthetically pleasing and fancy (and easy to fix, replace parts and code on) is also a good find. But you should make sure you check the hardware against the MorphOS hardware compatibility list — which is also a good list for Linux (to check if your old machine can be used with modern Linux distros).

Older PC’s is likewise perfect for recycling, but once again you should check for driver support (which is always the problem with PC/Win machines, as opposed to Mac’s which have a fixed chipset). I would not buy a PC older than 7 years, and would probably pay very little for such a machine ($40/50). If you buy or re-cycle an older PC, make sure you have at least 4 gig of ram (the max for WinXP unmodified) if you plan to run Windows, same goes for Linux.

Lazarus + FPC is best enjoyed under Linux, here running in Fedora

Lazarus + FPC is best enjoyed under Linux, here running in Fedora

At the very lowest end of the spectrum, but surprisingly the most fun to play with – are embedded micro computers such as the Raspberry PI. Starting at $30 it comes with a quite powerful GPU, making it ideal for homebrew media center projects. It supports Linux and as such it has full access to Object Pascal/ freepascal. But, due to the very small processor, Lazarus is a bit to slow for serious work — but FPC/Lazarus executables run very fast and is in my view the best language to use; side by side with C++. If you combine FPC with SDL (simple direct media layer) you have a pretty modern multimedia engine to play with, regardless of CPU and architecture.

Lazarus + FPC running on Raspberry PI micro computer

Lazarus + FPC running on Raspberry PI micro computer

What about the web

The downside of working with older hardware is that you can only use them for development. The moment you want to ship a product written in platform independent object pascal you have to get your hands on a machine from the modern marketplace. But there is one combination where you can avoid all that – and that if if your target media is HTML5 exclusively.

While Delphi XE 1 through 7 is far to processor and memory hungry for an older PC, Smart Mobile Studio is absolutely perfect. It comes with a small and compact RTL for making cutting edge HTML5 mobile apps. It has a chrome browser built-in (embedded) and is more or less everything you need to write JavaScript based applications designed for either web-pages (embedded like a flash app would) or a fullscreen mobile app. You write object pascal, the compiler generates hardcore JavaScript from that.

And JavaScript is extremely fast, in many cases (especially when it comes to graphics) faster than native Delphi (which sounds ridicules I know, but check the benchmarks and see for yourself). JavaScript also has the benefit of running pretty much anywhere in a modern browser.

Get away from platform bound code with Smart Mobile Studio

Get away from platform bound code with Smart Mobile Studio

So one very cheap alternative is a 5+ year old PC with Windows XP setup just for Smart Mobile Studio development. I actually have several such machines setup, both real hardware and virtual machines (VMWare).

Final verdict

Is it possible to build your own fantastic object-pascal super computers on an extreme budget? 10 years ago the answer would have been a loud “No!”, but today the reality is that you can buy extreme amounts of processing power second-hand for next to nothing. And you can make use of FreePascal and Lazarus to build custom systems – systems which can be re-compiled on more modern hardware when needed. This makes for some very interesting cross-platform solutions.

I should also mention that a lot of virtual machines, like Bochs (free) run perfectly fine under PPC hardware, meaning that you can in fact setup a test-environment for your Delphi and/or freepascal projects on an older Mac – and just remote desktop your way into the test environment whenever you want.

And one scenario I forgot: Your own SVN server is also a good use of old hardware.

Well, I hope you have found some inspiration to re-cycle technology and put your object pascal knowledge to new and exciting uses. Who knows, perhaps you come up with a good idea and can ship out 100 used macs preloaded with your software?

Nothing is impossible 🙂