Archives for Coding

FPC MorphOS LCL Release

Posted by ALB42 on 6. März 2016One Comment

This weekend I changed a lot in the Freepascal packages for MorphOS and Amiga. For both moved the OpenLibrary and CloseLibrary to Initialization Section and Finalization Section. This bug was the reason LCL programs always crashed on Exit on both platforms. Because this bug is now removed it worth to setup a nightly compilation of the LCL for both MorphOS and Amiga and include it into the nightly experimental Releases. At First I cared about MorphOS sadly I had to deactivate the „vlink“ as linker it seems to have problems with resources. But besides this its working fine.

 

So from now on Freepascal 3.1 including the latest LCL compilation can be always found at:

FPC – experimental Releases Packages

 

Freepascal MorphOS with LCL

Freepascal MorphOS with LCL

 

Unarchive the file, there is a folder pp with icon inside, place it where ever our want, make an assign Freepascal: to this pp folder. Add the binary folder to path: „path add Freepascal:bin/powerpc-morphos“.
Navigate to your sources and compile your program with „fpc sourcename.pas“ or if it is a Lazarus (LCL) source with „fpc projectname.lpr“. Examples for Lazarus sources usable with this LCL implementation you can find in fpc-tests/lcl.

Spying on MUI

Posted by ALB42 on 20. Februar 20166 Comments

I wrote a program to Inspect MUI properties. Very helpful to read out positions and recheck the size calculations of LCL. The main problem at the start was how to tell the program which object I want to inspect. The idea was to type the address from debugout. But then I noticed that the Userdata of the intuition Window structure points to the MUI Window.mui object. Thats means I can simply browse through all the windows on the screen and search for windows with a Userdata and try to find if it is a MUI object. Check if the Class of the object is „window.mui“. I tested also with other UserData contents, „mostly“ it does not crash.
 
But this only works on AROS, I tried the same on MorphOS but there the UserData is always nil. Seems they use an other method to link them together, its a pity.

The program for i386-AROS is named MUIInspector and can be downloaded here:
 
MUIInspector 1.0 for AROS
 
MUIInspector
 
Sadly many important fields of the MUI object are not readable so not all important things can be read back to the list.
 
Be warned, when the program which is inspected is quickly changing, means destroy/create objects, maybe the MUIInspector is crashing. So its really only a debugging tool for me, but maybe other find it interresting as well

Applications for MorphOS

Posted by ALB42 on 3. Februar 20164 Comments

With this new fixed LCL for MorphOS I recompiled some of my AROS LCL Programs for MorphOS. THis time I striped them and packed the program with lzmaloader to make the executable smaller. So here they are:

 

  • ColorIt – Game – Flood the field with the same Color
  • FPCMines – Game – Minesweeper clone
  • BinShifter – Game – 2048 clone
  • PasteQuick – Application – Copy Clipboard contents to Pastebin.com and receive the link in Clipboard

Some MorphOS applications

Faster Morphing

Posted by ALB42 on 3. Februar 20162 Comments

I tried to find the origin of the slowness for buffered drawing at MorphOS and it seems I found a clue. I allocated my Bitmaps always without BMF_DISPLAYABLE and this seems to be the Origin of the stuttering mouse and speed problems, now I changed all AllocBitmaps to use this flag and all it fast, especially the Bootup is now fast as I would expect. Seems my Drawing routine needs a little bit more work and thinking. At least its fast now and the color problems are also gone.

EdiMorphSyn

Posted by ALB42 on 2. Februar 20163 Comments

EdiSyn on MorphOS, at least it does not crash anymore, but it need long time to start and the SynEdit does not show anything, Menu also does not work, hmm strange.
EdiSyn @ MorphOS

Some more strange things appear, the Edits does not show the contents if the edit cursor is active in it, when one leave the Edit, the test is visible, also the TextEditor and Scrollbars have some strange colors. But it become even more strange: When I start the m68k-amiga version on MorphOS it looks ok to me (also in WinUAE or on a Native Amiga 1200)

Buffered MorphOS Drawing

Posted by ALB42 on 31. Januar 20162 Comments

I noticed something strange in MorphOS LCL, I made a little Painting program in LCL. When the mouse moves over the image and the window is not active it works as expected (coordinate and pixel color) but when clicked into the Painting area or the window is active it becomes very slow and the mouse pointer stops.
I made some tests and noticed the difference is that the main painting region gets repainted and there it becomes slow, but its not the drawing routine self.
 

MorphOS SimplePaint

MorphOS SimplePaint


 

The drawing works at the moment in this (buffered) way:

  • MUIM_Draw – Event appears
  • MUI_AddClipping – set a Clipping
  • Create a new Buffer RastPort
  • Create a Bitmap (AllocBitmap) for the Buffer Rastport, with width and height of the drawing area, Depth from the MUI rastport (from Renderinfo), BMF_MINPLANES or BMF_CLEAR and the bitmap of the MUI rastports Bitmap as Friend Bitmap
  • ClipBlit of the MUI Rastport to the Buffer Rastport
  • Drawing of the LCL things to the Buffer Rastport
  • ClipBlit of the Buffer Rastport to the MUI RastPort
  • Destroy Buffer Rastport and Bitmap
  • Remove Clipping
  • Leave Draw Event

If I remove the Buffering, so draw directly onto the MUI RastPort it stays fast and the mouse pointer makes no problems. When the program starts this stuttering mouse pointer is maybe related to it also? I noticed also other programs have this stuttering mouse on start (OWB for example). I still have no idea why.

VarArgs Changes

Posted by ALB42 on 24. Januar 2016One Comment

This weekend I did some bigger changes in the AROSUnits for better use of variadic functions in the SDK. The „array of const“ is replaced by „array of PtrUInt“ for all variadic wrappers. Because of this changes all this wrappers can be defined as inline and the arrays does not need to be copied inside the wrapper so it should be a little bit faster (even the effect is not that big I guess).
Also all dependencies to objfpc is removed so if someone want to write a freepascal program without objfpc dependency it should be possible now.
All this changes were discussed here.
But this all means that sources using such variadic functions must be changed, I changed already the fpGUI, LCL and example sources.

We are working together

Posted by ALB42 on 15. November 2015No Comments

I played again a little bit with networking things, especially on different platforms. Very nice that the most sources now compile out of the box at Linux, AROS, Amiga and MorphOS only very little ifdefs inside, and even they could be omitted by extending the Amiga-like-RTLs with some unix functions.

I wrote a little Lyapunov calculation program which sends the pixels to calculate via network to other computers to let them calculate. Lyapunov is very good for such things because it has very little inputs and results but rather long calculation time per point.

I compiled and run the client for all platforms I have available currently:

  • i386-AROS (Linux Hosted – AMD FX 8120)
  • powerpc-MorphOS (Mac Mini)
  • m68k-amiga (Amiga1200 68060/50)
  • x86_64-linux (AMD FX 8120)
  • i386-linux (Intel Atom 230)
  • arm-linux (Raspberry pie 1)

All compiled from the same source.
The Server and Image Viewing is done at AROS.
The power of Freepascal/Lazarus at its very best.

The white pixels are already send to some client but the result is not arrived.

The image is flickering a little bit (therefore in the movie sometimes no image to see) because I didn’t care much about the image plotting. I’m not sure why the image is flickering maybe the network communication take too much time so not enough time to draw the image.

HexEdit 0.2

Posted by ALB42 on 22. Oktober 2015No Comments

The Hex Editor slowly gets into shape. Most important function, editing and Value showing. The Value is automatically showed in different types (as Byte, Word, LongWord, QWord) and even more important both endian styles(Big / Little). Later will insert also a function to insert a value as the combined types in both endian styles. For now I only need it for small files, so I load the complete file to RAM and then show it. Later maybe I make a viewer version for very big files, which work directly on Harddisk. But at the moment its not needed.

HexEdit 0.2

HexEdit 0.2

HexEdit 0.2

HexEdit 0.1

Posted by ALB42 on 20. Oktober 2015No Comments

At the moment I need a HexViewer and sometimes also a HexEditor but even at Linux I’m not very satisfied with the functions with the available HexEditors. So I decided to write my own, of course I write it for Linux/Windows (there I need it) but now I always care about that it will also work for AROS. So I compiled it for AROS as well and it worked without any additional actions. At the moment its just a HexViewer. (use cursor keys for move the cursor, page up down to scroll a page, home and end jump to start/end, Tab change binary part to char part)
But I need Editing, search and replace and jump to special positions.

HexEdit 0.1

HexEdit 0.1

HexEdit 0.1