Archives for Compiler Core

m68k broken again.

Posted by ALB42 on 28. Oktober 20162 Comments

It seems the m68k amiga freepascal compiler is broken again. A Simple Hello world program compiled on an Amiga works but when a uses is in the source file the compilation stops with “Fatal: Internal error 201309171”. It happens rather often that the m68k compilation breaks, and it needs always long time to notice it, because I use cross compiling most of the time. (even in UAE native compilation is rather slow). To get faster informed about such things I added a test to my automatic compile server. An E-UAE Amiga with Workbench 3.1 is started and the last compiler is used to compile the example programs. Two of them are also executed (HelloWorld and GenerateMD5, maybe later I write some special testcases). I didn’t have time until now to find out whats the problem, but I hope Charlie can fix that soon.

Back to Workbench 1.3

Posted by ALB42 on 24. Oktober 2016One Comment

Chain-Q added support for 68000 to freepascal compiler. It needs special care because it has some additional alignment need on read/write to structures. But to try it on a 68000 Amiga it should be also Workbench 1.3. the current RTL implementation needs at least 3.0. It was rather easy to create a RTL which also works on 1.3 (via defines) but also the init code (written in assembler) must be changed. I have to find out how to make defines inside Then it could be even added to the official repository. I wrote a little testprogram to test the RTL and make some basic alignment tests. Both works well now.
FreePascal program on Workbench 1.3

FreePascal compiler on Workbench 1.3

FP-IDE for AmigaOS4

Posted by ALB42 on 30. April 2016One Comment

Reached the state of AmigaOS4 compiling and running the FP-IDE 😉 This was the aim of this implementation run, so its proven the library units are there and working the rest will be just work. For LCL at least MUI have to be implemented, but when I see how slow the FP-IDE is already in WinUAE I really do not want to try LCL.


I will clean up everything and commit to freepascal repository and make a release archive.

Amiga Freepascal Release with LCL

Posted by ALB42 on 9. April 20164 Comments

I just waited for this fix to make a Release of Freepascal 3.1.1 for m68k-amiga with the new Lazarus component Library. Of course its still early alpha state but it is somewhat usable.
Check FPC Amiga Page for the download.
Of course this archive does work on m68k AROS also. (It does not include FPGui for now)
Be warned: LCL is still is very early alpha stage, so expect crashes. It aims on fast RTG Amigas or even better RTG-UAE, but some simple programs also work on AGA/ECS Screens.
Notice: you need at least 180 MB of free RAM to compile a LCL program

About this year … 2015

Posted by ALB42 on 31. Dezember 2015One Comment

This year freepascal got a big advance on many levels, in general with the freepascal 3.0 and for the Amiga-style systems also. Even more advances on the LCL/Lazarus topic on Amiga, AROS and MorphOS.


It began in 2014 already, when I restarted the MUI LCL implementation for AROS. Begin of 2015 I cared more about some applications to test the implementation especially the owner drawn things. So I wrote ColorIt and FPCMines for AROS and tried to write or port some little apps and some more.


A milestone reached in march 2015 when I got the SynEdit component to work. The little test program I used to play around with the needed changes in LCL grew on requests from the AROS community to a full usable Editor, which got the name Edisyn. By improving the editor many additional features are included into LCL, like key events, advanced mouse events, tabs, scrollbars, colors and much more.


With all this improvements I felt ready to give the lazarus ide another try and finally at least it starts. So we are on a good way to bring lazarus natively to work on AROS.


But how about the other platforms (AmigaOS and MorphOS)? I did already some changes in the code with the other platforms in mind. When the resource support was enabled in freepascal I took the opportunity to try to port the LCL for MorphOS and m68k AmigaOS. Which somewhat worked but not in the same way as in AROS especially the layout did not work and the program always crashed on the end. But it gave me much insight how MUI is working also for AROS Zune which is a little bit more error tolerant than the original MUI.


Also on the freepascal front some new things appeared, the support for x86_64 AROS was included, but sadly because of the ABI difference the port is still not finish and unusable. I’m waiting for the ABI switching feature in freepascal. The implementation is done just I need the decision to do it in the proposed way.


In October I did something unusual for me, I did C coding for AROS, trying to code a dynamic Amiga-style Library (in this case sql) to use it in freepascal AROS. But later I found out this wrapper library is not needed and I can directly use the C linklibs as they are.


At the end of the year I took more work again on the MorphOS and m68k Amiga LCL and finally got it to work. So the first LCL programs can be compiled for MorphOS and m68k Amiga.


What 2016 will bring

I hope I can join the two LCL implementations (AROS on the one side and MorphOS and Amiga on the other) together again. Bring the MorphOS port to the same level as AROS, that maybe Edisyn will work. The next logical step would be to continue on lazarus ide and try to make it somewhat usable.


Posted by ALB42 on 20. Dezember 2015No Comments

Finally I found the reason for the strange crashes on Amiga and MorphOS on destroy of LCL apps. And now I also understand why it was so difficult to find it. It was … drum roll … not in my code :-O. It’s in the library units of MorphOS and Amiga. Little bit about the basics. On AROS I open the Library (belongs to a unit) inside the initialization section and close it again in the finalization section. I’m used to this behavior from windows DLLs. At Amiga and MorphOS a different way is used. The OpenLibrary is done in the initialization section (for Amiga) or must be done manually (MorphOS). On this OpenLibrary call the ExitProc of the unit is connected to a CloseLibrary routine. So far sounds good, but it seems the problem is that the ExitProc is called BEFORE the finalization of the unit, long time before as it seems, hence the muimaster.library is already closed when I try to destroy my MUI Objects which horrible crashed.
I placed some Debug output in the InitMuiMasterLibrary and CloseMuiMasterLibrary and can clearly see that the CloseMuiMasterLibrary happen before my LCL destroy things are called. I will play around a little bit with it. But in the end I have to talk with Charlie (Maintainer of FPC-MorphOS) about this, how to solve this problem.
This explain also other crashes I experienced before (like the crash of CloseFont for example)

Freepascal 3.0 release

Posted by ALB42 on 3. Dezember 20152 Comments

As you might notice the freepascal 3.0 stable release is out. This is the first stable release includes AROS as a “fully supported target“. I created a binary release of this 3.0.1 stable freepascal for i386-aros. It only includes the compiler, FP-IDE and freepascal packages: RTL, FCL and AROS library units. (So no FPGUI, LCL and so on) It’s mainly needed to compile the trunk version as starting compiler. For real life coding the trunk version is a much better choice, because it has some more bufixes and new functions inside. The binary archive can be downloaded at the FPC-AROS Page.

Binary stable releases for Amiga and MorphOS will be created by ChainQ I guess.

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?


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.

64 Bit is the future

Posted by ALB42 on 26. Juni 2015One Comment

A long time ago I played around with x64 AROS already. Of course I would like to freepascal on it as well. Even on the first implementations of freepascal fr AROS i386 I already enabled and included basics for x64 AROS but I never got it to work, because my freepascal branch didn’t compile for x64 because it was at some broken state. Now at the trunk of course it will work again. In April 2015 I tried again and reached very fast the point to write the assembler startupcode. The same problem as before (with i386) no idea how it should look like. I looked a little bit around (also into the other startupcodes of other x64 fpc platforms, linux mostly) and took a shot. Sadly it didn’t work it always told me “bad load hunk”. So from time to time I looked into when I have only little time (not enough time to do anything useful at LCL) but I didn’t get any idea. Yesterday evening (already in bed just before sleep) I got an idea, and today evening I tried it very shortly and it gives not an error message but crash. YEAH! Never so happy about a crash. But why it crashs? ABIv1 problems? The Stacktrace tells me it crashes inside dos.library/Error with an _aros_not_implemented_ error :-O. This call gets the Error Output filehandle, seems still does not exists on x64 AROS. Easy solution comment out and use the Output stream as Error stream like Amiga and MorphOS do.
And finally it is working 😉


Of course its only a very bad hacked version currently and no ABIv1 things are done, so the compiler self does not really work (crashes on linker calling). But it shows that it will be possible to make an fpc for x64 AROS. Of course I have to talk to Charlie to check how to make a syscall for x64 (is even easier than i386) and how to make such ABI difference. but it is not really in hurry.