Archive

Posts Tagged ‘Raspberry PI’

Smart competition extended to may 1st!

April 6, 2015 Leave a comment
Smart Pascal Compo

Smart Pascal Compo

Time has run out for the Smart Mobile Studio component competition. but I guess I picked a bad time for this, with easter and school holidays getting in the way of things.

As I wrote regarding rules we need a minimal number of entries to call it a competition. At the moment we have only 3 entries – although I have received a fair bit of email regarding details, the rules etc. (which I thought I outlined with great precision *smile*).

And let’s face it — it’s a super easy competition. Yesterday I wrote a fully fledged component for Smart Mobile Studio. A complete implementation of the Windows 8.1 mobile category header. You can check that out here. The point being that writing components for Smart Mobile Studio is much easier than Delphi or Lazarus. It’s really fun!

As a bonus the official list of components that ship with Smart is spartan and young, so chances are you will be able to find a control which is not there quite easily.

One more time

I feel it would be premature to simply cancel at this point. So I will extend the deadline to span april – which means the final draw is now on the 1st of may!

If there is still not enough entries, then I guess I’ll cancel the competition all together. And naturally according to rules, no submitted code will be used (unless you want to) in teaching.

The Raspberry PI 2 model b price (!)

Surely a Raspberry PI 2 model B must be worth a couple of hours coding? Especially now with Windows 10 just around the corner ! I personally own 4 of these little gems. One is dedicated for retro gaming, another is used as a backup server, a third is used as a dedicated nodeJS server (which I use with Smart Mobile Studio) and the last one is an all-round coding testbed. Only the nodeJS and gaming RPI’s are version 2 model B, the two others are version 1 and 1 B respectively.

Windows 10 is just around the corner

Windows 10 is just around the corner

It’s a really great little computer. It runs on 5V so it’s extremely reasonable (you can leave it on 24/7 without being afraid of high electricity bills). And it’s particularly suited for single-server tasks. Perfect for nodeJS or Remobjects SDK servers (compiled with Lazarus and FPC for ARM CPU).

Writing nodeJS servers with Smart Mobile Studio is so much fun, and I promise you that it’s going to be a real game changer once you get into it. You use the Raspberry PI to model a full server architecture at home, and when it’s done — you just deploy it vertically onto the cloud. And then you can scale it horizontally (clone instances) as your business grows.

Motivation

The primary motivation for this competition is to support object pascal in our education system; Such as the Pascal programming for Schools Project in the UK. Object Pascal in all it’s forms is an excellent language for beginners and advanced alike. It has the depth of C/C++ but with a friendly and intuitive syntax suitable for all levels. It’s a perfect language and excellent for kids and teenagers to acquaint themselves with what programming is all about.

You might not know it but classical pascal was actually engineered for schools. The language itself was created to be easy to teach and easy to learn – and at the same time replace C/C++ with all it’s quirks and idiosyncrasies.

But students need help from us adults with examples, study material and quality code. Hence the emphasis that source-code be documented as much as possible. Be clear and easy to read – and so on.

If you havent seen the Pascal programming from schools project, then you should check it out! They have their own category dedicated to Smart Pascal with some really great stuff!

I’m still blown away by the arrow-shooting game written by an 11-year-old – which uses angle calculations and momentum to fire arrows at a target. Or this little particle engine which is fun and easy to learn 🙂

Getting into the competition

If you own Smart Mobile Studio, or just want to try it out — then join the competition! If you don’t have Smart Mobile Studio and want to join, then you can go to http://www.smartmobilestudio.com, download the trial and request a trial serial number.

The last bit is important because a lot of people download the trial and think it’s bugged — you need a valid serial number when you start SMS for the first time, or you wont be able to fire it up.

Then what? Easy – send me an email with your entry. Use the email lennart DOT aasenden AT gmail DOT com

 

 

The Smart Mobile Studio Competition!

March 17, 2015 Leave a comment

I want to remind every one about the Smart Mobile Studio competition I launched earlier.

It’s still early (I have received two really good entries already), so if you own Smart Mobile Studio – or even if you don’t (heck you can download the trial version and have a go) and fancy winning the latest Raspberry PI 2 (model B, the new one that runs Windows 10) then this is your chance!

Probably the coolest mini-pc in the world

Probably the coolest mini-pc in the world

You can find the details regarding the compo here. The rules are straight forward and easy, and remember: this is not a graphical demonstration competition. This competition is about making the best component! And writing components is very entertaining, especially for a programming environment as young as Smart Mobile Studio. It lacks many of the controls which we take for granted under Lazarus or Delphi (hint).

It’s ready to be sent to your place

We are practically giving this Raspberry PI away; It’s just lying there in its box ready to be shipped to wherever you live; dying to be turned into something fun and useful. And even if you don’t need it, your kids will love playing every nintendo, amiga, sega and arcade game ever created (just install PIMame and turn it into an arcade machine).

So what are you waiting for? Impress us with a new toolbar, a new button-bank, sinus scrolltext or whatever control type you love to code! A hex editor would be nice (or any editor to be honest, I havent gotten around to coding one yet).

The Smart Pascal competition!

March 3, 2015 Leave a comment
Probably the coolest mini-pc in the world

Probably the coolest mini-pc in the world

I recently found myself in possession of probably the hottest piece of hardware on the market, the Raspberry PI 2 model B. This is the super funky version with roughly 10 times more speed than it’s predecessor, double the ram and more USB ports. It is capable of running Microsoft Windows 10 [ARM edition] when that arrives.

Well, now is the chance to win this puppy and have it sent to your doorstep!

Smart Mobile Studio

Back in 2012 Optimale Systemer AS held a Smart Mobile Studio competition where the winner got an iPad 2. And boy did we get some cool entries (!) Loads of classical 16 bit demo type projects which in my view is one of the best resources for beginners to learn from. The result is that Smart Mobile Studio ships with a ton of cool demo’s, ranging from phong shaded polyballs to high-quality WebGL landscape demonstrations.

While visual demonstrations are great, this competition is of a more serious type. Namely who can write the best Smart Mobile Studio custom-control!

Note: I must underline that this competition is not held by Optimale Systemer AS, but rather Delphi Developer, if you are not yet a member of our Facebook group, click the link and visit us!

Rules

  • No-one from the SMS team may enter the competition
  • You must be the author of the code you submit
  • External JS is allowed, but within reason (*1)
  • Write clean-cut, commented object pascal as much as possible
  • The code must be made open-source so others can learn from it
  • The control must make use of effects (*2)
  • Controls must conform to standard (*3)

*1: The goal here is Smart Pascal component writing, which means that JS is allowed but focus should be on providing a Smart Pascal solution. A thin wrapper around some external library is not really your creation. But we do allow the use of third party JavaScript libraries if their use can be justified.

*2: The w3effects.pas unit contains classes for triggering CSS transition effects. You can also edit the style-sheet and add your own CSS effects directly there. The use of tween.js is allowed, you may also use the Smart Pascal QTX library which makes effect programming child’s play. If effects are inappropriate for your particular controls, you may omit them naturally, but the goal should be to create controls With pleasant visual feedback when you interact with them. Also remember that CSS classes map directly to the control name. So if your control is called TMyControl, then a CSS class with the same name should be added to your stylesheet.

*3: With standards I am referring to ordinary control use, like overriding and deriving Your control from a valid visual ancestor (TW3CustomControl for instance). More than one Visual instance should be allowed on the form (unless the topic of your control dictates single instance use). No “special” (read: hack) way of initializing the control. Write a good one!

Inspiration

There are loads of cool JavaScript controls out there, ranging from the simple and elegant to the technically excellent. I strongly urge you to have a look at Chrome Experiments, which is a website dedicated to various effects and demonstrations for Chrome. Just remember that what this competition is about are controls. So it’s important to find something of value for others in their application design.

Coding controls is easy and fun!

Coding controls is easy and fun!

It could be something as simple as a HTML5 TPages (tab controls), a header control which animates it’s changes (e.g: you set backbutton.visible:=False and the button fades out rather than just vanish). Just have a look at TMS’s Delphi components for instance, which is very inspiring!

Or perhaps a 3D component? To achieve that have a look at our Sprite3d.pas unit which uses CSS to position ordinary DIV elements in 3D space. To add scene and perspective you must place them inside a container DIV with percentage size and perspective values — and voila, you have a 3D scene viewer component.

And last but not least, an old favorite of mine which I have implemented countless times in Delphi: The pixel editor control. With zoom, different drawing tools, grid, horizontal and vertical rules. It’s not hard to program but can be a little consuming once you get started.

Blast from the past component

Blast from the past component

Well — I have no intention of dictating what you should put into the competition, I write this only as a source of inspiration to provide some pointers as to what can be made.

If you havent written any Smart Mobile Studio controls before, dont worry. It’s a lot easier than native Delphi or FreePascal controls. Just inherit from TW3CustomControl, override InitializeObject (constructor) and FinalizeObject (destructor) and of-course ReSize() and you are well on you way. Just search this very blog for examples! The Smart RTL is rich in features, yet small and compact enough for expansion! You will notice how that Delphi 5 or 7 feeling comes back to you.

Just control-click your way around the RTL, just like you would in Delphi or Lazarus, and have a peek at the foundation classes. You will find it’s much smaller, easier to understand and ad-hoc than VCL or FMX.

Dates

Entries must be delivered by the 4 of April, so you have a whole month to complete this!

Note: If too few people enter I preserve the right to cancel the competition. At which point the Raspberry 2 will be given to the most impressive component-programmer so far.

Judges

The judges will be myself, Peter and Glenn over at Delphi Developer where we serve as administrators (Facebook group for Delphi, FreePascal and Smart Pascal developers). If you havent joined the coolest Delphi group in the universe you can do that here: https://www.facebook.com/groups/137012246341854/

Contact

Send your submissions to lennart.aasenden AT gmail dot com, place “Smart competition” in the title!

Object Pascal for Raspberry PI

October 29, 2014 5 comments

Recently I visited the Raspberry PI community on Facebook. A great group with many exciting DIY projects of all shapes and sizes. Personally I have bought two Raspberry PI (short: RPI) for various purposes; first of all retro gaming through MAME, and secondly more serious stuff like ownCloud and a private build server for freepascal.

And this is what I want to present to the Raspberry PI community, because the moment I began to talk about pascal – I was met with a near hostile attitude. Both on the official Raspberry PI forum as well as the community driven Facebook group. I found it baffling that someone could get upset, or use hostile language towards someone, over a programming language. I use many languages, including scripting engines, they are all part of my toolbox. But the language I use the most is object pascal, because it’s quite frankly so much better than the alternatives. It is so productive, easy to use and powerful that I almost dont know where to begin.

To Quote Linux Journal:

Lazarus may be the most native cross-platform development environment
running on Linux, Windows and Mac OS X. -Source: Linux Journal

It is such a shame that so many young programmers have been completely hoodwinked by hype and marketing, that they actually believe that a scripting engine such as python, or a bytecode virtual machine like Java, can even be compared to Object Pascal or C/C++. Python and Perl have their uses in the IT landscape and are brilliant dispatch and processing languages, but they are just scripting engines, written in a language which paradoxically is not python or pearl. Which is just one of the ironies we face when discussing what the nature of a “real” programming language is (one of the base criteria is being able to compile itself once the bootstrap is written for a particular platform). Many of these teenage programmers quite frankly don’t understand the distinction and really believe that python is en-par with C++ or object pascal. I’m sorry to burst your bubble, but compared to C++ or Object Pascal — python is nothing but a toy.

Freepascal / Lazarus IDE on Linux

Freepascal / Lazarus IDE on Linux

I have coded my own scripting engines (quite a few actually), so I know perfectly well how much work is involved. Writing a script engine or a compiler is probably one of the most technically challenging topics you can visit; but at the end of the day none of these systems can compare to a real language; neither in depth, technical excellence, dependencies, ease of distribution, speed or possibilities.

And in the case of Object Pascal, the language is no harder to use than python, so the argument of complexity and time-to-market is null and void.

Object Pascal? But isn’t that old and outdated?

Absolutely not. It’s younger than C/C++ and is in constant development, just like C++. In fact, on the Windows platform C++ builder and Delphi are companion products which are binary compatible, meaning that you can share compiled code between them. This is also scheduled for OS X and (in a couple of years) Linux. But freepascal which is the open-source, free alternative to Delphi, have been on these platforms for a long time already.

What you will find if you take the time to investigate Object Pascal, is a well thought-out language which has withstood the test of time, based on a rock-solid software patterns and built around an architecture which is scalable, agile and extremely productive. It is used by millions of individuals around the world on a daily basis, both large and small companies (including several fortune 500 companies) and has a history of delivering stable and robust software.

Skype, Nero Burning Rom, Help and Manual, Dark Basic, Jotta Backup — these are just some of the well known applications out there that are all written in object pascal. So the argument that one guy cam up with, which was “I have never used a single Delphi program ever” is as null and void as the time-to-market rubbish. If you havent tried Skype, or for some reason believe it’s of lesser quality – then you should get your head checked.

Let’s have a look at what object pascal can do for Raspberry PI by establishing a couple of facts.

Get away from platform bound code with Smart Mobile Studio

Compile for HTML5/JavaScript with Smart Mobile Studio!

Raspberry PI is not a power-house of processing power. It has a low-end ARM CPU which, if over-clocked (forced to run faster than it was designed for), delivers roughly the same power as the now 15 year old Pentium III. This means that if you hope to use the Raspberry for anything useful, especially if your target audience are young teenagers or kids eager to learn how to program — you want to chose a language which has the following qualities:

  • Runs fast, a Pentium III needs all the help it can get
  • The less dependencies (libraries) the better
  • Is platform independent
  • Scalable learning curve
  • Support for modern constructs, like generics
  • Has plenty of examples, books, websites and videos going for it
  • Costs little or nothing
  • Provides good income when mastered

In other words, if you want to build applications which executes extremely fast, even faster than C/C++ in some cases, then you could not find a better language for the Raspberry PI than object pascal. The reason for this choice is again backed by facts, not preference:

  • Object Pascal was taught in european schools as late as 2005
    Object Pascal was made with teaching in mind
  • Object Pascal was designed to replace C/C++ and is more mature
  • Object Pascal is much easier to master than C/C++
  • Object Pascal code runs en-par with C/C++ but often surpasses it in terms of speed
  • The generated executable code is highly optimized
  • The generated executable has no dependencies. Everything is compiled to a single binary
  • Full support for external libraries (and also packages)
  • The compiler supports every chipset and operating system on the market (and then some)
  • Both compiler and source RTL is well maintained and up-to-date (VCL, LCL, VJL, FMX)
  • Object Pascal has a thriving community with millions of users
  • There is a proverbial ocean of examples, components and frameworks available
  • Object Pascal supports inline assembler
  • Pascal has delivered commercial applications for 20+ years
  • Pascal has produced brilliant software engineers for 20+ years
  • Delphi programmers are in high demand!

So the reality of it all is, that if someone wanted to create a processing language like python, they would pick a real language to implement it, like C/C++ or object pascal. This is a fundamental difference which is extremely important to understand: Namely that a real language, one which is compiled into executable machine code, cannot be compared to an interpreted script language. It’s like comparing a bicycle to a racing car. It’s two completely different worlds. For instance, how many python compilers have you found that was written in python? Or how many python or pearl runtime environments have you used which surpasses the speed and technical advantages of C++ or Object Pascal? It is a fact, that native executable code will always be faster than interpreted AST (abstract symbol tree) execution, even when JIT technology is involved.

Delphi XE7 supports iOS, Android, Win32, OS X with a variety of project types

Delphi XE7 supports iOS, Android, Win32, OS X with a variety of project types

Resources

There are far to many resources for learning object pascal than can be listed on this website (let alone this article), but if you are interested in having a look, i have provided you with a handful of links below:

If you visit Google Code or SourceForge, search for “Delphi” or “FPC” (freepascal) you will find thousands of big and small projects ready for Download. Everything from operative systems coded from scratch in freepascal or large scale web services to handle thousands of connections, database servers written in Delphi, database engines, games, multimedia — the works.

Oh, and the Raspberry PI disk-image writer for OS X was written in freepascal, you can download that here (much easier than the guide on the official website).

If you are serious about programming, especially on embedded systems, then object pascal is probably the best choice you can make. It’s easier to learn than C/C++, has all the features of C/C++ (with the exception of multiple ancestors. Object Pascal enforces linear inheritance to avoid ambiguity in the VMT [virtual method table] should identical members collide, which is the problem of multiple ancestors for a class), has no dependencies (so your programs dont need a second library file to run), is highly optimized, scales from low-level procedural or assembly-language programming – to high level object orientation; the list goes on.

To install on the PI, simply open terminal and type:

  • sudo apt-get install fpc
  • sudo apt-get install lazarus

As for platform support, you have a lot to choose from. FreePascal provides the following:

  • DOS
  • Windows
  • Linux
  • OS X (Intel, PPC)
  • Classic Mac OS PPC
  • Spark Solaris
  • Amiga (68k, PPC)
  • Aros (intel)
  • MorphOS (PPC)
  • iOS (ARM)
  • Android (ARM)
  • Raspberry PI
  • BeagleBone
  • Nintendo DS
  • Nintendo Wii
  • Playstation
  • .. and more

Happy Raspberry PI coding!

Raspberry PI broken freepascal packages

October 24, 2014 Leave a comment

For some odd reason, installing freepascal + lazarus on Raspberry PI is no longer possible. There is something wrong with the dependency chain inside the repository.

Raspberry PI dependency error

Raspberry PI dependency error

Hopefully someone will fix this ASAP

Resurrecting the Amiga home computer

October 20, 2014 7 comments

I know. This is a Delphi blog and lately I have been so far off topic that you are excused for thinking I’ve gone bad. But rest assured that all my marbles are accounted for – I have simply done what all good programmers do from time to time and explored new things.

Firefox os, Javascript is coming..

Firefox OS, Javascript is coming..

For the past 3 months I have invested time in learning Linux, which is becoming more and more important these days, no matter if you are a programmer or not. And I can safely say that the time spent hacking away at Ubuntu has opened my eyes to new potential markets for both Delphi, Smart Mobile Studio and FreePascal.

Load balancers are on my list now, although with C# and the mono framework in mind. I will be working on load balancing code quite soon in C# so absorbing the market and the various models out there is important.

And last but not least, alternative operative systems. You may not be interested, but HTML5 and JavaScript is growing increasingly popular. So much so that hardware vendors are adding JS interfaces for their products. This means that you now have micro-controllers that eat, execute and run JavaScript directly (V8 Built in probably).

I have also spent some time in the past, looking at technology that basically got me where I am today. I was lucky enough to grow up with almost exclusively Commodore gear (Vic 20, Commodore 64 and Amiga), in a country which besides Sweden and the UK was the Amiga nation supreme, with all the big hacker groups neatly strung like pearls across our Norwegian coastline.

What caught my eye

Unless you have been living in a cave the past 5 years you have probably heard of the Raspberry PI mini computer. It’s a tiny little gadget, about the size of a credit card, and it costs round-about $35 (!) And if you have been following that, then you also know that it’s a fun piece of hardware which can be picked up anywhere, is powerful enough to run Linux (although barely) and is being used for everything under the sun. People make arcade machines with it (Mame is a fantastic emulator), they build their own Nintendo systems with it (Nes, SNES); the more technical savvy users even control their houses with it, stuff like heat regulation, lights and things like that.

Recently Acorn Computers, which was a competitor to the Amiga back in the 90’s (their Falcon model came close to the HW specs of the A1200 towards the end, but never sold since the Amiga dominated Europe) released RISC OS into the public domain. Or open-source, I havent looked at the details yet — but you can download and use it on the RPI for free.

RISC OS in all its.. eh, glory

RISC OS in all its.. eh, glory

What are the odds of anyone using RISC OS in 2014? It’s very different from anything we got on the market, but oddly enough not that different. The reason people use it with the RPI is naturally because it’s small, compact and runs on the hardware. It’s a strange little OS, sort of a mix between Linux and Windows (if you strip them down to the bare-bones). It’s focus on Basic and Machine-code sort of reminds me of the Commodore 64. Remember how we used to buy magazines with cheat codes, then spent an hour typing in all those poke and peek commands? Well that’s the feeling I get when playing around with RISC OS.

Thinking about the Amiga

For roughly 20 years now people have been (well, some people) eagerly anticipating the return of the Amiga. I have pretty much made my reasoning clear on the subject in earlier posts – that I hardly think the Amiga will ever come back, quite simply because it doesnt serve any purpose in mainstream computing.

The only possible way the Amiga could once again become popular, is if the platform did some task exceptionally good – much better than Linux and Windows do. And let’s face it, that’s not gonna happen. Going face to face with Microsoft and millions of Linux companies at this point in time would be suicide. And no investor in his right mind would come near such a project.

Sexy, compact and extremely fast! Amiga OS

Sexy, compact and extremely fast! Amiga

But! There are a few facts of life we should remember. First of all, competing with free is hard to do. This is why Linux (almost forgot: GNU/Linux) has even evolved. People use Linux because it’s free and they can shape it into whatever they want. Linux has been lurking in the shadows for ages it seems, doomed to be a “server OS”, but that is starting to change – or has changed in recent times. It’s now a very capable, safe and enjoyable platform with thousands of easy to use titles. It’s actually easier to install and un-install programs for Linux than it is for Windows. Which has taken Linux a long, long time to achieve.

Competing with “almost free” is even better, because then at least it has value. It’s a paradox I know, but if something costs $3 it’s statistically more likely to be successful than if it’s 100% free. What I have in mind here is that if you could get an Amiga system for, oh, say $80 or $100 (the price of a Raspberry PI + Amiga OS) that is a pretty good deal!

Going back on topic — what about the Amiga? Well, the trick of surviving is to avoid bigger fish. It’s basically what Steve Jobs did when he returned to Apple. Instead of going into the ring with Microsoft, which would have ended in Apple getting beaten to death — he took the fight to new markets. The IPod became the money-cow for Apple in combination with music sales, followed by a series of accessories which all provided Apple with very welcome funds.

These funds were used to launch the new Macintosh computers, but here Steve made a genius move. Everyone was expecting Apple to once again taking on Microsoft, but instead he competed exclusively in the areas where the PC was weak: namely machine design and an aesthetically pleasing desktop experience! Apple simply ignored Microsoft and made sure their “platform”, which is iPod, iPad and iMac connected together and worked out of the box. It should also be mentioned that Microsoft owns large portions of Apple, so the whole “mac vs. pc” argument is not even worth going into (although some people do, even to this day).

Amiga on ARM

So, what could the Amiga compete with today? Well, if the owners of Amiga OS were to even entertain pushing it, it would have to be for the Raspberry PI. It would compete primarily on the level of size, speed and resource requirements. In many ways it would be the perfect embedded platform, since 90% of all embedded boards are dedicated to one task only (offshore and military applications are extremely lucrative). It would also be a nice excuse for lack of protected memory which would buy them some time to get implement that. So that’s one market Amiga OS could indeed enter. It’s competitors would be much larger, more expensive systems like QNX real-time OS, which also needs 4-5 times as much CPU power just to start. But Amiga OS would have to be partly re-written and the old custom-chips would now be replaced by code. The blitter and sound chips we all loved so much could still be used, but they would be implemented as software mapped to the GPU chip of the RPI.

Raspberry PI, Model B

Raspberry PI, Model B

The Amiga OS, even with a layer of 68K legacy emulation, would – if compiled to run on ARM, literally run rings around Linux, RISC OS and whatever else is presently there. The RPI is capable of emulating an A500+ more or less perfectly using UAE (running on top of Linux) – so you can only imagine what speed a native ARM version would achieve.

Another factor is resources. Amiga OS runs happily with less than 4 megabyte of RAM – the low-end Raspberry PI ships with 512 megabytes, and the current model B with 1 gigabyte. The low-end CPU is a 700Mhz ARM processor, with the high-end version running at 1Ghz. Both can be over-clocked to respectively 1Ghz and 1.3Ghz without problems, although a cheap $3 heat-sink may be in order.

But the best factor is undoubtably production costs. Raspberry PI is an off-the-shelves product. Its extremely cheap, readily available and has a dedicated GPU. With the blitter software making use of said GPU (as well as the desktop and OS in general), you would no doubt have the fastest Amiga ever made. So the cost of producing the machine would be limited to software development, not hardware production. Adding a case and bluetooth keyboard/mouse is something even mom can do.

People would pick it up not because it’s a PC or a Mac alternative, but exactly because it’s not an alternative. Parents dont mind spending $35 on a system which, with a bit of online torrenting, has thousands of classic games to run. Add a joystick and your kids have more games to play than they will ever have time to complete.

Despite it’s size, small form-factor and processor, the Raspberry PI is still a very good entry-level computer for kids, but Linux and RISC OS is quite frankly to bloated for the hardware. What it needs is a slim and fast OS that achieves miracles with very little. The RPI’s biggest problems is software, because “modern” software tends to be compiled with a completely different philosophy. From what little I remember of the 90’s, Hyperion (or some other company) did upgrade Amiga OS to more streamlined C/C++ (read: more portable). So it’s not an impossible endeavor.

I sincerely hope “someone” out there is reading this (whomever owns the rights to Amiga OS) because it’s probably the best and only situation this decade for a return on your investment.

  • Nearly non-existent hardware production cost
  • Time to refurbish the OS for pure ARM (can run on any arm platform)
  • Legend and legacy support market
  • Free marketing access via the RPI community (schools, teenagers and adult users)
  • Huge potential as an embedded platform

Well, that’s what I think

Build your own Delphi based operative system

October 19, 2014 8 comments

Those of us that grew up in the hacker community of the 80’s and 90’s have a different mindset from kids today. It’s sort of built into us that if we put our minds to it — we can do anything. Any system can be hacked, modified, built. Why? Because we can that’s why 🙂

I still remember getting so angry at loosing in Soccer Manager that I got my drill, black & decker’ed my way through the F1 key, then soldered it shut in order to win the tournament! Yeah we Norwegians have stubbornness issues. But on the positive side — we get stuff done!

Operative systems

While games was my dream job as a teenager, another side of my aspirations were building my own programming language (sort of did that) and my own operative system. Not a system like Linux or Windows, but rather just my own desktop environment. Back then the Amiga had it’s kernel on ROM’s, so the only thing that loaded when you booted the machine were drivers and the desktop environment. So naturally everyone wanted to pimp or replace that with their own.

Xamarin rewrote Android to C#

Xamarin rewrote Android to C#

Well, the Amiga is long gone and buried (sadly) and exists now only in the virtual world of emulation. But would it be possible to create your own, pascal driven desktop environment for x86 computers?

Now if you are thinking about a fully-fledged operative system, with it’s own hardware drivers (this is really the biggest challenge, because there are so many configurations out there), kernel and software — then I would say no. Not because it’s impossible — but rather improbable that anyone would throw away the amount of time and money to do so. Having said that several operative systems have been written in freepascal, the latest endeavor being FPOS. But as you probably imagine, it takes a long time to truly build an OS from scratch.

But, creating your own environment which is 100% controlled by your code — that is more than possible. It’s already been done by several companies in the field of backup-software and embedded NAS systems.

Xamarin, the guys behind mono even took the time to re-write Android in .net a while back, called XOBOTOS. You can check that out on GitHub here: https://github.com/xamarin/XobotOS

Delphi and DOS

You probably think that Delphi is only for the desktop. Well, that’s how it was designed. But the code generator inside Delphi produces ordinary, bog standard machine code; meaning that it only does what it’s designed to do. Namely to produce machine code that the x86 processor can execute.

What we need is something which emulates the absolute bare-bone functionality of Windows. I am talking about the true low-level stuff like allocMem(), the ability to read mouse co-ordinates, keyboard input and so on.

Delphi for DOS, works like a charm

Delphi for DOS, works like a charm

Well it just so happens that such a system exists. It’s called WDOSX and was primarily adapted for Delphi 5 and 7. What it does is take your ordinary Delphi .exe file and patch it to use the WDOSX extender. This basically turns your Windows program into a DOS program. The extender emulates the windows functions (memory allocation and so on) to work with DOS rather than WinAPI — effectively fooling your application into thinking it’s running under Windows.

Limitations

The limitations are obvious: no windowing toolkit, no threading and pretty much what you would expect from a DOS program. On the positive side though – you do get a flat memory-model, so if you have 16 gigabytes of ram, you will be able to use it as normal. No “high” memory and “low” memory, or 64k segments to worry about.

You will also enjoy a very VCL like RTL, namely CLX (Kylix). DWPL patches the CLX source-code so it works under DOS. It especially patches client/server units, so when it comes to networking you will be surprised just how powerful it is.

Add full-screen access, mouse, sound and complete access to the disk and you have probably the most powerful “DOS” development platform ever created. CLX is the open-source port of VCL to Linux (read: platform independent). A variation of CLX is used by Lazarus, so it’s pretty solid stuff.

Kylix, a project years ahead of its time

Kylix, a project years ahead of its time

Applications

It wont take long before you ask “but what about applications?”. Well you are in luck, because Delphi has the best scripting engines in the world. You could use RemObjects’s script to build applications, or what about DWScript (which is much better)? I seem to remember that the latest (read: last) WDOSX extender included support for blue-threads (so there is a TThread class in there somewhere). With a bit of work you could run several DWScript based applications at once.

And the speed would be phenomenal. Because your application would in fact be the only “real” application running on the entire machine. With exception of freedos and 2-3 drivers naturally.

A NAS server written in Delphi for embedded platforms? Yes you can!

Graphics

The Delphi package to use WDOSX (DWPL) is actually very good! It maps the VESA screen buffer into a TScreen class, making it a snap to take full control of the computer’s graphics. The downside is, naturally, that you wont get access to any GPU functionality since VESA means you use the processor to draw everything. Which is much slower.

It also uses FreeType, the same font renderer used by OS X and Linux to draw text on screen. This turns your home-brew OS into a more polished looking system.

Networking

Believe it or not but that is also possible. It requires a network card with a packet driver for DOS. Those are rare today, but not as rare as you might think – because DOS is still the #1 system for offshore embedded systems and military boards. Strange as it may sound DOS is alive and kicking to this day.

Libraries

Believe it or not but WDOSX supports the loadlibrary() api. Meaning that you can load and use DLL files (as long as these libraries dont collide with the limitations). That is pretty cool. You could in effect isolate common functionality in libraries for easier maintenance — or define your .exe format as DLL’s (so any applications for your desktop would ship in the form of DLL files, since that is the way to get executable code loaded).

FreeDOS

You still need a system that does all the dirty-work, talking to hardware interrupts and taking care of device IO. Well this is where freeDOS, the open-source and free DOS clone comes in.

So your system would in effect look like this:

  • FreeDOS
  • Mouse driver
  • Graphics driver
  • Network packet driver
  • WDOSX
  • Your application

Desktop environment

Creating your own desktop is, well, not hard but time-consuming. A window is basically just a graphical region with various options for how it’s displayed, positioned and drawn. It’s more complex but once you have the basics implemented, it’s quite fun to program 🙂

Possible markets

The only viable, economic market i can think of is that of backup and disk-utilities. In fact, most of the recovery software that boots off a USB or cd-rom is based on DOS. People use freeDOS for a lot of things, but very few have used Delphi for this. It’s primarily the domain of the now discontinued C++ Builder.

But yes, you could with some effort create a fully independent desktop environment written completely in Delphi. I have also seen full kick-start (boot code) written in freepascal (believe it or not).

But for sake of sanity I would stick to creating a desktop-system designed for a specific task, like back/restore of a disk (you have raw access to sectors so it’s a perfect situation).

A possibly second market is embedded systems dealing with server’s. Dedicated NAS servers are cheap these days, but you can actually build your own. It completely depends on your motivation (fun, money or hobby).

Either way — if someone took the time to work on this for a few months, Delphi would have a pretty good setup for creating embedded applications. The embedded market is very lucrative, especially the companies that target the oil industry.

FreePascal

I actually havent tested WDOSX with freepascal, but I suspect it will work. I did a quick google and found that WDOSX is indeed mentioned under supported systems (Ubuntu man pages).

If the idea of writing your own desktop-environment for embedded systems tickle’s your fancy, then why not investigate 🙂

Building a modern Amiga, notes and ideas

October 18, 2014 11 comments

Ordinarily this is not a post you would find on my extremely dedicated Delphi and Smart Pascal blog, but readers will no doubt have noticed my love for the old Amiga home computer. A lot of my effect code have comments hinting to their ancient Amiga roots, and I have made no secret that I think it was a great tragedy that the Amiga went under (especially since those that buried it were board-members with no real passion for the product).

Sexy, compact and extremely fast! Amiga OS

Sexy, compact and extremely fast! AROS

But all is not lost, in fact – while a lot of Amiga boards are filled with a rather thick atmosphere of defeat and memories of glories long gone, the truth of the matter is that there has never been a better time to be an Amiga user! Never since you could buy a real Amiga has there been more options for people to chose from, and after nearly 30 years that speaks volumes about the platform.

UAE (universal Amiga emulator) is a fantastic piece of software engineering. It exists today in many forks and flavors (a “fork” is when a programmer clones the code, which is called a branch, and starts working on it. The process of cloning is called “fork-ing”) on just about every possible platform out there. This means that you can now turn almost any PC, especially older PC’s, into a fully fledged Amiga. In fact UAE not only runs on x86 based machines, but ARM and PPC chipset’s as well. So if you have an old G4 or G5 Mac in the attic – why not give it a new purpose as an Amiga?

Now I know what you are thinking: That’s not really an Amiga is it!

Well, that is of-course true in the literal sense, but while I could spend a few hours digging into the philosophy of what an operative system represents, or if you truly are you since the cells in your body change every 8 years or so –It would be rather pointless. Instead, I would rather spend my time looking closer at what I can do, and what my options are! In other words: what can we do to build a modern Amiga through emulation?

Options for building an Amiga

I wrote an article about how I used a humble Raspberry PI to fully emulate an Amiga, booting into UAE from linux automatically (so no Linux login-prompt. It boots straight into Workbench). Using off-the-shelf battery packs I even made it portable with 6 hours game-time without a power supply!

So the Raspberry PI is one way of going about getting a cheap Amiga. But as many people have commented – you can’t emulate an A1200 since the RPI (Raspberry PI) is not powerful enough to deal with AGA copper code. Im not even sure AGA is included in the UAE4All code (I havent looked at it) to be honest.

Also, I havent touched an Amiga since 1995 so the fact that I managed to get the system booting on a Raspberry PI after fiddling with it for less than an hour – is nothing short of a miracle in my book. It was almost an emotional experience, sitting in my living-room testing rocket ranger at age 41 (had the house to myself that weekend). That was the first Amiga game I bought as a kid and it released an avalanche of happy childhood memories.

I sincerely doubt PC owners feel the same about that 386 DX 1 they used to own 🙂

The power of freeDOS

Right. While using a Raspberry PI for your Amiga emulation is a good option, it can be a hassle to setup correctly (as many have reported). I am no Linux guru so I suspect I got lucky. Thankfully I have gotten some help after that, to make a boot sequence which is safer and valid (hope to upload a disk image when version 2 is done).

The second Amiga option is to buy a dedicated PC and install freeDOS + UAE, that is probably the fastest UAE you will ever get your hands on, since the CPU will be 90% dedicated to UAE itself. You can read more about dosUAE here. But keep in mind that this is DOS, so dont expect a codebase updated recently. But it works, no doubt about that.

DOS UAE is old but cool

DOS UAE is old but cool

The downside with regards to DOS, is that unless you have drivers for your graphics card (and a decent packet-driver for your network adapter, if UAE for DOS even supports that?) – then it wont be usable for much more than playing games. Packet drivers and “modern” dos software for new hardware is primarily the domain of embedded boards and custom designs (read: offshore, oil industry and military systems). But if you have an older PC with networking and graphics card setup correctly — why not give it a try?

The power of Linux

The same formula likewise works for a dedicated Linux box – which is a much better option than DOS since it eliminates the driver problem off the bat. This is the option I would use, because if you boot from Linux you have the benefit of hardware support. Like mention in my previous article, Ubuntu has roughly 3 times as many drivers than other distros due to the fact that it’s funded. The owner of Ubuntu has thrown massive amounts of money on driver development over the years because he knew that drivers were the key to a successful desktop operative system. So if you want a fast Amiga (as fast as Linux can push UAE) with the best possible support for fresh modern hardware (thinking especially about graphics and GPU support here) then Ubuntu Linux is as good as it gets.

The power of Windows XP

If you are going to dedicate a computer to your Amiga resurrection project, then a very fast option (probably faster than Linux and less hassle than DOS) is to install Windows XP. If you have an old XP machine you no longer use (especially if already has drivers working and is ready for use) this will have a leg up on DOS and is easier than Linux. Depending on your Linux skills naturally.

For casual gaming and retro coding

For casual gaming and retro coding

Windows XP is easy to modify to your own diabolical ends, like altering the boot-image, no login prompt – and putting UAE in the startup folder. That is basically all you need to do for your Amiga-XP-Box.

Oh and you get the benefit of using hard-disk images (or why not dedicate a whole partition for your desktop?).

The power of thin clients

This is a great option that is both non-expensive and clever. Thin clients are mini pc’s that were built to only display programs that execute on the server. Even today many TC’s ship with Windows XP embedded. A thin client is “bare-bone” with little or no disk and RAM in the 1 – 16 GB range. More than enough for your Amiga (the Amiga can do wonders with 2 megabyte, so 1024 times that is practically nerdvana). And what you do is the exact same as you would do for the dedicated XP box: You alter the boot process and fire up UAE immediately.

More than enough for Amiga emulation

TC’s — More than enough for Amiga emulation

Depending on the model it will be roughly the speed of an A4000 060 (or so I’ve heard, I have not tried this myself). I highly doubt older models can reach anything close to a 68060 processor, but state of the art TC’s might. It’s impressive how much CPU power they cram into small gadgets these days. My phone probably have more raw power than a pimped up Amiga 1200 had. But it’s how power is used that matters, and no modern device comes with software as ingeniously designed as Amiga OS. It runs on air and tears of ducklings.. It’s a work of art.

Just to make my point I did a quick visit to the most used Norwegian second-hand online marketplace FINN.NO and I found a guy selling 6 (six) HP thin clients at 100 NKR a piece ($9). That’s a bargain if I ever saw one. Here is the article link (will probably vanish quickly).

The power of torrents

I know it’s not good form to encourage piracy but we are talking games bordering on 30 years old (in some cases) so I have no problem looking at the massive collections of Amiga software out there in “torrent space” – as a pure resource of brilliance which belongs to the world. Having said that, I think people should avoid at all cost piracy of OS4 or Amiga forever. It is highly unlikely that any new environments will be created for the Amiga if people copy those systems; and besides – we are old enough now to recognize that programming is hard work. I work as a professional developer and know full well how much it hurts when people crack what you worked for 2-3 years to achieve. If you use it, support it with a purchase!

And this is coming from an ex Quartex and Alpha Flight member (for those of you that remember us). So it’s not without a sense of irony that I write about piracy.

But fact is, you will find gigabytes of games and applications online, much more than you ever had when you owned a real Amiga in your teens. The same goes for MAME (arcade emulators).

Downloading 3.500 Nintendo, Sega, Neo-Geo and Amiga games in <15 minutes is almost to good to be true. Remember Turbo-Tape on C64? You set the tape loading before you went to school and perhaps Last Ninja was done loading by the time you got home 🙂

The following search at PirateBay yields some interesting results:

http://thepiratebay.se/search/Amiga%20games

Sugar and salt

If emulation is not your thing then we should also recognize that there has never been more Amiga based operative systems than right now. Some prefer the old workbench, some prefer the new OS 4.X desktop and others still enjoy the clones. Which as of writing is Aros (and derived clones) and the “inspired” MorphOS.

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

MorphOS – Pimp up old PPC hardware like an G4 Mac!

Both projects have their positive and negative traits. The positive have to do with the fact that they retain and protect the legacy of Amiga – the negative is typically personified by lack of compatibility with 68K software and lack of drivers. If there is an elephant in the room, it’s undoubtably the lack of hardware for “modern” Amiga operative systems.

Having said that, people always find a way. While I havent been a part of the Amiga scene for many, many years – one thing you can always count on is the high level of skill and technical know-how in the community. If there is a technical problem, someone always figures out a solution. Just look at all those A1200 machines retro-fitted with USB disk-drives and ADF readers? So nothing is impossible.

Example: I picked up a second-hand G5 Mac with 2 monitors for 300 NKR ($30 or thereabout). Useless by modern standards and can only run “vintage” OS X, yet it runs MorphOS faster than any other machine I have! Including my brand new iMac and my Linux gaming PC (!). Imagine what a true port of Amiga OS for PPC would look like.

Truth be told, modern operative systems dont properly use the CPU. Optimization like simple “loop expansion” like we used all the time in the old days is rarely found in modern code. So when a truly human written piece of code is found, it’s typically lightning fast, small and very efficient.

New machines

From what I understand there are two systems being developed by third parties. The first is x86 based and meant for Aros, the second PPC based and suitable for MorphOS. But from what I read online prices for these systems are astronomical and borders on insanity. No-one in their right mind would pay three times as much for an “average system” just because it has a sticker with “Amiga” on the side. Refuse to buy these machines. Get a decent machine and run Aros or MorphOS in protest (!)

I must admit that I find the Amiga situation completely absurd. I have no idea who owns what, but whomever owns the OS should wake up from their psychosis – because there is absolutely no reason to sit on the Amiga codebase if you are not going to do anything with it. It’s been 19 years since I owned a real Amiga, nineteen years (!) and I it can only be described as retarded that the Amiga situation is exactly the same now as when I left.

Aros is pretty damn cool!

Aros is pretty cool!

As a developer myself I realize that the amount of work required to port Amiga OS from 68K architecture to x86 is enormous, but 19 years? I could have written the damn thing myself by now! What exactly are these people waiting for? And whomever owns the hardware rights – why can every other company out there just as small as you, create and release platforms based on off-the-shelf technology, and get it right; yet for the Amiga (which incredibly enough still has thousands of fans), building a machine is impossible?

I think we can safely assume that the owners have no intention of lifting a finger. No company is that slow neither in production or the head to fail so utterly over so many years. Sorry to burst a dream or two, but it’s utter rubbish to still believe that these companies/people have any tangible plans for the Amiga other than flamboyant nostalgia.

Interestingly, the one project that could actually give the Amiga a shot (at least as a “cult” like OS) was something called Amithlon, which was a custom Linux system which booted UAE directly (hm. interesting idea). In other words, a customized version of Linux – giving the Amiga side of things all the benefits of hardware abstraction and even new libraries for programmers to use (!)

But that was clearly to successful to the morons that own Amiga today.. heaven forbid that Amiga should run on x86 without problems — so the project was canceled (jaw drop’s here). Sometimes you just have to question the collected wisdom of the Amiga license holders. It’s almost to stupid to comment on.

Amithlon, worked like a charm on x86 -- so they killed it

Amithlon, worked like a charm on x86 — so they killed it

Still plenty of options

If we look away from the obvious stupidity of whomever owns the Amiga brand, hardware and software rights — the situation is actually optimistic: UAE takes the Amiga everywhere, and with modern processors spending most of their time in idle state – emulation is not the penalty it used to be. Heck, if UAE was modified to make use of multi-core threading, the emulation would be damn close to un-measurable in some cases. The guys behind UAE deserves a medal, it’s an excellent piece of software engineering (or reverse engineering).

I can’t remember the last time I booted an actual, real Windows machine. I do all my development in VMWare these days, including Linux and OS X development. So why I can’t enjoy my Amiga desktop with all those titles and programs is beyond me. Heck, putting together a decent emulation-station from either a cheap embedded board, thin client or older PC is a piece of cake.

Cloud, the future or everything

Cloud

Cloud

Despite the ridicules management of Amiga rights, the Amiga actually have a shot of reaching mainstream once again. Cloud services does not simply mean hosting – it also means that you upload a whole disk for executing it in the cloud. A bit like what thin clients did for terminal services, but 100 times more powerful!

With cloud taking over — it will no longer be a question of hardware, but rather a question of platform. If the Amiga have any future then that’s it. The alternative is that it remains the most widely emulated and loved home computer in the world.

A second market would be embedded systems. Have a sneak peek at QNX real-time OS. That could have been the Amiga, but someone figured it was better to do nothing for 19 years (except OS 4)… Just.. way to go!

And to those who own the rights for Amiga: give the source-code to the community. Make Amiga OS open-source. It’s the only way you will get the manpower to catch up with all the missing features. And if you ever wanted a native x86 version, then open-source is the only way to go.

What is the point of owning an OS if you are not using it for anything?

But to be honest it doesn’t matter what the Amiga copyright holders do. Emulation is so damn good these days that people have little or no use for an official Amiga. 20 years without a proper update is a long time. Just imagine the amount of code invested in Windows or Linux during those years — you can’t catch up with that without a miracle.

But once the C/BCPL code was made open-source, that reality would change drastically for the better.

So what do we need? A product that runs better on the Amiga platform (again, not hardware) than any other OS. Just look at what Apache and mySQL has done for Linux over the years. The Amiga would need something like that to adopt a serious role in the server community. Even if it was just cloud based game emulation for that matter.

Final words

Some people might think was a negative article, but it’s actually not. In Norway we have a saying which, roughly translated, goes like this: “sometimes you have to call a chair for a chair”; meaning that lying to yourself or others ultimately leads no-where. If there was no UAE then indeed – that would be grounds for sadness regarding our beloved childhood computer.

What have the romans ever done for us eeh?

10 for that you must be mad!

But we have UAE and hardware is now cheaper than ever before! Anyone with a slight bit of Amiga skill can easily put an old PC or Mac to good use. Machines which would otherwise be thrown away. Add torrents to that equation and .. thousands of games, applications and demos (!) If that is not optimistic news then I dont know what is 🙂

I have been harsh with the license holders of Amiga technology today, but after so many years I feel I have the right to speak my mind. And they have made it so utterly clear that anyone who cherish that old computer is utterly on their own. Which suits me just fine – because the community itself has everything it needs (and then some).

So to all friends of the Amiga personal computer out there —enjoy UAE and your homebrew devices!

Downloads

Building an Amiga for $40 with Raspberry PI and UAE4All

October 9, 2014 22 comments

Right. As most readers probably know by now, I absolutely love the idea of re-furnishing old computers to their former glory. I tend to buy second-hand computers and technology and turn them into something useful and modern, or at least something the original designers didn’t consider when they made it. Like my $43 Apple G4 with dual monitors, a kit I turned into a MorphOS powerhouse – that is presently running a custom synapse (FreePascal coded) file-server.

Well, I’ve had a Raspberry PI floating around the place for a whole year now; It was originally something I bought for my 11 year old son in a desperate hope that he would fancy a DIY project with his old man. But sadly I have capitulated to the power of minecraft and the fact that he is more a “soccer kid” than a programmer. I love him either way, but I hope to initiate him into the mysteries of code – which have given my life so much joy. Especially in my childhood, playing games and trying to make them using Blitz basic 🙂

The RPI mini computer, size of a pack of sigarettes

The RPI mini computer, size of a pack of cigarettes

Either way, yesterday I was shopping when came across a special offer on 5V re-chargable batteries, the models meant to re-charge your iPhone. So each battery holds enough juice to fill an empty phone when you’re on the road. I suddenly remembered that the voltage and amp was identical to the Raspberry PI, and since you could chain-connect several batteries together via USB->USB MINI connectors  I figured if I got a couple of them the PI could run on them.

And work it did! I was actually able to get 6 full hours of “mobile” activity from the Raspberry PI with just two batteries (!). Which is en-par with any modern laptop of portable touch device (IPad, Android Pad). I also stopped by an electronic’s store and picked up a USB splitter – turning the meager 2 USB slots on the classical Raspberry PI into a 6 slot connectivity monster.

Tip: A rule of thumb if you want a “portable Amiga” is to add one battery to the chain per USB device you have connected that requires power. Keyboard and mouse doesn’t require much, but count one battery (a total of 2 so far). Add two more batteries if you use a USB disk drive, and a single battery if you use a Wi-FI dongle or a USB stick. So for an RPI with keyboard, mouse, external 512 gig disk and a wi-fi dongle: count 5 chained batteries.

Tip 2: Save your sanity and buy a pack of those cheap wireless keyboard and mouse. It requires very little power on the RPI and you dont have cables all over the place. Especially in your living room where your wife will no doubt comment after a while 🙂

Top 3: If your TV has an USB plug, buy a USB to mini-usb cable, then use the USB on your TV to power your RPI (!) It works brilliantly and once again saves you a power cable. With this in place you only need the HDMI cable and your’re ready to rock.

Linux to the rescue

One of the cool things about Linux these days is that it’s driver database has grown huge over the past 7-8 years. It used to be that getting anything at all to work on linux, let alone “off the shelves” windows hardware, was nearly impossible. I vividly remember having a (then) high-end gaming PC with the latest Mattrox graphics card (the type you could buy 2 or 3 and chain them with fire-wire optical cables for extreme performance) + Soundblaster 16, but when I tried to install RedHat Linux I ended up with a bog-standard VESA driver! That was such a disappointment that I did not touch linux for 8 years.

Well those days are long gone and most modern Linux distro’s are able to recognize whatever you throw at it. Since I picked up Ubuntu and started using it full-time I have yet to find a single piece of hardware that it cant work with. Which is brilliant! Especially the source-based drivers that (in theory) should work on all distros as long as it uses the driver API to talk with the hardware.

Either way — this meant that getting the Raspberry PI to recognize keyboard, mouse, external drive and even my printer (!) was actually easier than on my spankingly new Mac! You plug it in and seconds later it’s ready to go.

Memories of Amiga

I must admit that I miss my Amiga a lot. Im now 41 years old but when I think about my Amiga, which I clung to until the last moment, only selling it in 1995 due to Microsoft Office requirement in college, I get all warm and fuzzy inside. It’s the same emotion you experience when you meet “that special someone from the past, she that got away”. I guess it’s common knowledge that people who grew up with Amiga’s are extremely passionate about it – bordering on fundamentalism. And this is decades after it’s gone out of production (!).

There are crimes in the history of technology; VHS vs. Betamax was one of them – but the absolute worst crime in computing history – en par with the extinction of a the west-indies by a hoard of drunken sailors in the 1600’s, will always be the unjust death of the Amiga. We would inhabit a very different technological world had Commodore survived to this day, that is for sure. It would be faster, easier and far more friendly than anything we have today. Nor would it be driven by megalomaniac psychopaths like Steve Jobs or Bill Gates. Although Petro Tyschtschenko can give you a nasty scare if you meet him holding “the walker” prototype in a dark alley somewhere.

Right – here are few things people may not know about the Amiga:

  • You could buy VR (virtual reality) equipment based on Amiga Tech 20 years ago. VR is not new nor is it innovative, it all started with the Amiga
  • TV series Babylon 5 used Amiga for all it’s graphics
  • LucasArts used Amiga 4000 render-farms
  • Nasa loved the Amiga and had a ton of them, they were also used in a couple of satellites!
  • While Microsoft Windows could barely run calculator and notepad simultaneously, the Amiga had full preemptive multitasking
  • AmigaOS was architected after UNIX and is extremely resource sufficient; running a full multi-window desktop, multitasking with far better performance than Mac’s and PC’s at a meager 1 megabyte of ram and 14Mhz Motorola 68000 CPU. That’s like a 14 year old beating Mike Tyson
  • It was only when PC’s adopted graphics accelerators and 3D hardware that Amiga’s struggled to keep up
  • PPC accelerator cards were made to make up for it, but commodore screwed up the marketing
  • Ultimately the Amiga died due to neglect by Commodore, which filed for bankruptcy
  • After the demise of the Amiga, the MC68000 CPU’s were mainly used in washing-machines (auch!)

Turning a PI into an Amiga

Looking at the specs of the $35 Rasperry PI mini-computer we find that in a raw head-to-head comparison of CPU power (which is really unfair to the Raspberry, because the Amiga’s strength was it’s integrated custom chipset) it is head over heals beyond anything the Amiga had. The Amiga 500 had 512Kb ram, the low-end RPI has 512 megabyte ram (1024 times more!). The CPU is a single-core ARM processor running at 700Mhz, but most people overclock it to 1Ghz. I can only imagine how the PI would run if Amiga OS was ported whole-heartedly over. Amiga OS natively compiled for that hardware would run rings around an average, modern PC.

Ta-Da! <$50 for a portable Amiga? Eat that Amiga inc!

Ta-Da! Less than $50 for a portable Amiga? Take that Amiga INC!

So, how could I turn my now battery powered Raspberry PI into an Amiga? Well, I have to turn to emulation. And in order to get that working I need Linux. So I went over to the Raspberry PI website and downloaded the noobs disk image, plugged in a network cable and installed Debian (I also tried the fedora port, but Debian gave the best speed). I used the apt-get package manager to update the system, plugged in a wireless USB dongle so i could finally ditch the cable — and voila! I had a “mobile” Raspberry with wireless capabilities. Oh and I had a ordinary USB keyboard and mouse in all the time. Just in case you think I did this via telepathy.

Setting up the emulation

Next was the Amiga emulator, which comes in many flavors and forks. Once again i googled the best option and found a custom variation of Amiga4All on the RPI website. I downloaded the package and installed it.

Next, I needed a few things:

  • Original ROM files from the Amiga
  • Disk images of games, Workbench (the Amiga desktop) and harddisk’s

Well, considering the amount of money I have invested in Amiga’s during my teens I felt no shame visiting my local torrent and grabbing a massive 8 gigabyte ISO with everything. And I mean everything, including all the ROM files ever made for the Amiga (and then some! Even the failed Commodore inventions like the CDTV was there).

I took the Flash-Card out of the RPI and plugged it into my Mac, then copied the ROM files to the “roms” folder, and the disk images to the games folder. I also separated the floppy images from the harddisk images so it would be easier to work with.

Adapting Linux

Next, having booted back into Linux on the RPI, I edited the config file and removed the statement “startx” (towards the end of the config file) which is the command that starts the desktop under Linux (I presume this is universal, but I’m really new to Linux so there may be variations). I replaced it with the command-line call to start UAE instead – pointing it to the first game I ever bought as a kid: Rocket Ranger (I later discovered that you could disable the desktop completely when you install, but picking “text mode” instead of desktop-display).

To be perfectly frank I never thought it would work “just like that”, because I have only 3 weeks on hands-on experience with Linux (Ubuntu) so I was prepared to drone over esoteric man-files and asking people online. But to my big surprise, I 6-10 seconds later I was looking at the Cinemaware logo on my spanking new 55″ LED TV. Boy did I jump! I even got sound, although it was slightly jerky.

I went back in and had a look at the UAE config, turned on JIT, set “drop frames” to 1 (it was set to 3). I also set sound to mono, because I’m not that into music anyhow. And that was it — it worked just like my old Amiga (!)

Setting up WB

Next step was to see if any of the Workbench HD images worked, and indeed they did! It’s actually faster to use Workbench under emulation – than to use Arch Linux compiled for Raspberry (oh yes, I tested that distro as well, and it was barely usable at all).

Overclocking

A major speed boost is the over-clocking feature. You simply edit the RPI boot config and set over-clocking to max (see article on doing this here) and the CPU runs at 1Ghz, which is a great improvement from the default 700MHz. I have yet to find a game which runs worse than the original Amiga — and I’m guessing it’s not even hardware accelerated.

As you probably know the RPI comes with a proper GPU, which is how it can play HD video. If UAE was to use this there is no doubt — the RPI would replicate the old Amiga down to the letter, but with more power, more ram and full driver support for modern hardware.

Well, I hope my little adventure interested you!

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 Finn.no, 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.

Education

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 🙂

Smart Mobile Studio + nodeJS + Raspberry PI = awsome

January 17, 2014 Leave a comment
Smal but very fun to play with

Smal but very fun to play with

Want to test out your nodeJS business app before renting an expensive server + database hosting solution?

Well here is how you could do it with a minimalistic budget. First, order a Raspberry PI credit-card-sized computer at a whopping $25 pricetag. Follow the Raspberry PI installation guide for Linux (very simple, just download and flash the rom-card, then reboot and select the OS you want), then follow the Raspberry PI guide to setting up nodeJS on it.

So how do I code this device?

Buy Smart Mobile Studio, write your nodeJS server and Client in ordinary Object Pascal (or more precise: Smart Pascal, which is a next generation object pascal). To get your product onto the Raspberry PI, login to the device and start X (the “windows” like desktop environment) – copy the compiled nodeJS server code from your windows machine (you can access normal windows shares via the Linux filemanager).

Then open a shell (root user) and make sure read/write/execute rights is available for all users on your project folder. In short: cd to the parent folder, then type “chmod [myfolder] 7777”, replacing [myfolder] naturally with your project folder.

Then start your nodeJS project as normal on the raspberry.

Conclusion

Voila — you have a pocket size nodeJS server to test and play with. As a bonus you can also install freepascal on it (“sudo apt-get install lazarus” should do the trick). Lazarus is very slow on this device, so i suggest you write your programs on windows and just compile with FPC on the PI – which has an ARM CPU by the way).

Here is how you setup nodeJS on your machine: http://blog.rueedlinger.ch/2013/03/raspberry-pi-and-nodejs-basic-setup/

Follow the Smart Mobile Studio tutorial for creating nodeJS projects – both client and server.