Archive

Archive for January, 2016

Booting into UAE on ARM/RPI2

January 25, 2016 1 comment

I was just about to go to bed, but this info is to important to just leave hanging, so I have to scribble it down here for all to enjoy.

If you own a Raspberry PI and find Linux to be less than welcome, especially in the startup department, then you are not alone. And trying to get the linux gurus to shed some light on how the heck you can alter the boot process is like talking to wizards, pondering the mysteries of kernel callbacks or whatnot.

12628493_10153262975170906_1424956772931827411_o

Ah! The awesomeness! Look at the bones, look at the bones!

But thankfully today, Chips, the author of UAE4All2 (Amiga emulator for ARM) helped me out and gave the full low-down on how to boot straight into UAE with no Linux desktop getting in the way! Meaning: You can now transform your PI into a dedicated Amiga emulator! Once that doesnt start the Linux desktop at all. How cool is that!

For systemd based distros

How to boot directly to uae4arm FOR RASPBIAN JESSIE (and other linux based on systemd). First if you boot to desktop, let’s disable this by entering following line in a terminal:

sudo systemctl set-default multi-user.target

Then reboot and check: you should autologin with pi user so without any authentication…

Now enter startx to continue customization:

We will add uae4arm at each bash launch (basically each time you enter command line mode):

Enter following line in a terminal in order to edit bashrc:

leafpad ~/.bashrc &

At the bottom add lines to execute uae4arm (update directory as your installation):

cd ~/uae4arm-rpi/
./uae4arm

Next reboot you should enter automatically uae4arm :)

Initd based systems

How to boot directly to uae4arm FOR RASPBIAN WHEEZY (and other linux based on init)!
Below instruction apply for pi user but you can subtitute for any other user you created.
I prefer to edit files under desktop but you can use any other way too…

First if you boot to desktop, let’s disable this by entering following line in a terminal (raspi-config could be used to… to be confirmed):

sudo update-rc.d lightdm disable 2

Now reboot and check: you should not go anymore to desktop but instead should be ask for login in text mode. So login as pi (user then password) then enter startx to continue customization.

Now open a terminal and edit /etc/inittab by entering following line:

sudo leafpad /etc/inittab &

And add a # at the beginning of the line that ask for login, as below

#1:2345:respawn:/sbin/getty 115200 tty1

And instead we will auto-login, to do this add the following line just below the commented line

1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

Now save and reboot and check: we should autologin with pi user so without any authentication…

Now enter startx to continue customization:

We will add uae4arm at each bash launch (basically each time you enter command line mode):

Enter following line in a terminal in order to edit bashrc:

leafpad ~/.bashrc &

At the bottom add lines to execute uae4arm (update directory as your installation):

cd ~/uae4arm-rpi/
./uae4arm

Now reboot: you should enter automatically uae4arm :)

For Raspbian jessie, it is completly different since it use systemd instead of init during booting sequence…

Aeros for Raspberry PI, a field test

January 23, 2016 1 comment

Wow, seems like I never have time to blog lately. We are super busy creating fantastic stuff at work, and the little free time I have these days are spent with my children and my girlfriend. But today I have managed to allocate a whole 5 hours just to relax and enjoy myself.

Long story short, I have been super interested in Aeros for a long time now. So let me start by writing a few words what that is.

What is Aeros?

Long story short, back in the early 90’s the Amiga home computer was going the way of the dinosaurs. It’s graphical excellence which once made PC’s look retarded and stupid, was failing to keep up with cheap and fast hardware. As such, the 15 year old Amiga chipset was beginning to show it’s age. It simply could not stand up against fast GPU’s, 3D accellerators and 16 bit sound-cards. So all of that, in combination with some spectacularly stupid decitions by the Amiga share-holders and decision makers, ultimately meant that the best home computer the world had ever seen, was about to die. And we all knew it. It was inevitable.

Now what makes the fate of the Amiga home computer even more sad, is that while the hardware and poor decision-making was ultimately what held it back, the software that made up the Amiga system was still very much ahead of the competition. We have to remember that even a year head-start in computing represents a massive advantage; To make it short: the operative system was just to good to let die out.

amiga (1)

Aros, The Amiga OS re-incarnated. Looks awesome!

An example of that is this: back in december 2014 I read that Apple had finally implemented full support for ReXX scripting in their OS. I had to smile because ReXX (or AREXX) was an integral part of Amiga OS over 20 years ago. And that’s just the tip of the iceberg. The Amiga had a full multi-tasking desktop decades before Microsoft could even get their mouse-pointer to stop flickering. So the Amiga really was an awesome system.

Where does Aeros fit into all this? Well back in the early 90’s a groups of Amiga users got together and tried to figure out how to save the operative system. The Amiga brand and intellectual property was being abused by non-other than its originators and investors, to the point of ridicule I might add. The brand name itself had been sold around so much that no serious investor would ever again touch it.

Amazingly, with no help from Commodore or the Amiga copyright holders, this team of passionate Amiga users decided to take matters into their own hands. Amiga Inc. could not be trusted, and as such they began to reverse engineer the whole bloody thing from scratch. Thats right – they decided to dedicate roughly 2 decades of their lives to saving an operative system. You know, people say we dont make computers like we used to? That is true. But no brand in the world, not even Apple, has followers this loyal (or fanatical, take your pick) as the Amiga.

Their goal? To reverse-engineer the Amiga operative system and get it working on x86 hardware.

The Raspberry PI

Fast forward nearly 20 years and a small british company releases what must be the cutest little computer you will ever see: the raspberry PI. It’s not very powerful, not much to look at, but it delivers enough juice to handle DIY projects, the odd Linux experiments – or your ultimate homebrew retro gaming platform.

But compared to the Amiga it at least 100 times faster. The ram alone is 1000 times what the Amiga had to play with, and if someone started to write an OS purely for RPI with the same attention to detail and efficiency as the Amiga, it would deliver a user experience en-par with a “fast” x86 PC today.

What the PI suffers from is that Linux, which is the only real desktop OS that runs on ARM processors (excluding QNX and Android) has grown rather heavy over the years. It’s become a fat, sluggish bastard to be more precise. It used to be that Linux could fit on a single floppy disk, but those days are gone and a modern ditribution is right up there with Windows and OS X. Weighing in at around four or six gigabytes.

Aeros

Kids today have no idea how efficient and fast the Amiga really was

Several flavours of Linux exists for the Raspberry PI, but no matter how slim or trim they pretend to be, they are ultimately to much for the little computer. Linux is just to complex and bloated, which is the sad fact of age and “one size fits all” mentality amongst the developers.

What we really need is an operative system written with the same philosophy like we did back in the 16-bit days; back when every byte counted. One that is powerful, offers silky smooth multi-tasking, a decent desktop environment, networking, a well stocked software library – and that is easy to use.

And this is where my interest in Aeros comes into play, because Aeros is the ARM version of Aros, the re-implementation of Amiga OS!

We have to remember that the original Amiga OS was designed to operate with only 512 kb of ram. Thats right, half a megabyte! And absurd as it sounds, with that half a megabyte it managed to run rings around microsoft for a whole decade. Imagine that. If nothing else, a testament to the ingenuity of its architects.

But why would this be interesting, I hear you say? Why go for a weid, esoteric (by modern standards) and outdated operative system when you can install Ubuntu or Debian Jessie?

I can give you several reasons:

  • Speed. Aros is exceedingly smaller and faster than any Linux window manager
  • Memory efficiency. Aros thrives with just 1 megabytes on a 68k Amiga machine; Imagine what code like that can do with 1000 times the memory!
  • Emulation. Aros supports 68k applications directly via built-in UAE emulation
  • Software. Nearly 30 years of software to enjoy. Also plenty of modern ports from Linux, like The Gimp, Open Office, Free Pascal, Webkit browser (to much to list here)
  • Simplicity. Amiga OS is simple to use, like all brilliant things in life.
  • Nostalgia. Amiga is a part of my history. It holds great value to me personally.

Well, today I decided to take the plunge! So I visited Ares’s website and paid for the premium Raspberry PI Aeros download. My first Amiga related purchase in.. at least over 20 years!

 What do I expect?

As I type this the Win32 Disk Imager application is burning the Aeros disk image to a 16 gigabyte SD card. What do I expect of AEROS? Not that much, all things considered.

I presume that paying 20 Euro gives me access to the premium build, which from what I understand is the native, non hosted version. Aeros has shipped with a purely linux driven foundation for quite some time; understandably ofcourse since that saves the authors the hazzle of having to write a ton of drivers — but the downside is that .. well, unless you are running full-screen without a window-manager, rendering directly to the framebuffer or the X viewport — you are neither an Amiga or a Linux box.

If Aeros is going to continue floating on Linux for foundation support, then at least follow Apple’s example and hide it well. My advice would be to have a special shell window, LShell, somewhere in the utillities folder. Starting that opens up a linux shell – giving you access. Linux should never show itself in the file-system, in the UI or any other part of the Amiga experience.

But what I expect is the following:

  • Being able to run 68k software directly (built-in emulation layer)
  • Enjoy a desktop looking like OS 4 (or some other Amiga’ish theme)
  • Enjoy hardware bashing games through UAE4All2 compiled for Raspberry PI2

And last but not least, I expect the distro to come loaded with the very best of ported and 68k programs. From BlitzBasic II and Amos basic, straight up to Deluxe Paint (or something similar).

So this is Aeros

First impression is important. And immediately on booting the Aeros disk image I was struck by something I did not expect: I was greeted by a fancy 3d animated logo of sorts, which morphed into a text advertising at the end. Wow, that was fancy I thought!

I should mention that this animation is persistent, meaning that you have to see it again, and again, and again (ad naseum). So I sincerly hope the author of Aeros either make an option for this in preferences, or write”true” to a file when it’s been shown – so we dont have to see it again. Things like that quickly get on your nerves.

Within seconds I was greeted by the Aeros desktop, and I must admit — i just went “wow!”. I have never seen an operative system boot up that fast since my Amiga 1200 all those years ago; and the warmth of the desktop color and Amiga like features brought me straight back to my teens. Hacking away at kuma seka assembler and blitzbasic 🙂

Some icons immediately cought my eye, and that was Skype and  Spotify. Thats odd I thought, those are not Linux. And absolutely not ARM Linux. I also noticed DOS Box, WinUAE and the more appropriate Uae4All2, which is a special build for Raspberry PI 2, taking advantage of the different cpu instructions and faster GPU (hardware accelerated graphics).

12400603_10153259775530906_3535886985993446158_n

Downloading FPC while playing a spot of Scumm VM 🙂

But the weird thing was that nothing happened when i double-clicked them. Actually, very little happened when i clicked a lot of those “odd” icons, the programs that just didnt belong on Linux — let alone an Amiga based operative system!

It was then that i remembered the e-mail I got, which said something about unlocking something. I had presumed it was for the product, the native Aeros product — but now I started to catch on. So i registered the product as the letter said, and voila – now i could start these alien programs!

Turns out the Aeros doesnt just come with UAE and 68k emulation built in, it also comes with x86 emulation (!). I must admit that for me, personally, this is completely useless. First of all the Raspberry PI is not powerful enough to run software at a reasonable speed; secondly, the whole setup began to annoy me: I had paid for Aros. I wanted the Amiga experience. Not the Linux experience, and absolutely not the Windows experience.

No choice

As I began to investigate the system I noticed that the theme for the windows were, well how shall i put it, abhorrent? Sort of grey, stripey — not at all what I expected or wanted. But thats ok — I’ll just pop into preferences and change that straight away.

But sadly that was not an option. There simply were no themes to be changed. You could neither change the default background image. An image which to me is childish and counterproductive (the sadist amiga cat whipping a smiling tux? Seriously?). One of my primary goals here is to introduce Aros in schools, teaching kids to program. And a picture like this is not going to fly at all. It creates the completely opposite image of Aros than I believe the author intended.

I dont care about the cat stuff, but it’s just a stupid picture. Nice work, but the image doesnt belong in an OS you want to sell or promote.

222_1_snap

I expected something like this by default, as the very least on offer

Ok. So i cant change the background or the theme. That is odd. In fact while fidling around with the MUI preferences, the whole thing crashed. Twice. Which was annoying to say the least.

High-Contrast

Then came the Linux part, and here the visual theme was set to “high-contrast”, which means bright white on black, with bold fonts and stamped glyphs. Horrible theme.

I did the same thing there, went into “appearance” on the Linux menu, the dialog showing various themes comes up — pick another theme, but nothing changes. It’s bolted shut to high-contrast come hell or high water.

I’m sorry but this is driving me mad. I love the speed and the technical achievements, but not being able to change even the smallest thing — and the bugs? This needs more work. And it deserves it because the project is just what we need!

My verdict

Being a programmer myself I know how “work in progress” can be. And when you are knee deep in x86 emulation, or getting 68k applications to run side-by-side with ARM applications — things like backdrop images, theming and preferences requesters can seem trivial.

But they are not. In this case they represent the ability to actually use and enjoy a product i have paid money for. And it is a product after all. And in all honesty, this is not something I can present to the school board, because its not stable enough, it ignores preferences completely – and it crashes if you fiddle around with prefs to much (read: click to many odd buttons).

I was also very disappointed by the distribution itself. It comes with no 68k software what so ever. Not even BlitzBasic on a coverdisk — or freepascal, which has been ported to Aros and these days runs natively. Thousands of applications has been written in FPC or Delphi for Windows and OS X; It makes sense for Aeros/Aros to come bundled with FPC and Lazarus (ide) to help inspire people to port over their work to Aros. Sadly that is not the case at all.

Now before you think everything is bad — I am paradoxically very excited about this project. Lets look at what the programmer has achieved here. It is by far the fastest desktop i have tried since a real amiga machine ages ago. It uses a fraction of the resources any other OS, Linux or otherwise, demands. Its responsive, and overwhelmingly enough allows you to execute x86, 68k and ARM code. Not exactly a walk in the park!

But to be honest it feels like it’s been standing still for a while. The impression I get is that this is just a pet project, and the programmer havent touched it since last summer or so. Which, if true, is really, really sad- because this system has so much potential.

For the first time in all those years, I feelt like I had a real Amiga again. I completely forgot that this was running on $35 hardware; Hardware that has weaker performance than my iPhone (!). Imagine that. Yet with Aeros, you would think you used a normal PC.

If you expect me to warn you away from this project, then I will actually do the opposite. The only way this project will be completed, is if more people buy, send questions and wait for updates. So I would urge everyone to get this. Its cheap (costing a symbolical 20€) and it helps keep this project alive.

This is one project we really want to see, because it turns your Raspberry PI2 into a real computer. A computer you can use. Something non of the Linux distros can even come close to.

As for verdict: I give this 2 stars out of 6. I would have given it 4 stars had the preferences bugs not been there and everything worked as expected. I would further have given it 5 stars if it was polished and came with a good selection of 68k applications.

A system well worth watching!

 

 

JS date time under Delphi?

January 1, 2016 Leave a comment

I got an interesting question from a Smart Mobile Studio user that I feel should be adressed. Namely that of date-time conversion between Delphi and Smart Mobile Studio applications.

Our user has a Delphi back-end server written with Remobjects SDK, and part of the data exchange between the server and HTML5 client includes TDateTime fields. The TDateTime values work fine in Smart pascal, but generates the wrong date and time when used with a native JavaScript framework.

Different formats

To answer his question: that is to be expected! We have gone to great lengths to make Smart Mobile Studio support and handle date and time in Delphi compatible format. So when writing vanilla Smart Pascal code, the compiler and RTL makes sure the format is identical to Delphi.

108-37-date-format-with-javascript

The default date-time encoding used by JavaScript is very different from Delph and C++ builder. JavaScript actually uses the amount of milliseconds since 01.01.1970 at 00:00:00 o’clock.

So, to generate a JavaScript compatible date value, you can do this:

uses
  dateutils;

function TForm1.GetJSDateTime:Double;
begin
  result := MilliSecondsBetween(now,
  EncodeDateTime(1970,01,01,0,0,0,0));
end;

The same code compiles under Smart Mobile Studio, except there the unit is named “system.dateutils”. But the result is the same.

To convert from JS format back to Delphi, have a look at the W3C.Date and System.Date units. You should find all the conversion and extraction functions you need (and then some).

 

  JDate = class external 'Date'
    constructor Create; overload;
    constructor Create(milliseconds : Integer); overload;
    constructor Create(dateString : String); overload;
    constructor Create(year, month, day : Integer); overload;
    constructor Create(year, month, day, hour, minute, second, msec : Integer); overload;

    class method now : Integer;
    class method parse(dateString : String) : Integer;
    class method UTC(year, month, day : Integer) : Integer; overload;
    class method UTC(year, month, day, hour, minute, second, msec : Integer) : Integer; overload;

    function getDate : Integer;
    function getDay : Integer;
    function getFullYear : Integer;
    function getHours : Integer;
    function getMilliseconds : Integer;
    function getMinutes : Integer;
    function getMonth : Integer;
    function getSeconds : Integer;

    function getTime : Integer;
    function getTimezoneOffset : Integer;

    function getUTCDate : Integer;
    function getUTCDay : Integer;
    function getUTCFullYear : Integer;
    function getUTCHours : Integer;
    function getUTCMilliseconds : Integer;
    function getUTCMinutes : Integer;
    function getUTCMonth : Integer;
    function getUTCSeconds : Integer;

    procedure setDate(v : Integer);
    procedure setFullYear(v : Integer);
    procedure setHours(v : Integer);
    procedure setMilliseconds(v : Integer);
    procedure setMinutes(v : Integer);
    procedure setMonth(v : Integer);
    procedure setSeconds(v : Integer);

    procedure setTime(v : Float);

    procedure setUTCDate(v : Integer);
    procedure setUTCFullYear(v : Integer);
    procedure setUTCHours(v : Integer);
    procedure setUTCMilliseconds(v : Integer);
    procedure setUTCMinutes(v : Integer);
    procedure setUTCMonth(v : Integer);
    procedure setUTCSeconds(v : Integer);

    function toDateString : String;
    function toISOString : String;
    function toLocaleDateString : String;
    function toLocaleString : String;
    function toString : String;
    function toTimeString : String;
    function toUTCString : String;
  end;