Archives by ALB42

BinShifter 1.0

Posted by ALB42 on 15. Oktober 2015No Comments

I played a while ago a funny tiny game on my phone called 2048, really easy concept but makes fun to play. So I wrote an own game for AROS which is inspired by it really easy and nice to program.
Its called BinShifter Bin because of Binary numbers which results from it and shifter because you have to shift the blocks around. With the arrow buttons or cursor keys you shift all blocks to one
direction. If two blocks with the same number are stacked in this direction they are added together and you earn points. The maximum number for one block is 4096 (like the numbers of colors
of the original Amiga ;-)). The game ends when no movement is possible.

BinShifter 1.0 i386-aros

Bin Shifter 1.0

Bin Shifter 1.0

sqlite64 Library

Posted by ALB42 on 12. Oktober 2015One Comment

Good news, the Libraries I created are also compilable at AROS x64, so this learns us two things. First it also works on 64Bit (also with 64Bit freepascal) and Second it also works on ABIv1 (64bit AROS is ABIv1 only). The testlib worked just without any additional actions. sqlite3.library needed some work, seems some C Linklibs are changed so the Makefile libs had to change a lot. The compilation worked well then, but the example program crashed. Seems it always crash when it tries to convert a float to a string, if I read the double by Hand and use the pascal routine to convert it to string it works without problems. Hmm strange problem, especially because the rest is working without any problems. Because of the previous problems with AROS64… it’s maybe a just a AROS64 bug. so I changed my example source 😛 and now it works perfectly.

Freepascal SQLite3 on AROS64

Freepascal SQLite3 on AROS64

SQLite3 is landing

Posted by ALB42 on 11. Oktober 2015One Comment

Worked a little bit more on the sqlite3.library for AROS to use in freepascal. Its more or less only diligent working, and take care not to mix up anything. I didn’t include all the functions only the most important until now (at least what I think is most important) until now its already 106 functions inside the library.

Now I tried some test codes… the one from fpc directly are rather boring, even less impressive than my own examplecode.
But I found a german Tutorial how to use databases in Lazarus, with some tiny changes in in Lazarus component it compiles really nicely and works as expected.

SQLite3 freepascal example program

SQLite3 freepascal example program

Left side Linux, Right side AROS.

C Linklibs to Libraries

Posted by ALB42 on 5. Oktober 20154 Comments

Currently we are only able to use the shared AROS .libraries, so every C link lib is not available in freepascal for AROS. For example sqlite3, SDL, GLUT, SSL and and and much things only available as c linklibs.
I tried once long time before to use the c link libs directly but failed because of the „auto library init“ needed by them.

But of course the other way round, maybe would be possible to specially create a library in C which can be used in freepascal later. I’m not very good in C neither in Makefile magic but hey worth a try. First the official documentation is just crap, not existing (many 404 there, seems someone deleted/moved the documentation) or very old (already written in there that it will change in 2006 and the docu gets not updated) and what I found is just a documentation about how to create a library inside the AROS core build process. I don’t want to compile the complete AROS just to get my Library compiled. Shit, luckily I found an other library which had the same problem and which also come with the source (which is rather seldom on Amiga-style systems, but on AROS more common, but there not so many 3rd party libraries available, one I found)
With this it was rather easy to create a own custom build library with a simple function inside.
The next step was to include sqlite3 to the library. I decided for sqlite3 because its the easiest to check for success and even with some functions its already useful. The task sounded easy but exactly there the problems started, as always.

Again the „compiler magic“ autoinit killed me many times. Finally I found out that I can invoke this autoinit from my initialization by hand. And finally it worked.
This is now a single instance library, a pertask library would make more sense but I didn’t find out how to change that behavior (just to change a flag in the libinit structure was maybe too easy for the designer of this system). But for sqlite3 its not a big problem, it mostly work on a db which have to be opened and closed before using and then always must be supplied to the library. There are some calls which are not threadsafe like sqlite3_config or so but they could be protected via a mutex later. So for now not a big problem, maybe later I find a way to switch to pertask behavior.

The library includes now: sqlite3_open(), sqlite3_close(), sqlite3_free(), sqlite3_exec(). Which is enough to create a database, create a table, add some data and make some selections + output which I tested with a tiny pascal program.

The make process is not complete done and understood by me, there I have some more work to do and then one could begin to include all the sqlite3 functions to the library and make some more tests and of course write a pascal wrapper unit 😉

The long term idea would be also again to check how one could use the link libs directly in freepascal, when creating the c library I got much more knowledge how this autoinit things are working, maybe one could copy this to freepascal.

Lazarus crosscompile

Posted by ALB42 on 4. Juli 2015One Comment

I took a very old laptop and installed a new ubuntu (its really bad with only 1GB RAM) and tried to install freepascal with AROS crosscompiler and also crosscompile to AROS. Just to see which steps are needed. Then I also installed lazarus from source (my source from github) hmm seems I destroyed some things for other platforms and again chose a bad point for my branch. It can not create any lfm files, so no new projects/forms possible, I got this message at AROS but I thought its some problem there. So bad seems I have to update my lazarus branch again, always so much trouble. But besides this I got the lazarus GUI to crosscompile AROS lcl programs, and even run them inside AROS, should be much easier coding (for edisyn for example ;-))

AROS x64 is working, also with GUI

Posted by ALB42 on 29. Juni 2015No Comments

Charlie implemented most of the x64 AROS support to freepascal trunk, most important the syscall. Hence I can use the library units I have already for i386. Of course at first try it just crashes. The reason seems to be that some library calls are not implemented, like Error() in dos.library or CreateRastPort() in intuition, strange I remember at ABIv0 it was written one should use CrateRastPort() instead of self get the memory and initialize… and now its not working anymore. Should be not a big task to alloc mem and call init in such a call? What is the reason of removing such call. Same for Error, it usually just give you the pr_CER of your process so why it can’t do that?

AROS64GUITests

Nevertheless a little bit GUI is working (after dealing with the CreateRastPort/FreeRastPort stuff). The tiny Hello world window on the top right side is the MUITest example I ship with the fpc i386, same for Windowtest which uses intuition and gadtools to oppen window and show a button. the other two demos are fpgui examples.

MorphOS MUI is strange

Posted by ALB42 on 27. Juni 201511 Comments

Playing around with the LCL for MorphOS, seems to work nicely, but (as described last time already) it crashes on Exit. I tried to find the reason for it. It seems that that the MUI Objects are kind of destroyed already, even still visible on the screen. Due to the special way to work in LCL I do not like the automatic destroy function of MUI. If you build up a mui application with application, window, items in there you usually only need to destroy the application and every thing else will just be automatically destroyed. Of course thats not what we want to use for LCL (or it would be impossible to destroy single button/Windows and so on). Long time before at AROS I played around with it and the best solution is to just unlink the item from its parent and destroy it by hand (MUI_DisposeObject) because then it is always in my full control when an object gets destroyed or alive.
Seems thats exactly my problem now. When I begin to destroy my objects at some point it seems that the MUI Objects are already destroyed, so it crashes, but this object (window) is still visible on the screen. I removed all MUI_DisposeObject from my code and still the Window gets destroyed somehow :-O and the mui objects are invalid. Here happens something I do not understand. Really strange thing, maybe its some special „new MUI Version“-thing? I don’t know and not really an idea how to continue here. Maybe I need to write a simple non-LCL program where I do the same and try to find out this strange behaviour.

… or maybe not

Posted by ALB42 on 27. Juni 2015No Comments

For sure 64-bit is the future but the current AROS 64bit is just crap. Most programs or even prefs just crash, networking is not working (same settings as in the i386 version), no sound (just stays quiet, even there is a soundcard detected), not possible to change the Workbench and Drawer background (the prefs program crash), even some of the demo apps does not work as expected or just crash. And so it goes on … if really someone wants to make a x64 AROS distribution, this will be a lot of work. I guess the most difficult part will be to convince the AROS-devs to fix this bugs, because this bugs are not new… the last nightly I tried was in April (and an other one in January) 2015 and all had the same problems, no improvement at all.