Archives by ALB42

Copy, Move, Delete

Posted by ALB42 on 3. August 2014No Comments

The commander like interface works very nicely already. Already possible Enter Directory(Return) and go one Directory up (Backspace), Copy(F5), Delete(F8) (Files and Directories) and Create(F7) Directories. Move(F6) I left out for now… I have to think about because of short cuts if on the same device could use the System function instead of recursive moving files.
‚+‘ key let you select File with a pattern, ‚-‚ key deselect with a pattern.
Bildschirmfoto vom 2014-08-03 21:38:52
And the whole time I’m developing there was NO CRASH of the Program or AROS. :O I’m really surprised. Seems this wrong focus bug after modal window really helped a lot to bring stability to the program.
But of course there is also shadow.. the Alignment does not Work at all. If I make the Alignment by hand it works perfectly. but if I use Align (alTop, alBottom and so on) it looks VERY wrong… difficult to understand whats wrong there.
Still have no idea how to debug this situation.

New Project

Posted by ALB42 on 2. August 2014No Comments

After the Shift it-game project I switched to a new project I had in mind already long time before.
A two window file explorer, like total commander, midnight commander or so, for aros in fpc or course.

Bildschirmfoto vom 2014-08-02 19:21:14

Yeah I know nobody needs such thing today there are already so many of them out there.
Two reason to start this project:

  1. I’m not really satisfied with the commander like programs at aros, they all missing a good keyboard control. Directory opus is VERY nice, I even use it at Windows, where it has a nice keyboard control. but at aros, it is an ancient version from the old Amiga there the mouse is for sure in the main focus of the programmer. The keybaord control is very difficult, you even have to activate it everytime you have a new window.
  2. the main reason is not really to create a useable program, (if this happen also ok) but is more or less and study object to search for fpgui-AROS or freepascal bugs. There still many inside. I tried with the example programs, but there often it just works.. or the program is already so complex, and not written by me. Its hard to track such bugs in code written by others.

I already found and fixedtwo nasty bugs on handling modal windows, so I think it worth to continue.

Shi(f)t FPU

Posted by ALB42 on 2. August 2014No Comments

I found out whats wrong with my OpenGL Shift-it. There is a Division by zero exception in the gl library, especially on tiny vertextes (like the one on tip of a sphere) or on tiny slices of clipped boxes.
The question was, why it does work in C, but not work in freepascal. because I tried to make a sphere using gluSphere() in C, and it worked perfectly, but in my program it always crashed.
On the Hunt of the source of Exception, I first had to find out which kind of FPU exception/Trap it is. So I wrote my own traphandler and checked the parameters when enter the traphandler, sadly the fpu content was already cleared and the buffer where the content of the FPU registers should be noted was not assigned.
So I took an other way.. and set the FPU exception one by one to masked and checked when the crash disappeared.
I expected bad things with the masked expections on other parts of the calculation. It surprigingly worked VERY nicely. That way I found out, that Division by Zero exception flag mask this crash.
This made me curious and I checked how the setting of standard C programs are in AROS. I made a simple C program which reads out the FPU Control register (which controls the exceptions) and I got a $37F.. this reallly made me laughing loud (my wife must thinking, that I became mad.) becasue that simply mean, all FPU exceptions are masked… means ignored. I also checked my C-OpenGL program, the same. In my Freepascal programs I always find $1372: which means „Invalid Operation“, „Division By Zero“ and „Overflow“ are not masked.
I found out that also at Delphi, they deactivate all FPU exceptions by default if OpenGL is used (in the opengl unit initialization section). Now I’m thinking: one way would be to deactivate FPU exceptions for all FPC programs at AROS (becasue I have no way to catch them), or simply deactivate it for programs using OpenGL (as Delphi is doing).

A nice sidemark: This error only happen for software rendering, if you use hardware rendering it disappears completely. I didn’t know that I can use hardware rendering in linux-hosted mode, a user at aros-exec told me I should try the mesa.library in sys:storage/libs which has hardware support for linux-hosted installations. This indeed is very nice and then the game makes really fun.

The next step for the game would be to include sounds, the password system and some GUI for configuration, but all this things I postponed now. The game is already rather nice, the coding was really fun. And a proof that you really can make nice games/programs for AROS with FPC 😉

Shift it (until it breaks)

Posted by ALB42 on 27. Juli 2014No Comments

This days I played around with the OpenGL functions in AROS. Sadly very buggy… so my dream to port Shift IT GL to aros moved rather far away… but finally I managed to create a Version which does not crash the whole time (but still rather often). But it works… I’m already very satisfied. 40 levels of fun 😉
Download Package:
Shift it GL for i386-aros
Install: unpack the archive to the place you want (Games folder or so) the game comes in an own folder with Icon.

Aim: Remove all colored blocks from the level

How: Equal colored blocks disappear if 2 or more lay next to each other (one side is touching). If you click on a block and if a movement to right or left is possible empty boxes are showed next to block. Click on an empty box to move the block to there. Blocks can not float in free space, but fall down if no other block or level is underneath.

In the upper left edge the statistics are shown: Level number and moves you did. „Best“ shows shortest (known) way to remove all blocks. For hard mode you have to find this optimal solution. (I remember for at least one level there is a even shorter solution than the „Best“ given.)

Bildschirmfoto vom 2014-07-27 20:13:05

Press „r“ to restart a level, „Esc“ to quit program. You can rotate the level just by clicking on the background and move around, a middle mouse click recenters the view.

The ToolTypes of the program supply some additional options: (all possibilities are included disabled via parenthesis).

„HARD“ Hard mode. You must find the best solution with the number of moves denoted in „Best“, if not given Easy mode is enabled, no limit of movements

„CHEAT“ Cheat mode. do not use it! haha just a joke!  I didn’t include the password system, so its the only way to go to a specific level after closing the program, (not have to play all the levels again, which would be very frustrating, especially when if the program crashed and THIS WILL HAPPEN!) press n to jump to next level.

„STARTLEVEL=x“ replace the „x“ by a number 1-40 to jump directly to this level, only available if „CHEAT“ is also set

„SAFE“ = Safe mode, deactiave all block animation and view changes -> much faster.

„HIDEBG“ = Hide background (no gradient in back, just white), much faster for software rendering machines

„SHOWFPS“ = Show fps of last frame, and average over last 10 frames. Should be only for testing, because usually the pciture is only drawn when needed, if this option is activated its drawn by timer, so this option generates much higher load.

 

Fresh on Sock(et)s

Posted by ALB42 on 12. Juli 2014No Comments

New Version of Freepascal is available:

– Sockets, fcl-net (SSockets, resolve unit)
– IncludeTrailingPathDelimiter repaired to NOT c: -> C:\ (fpgui requester works better now)
– AllFilesmask changed to ‚#?‘ (its the normal Amiga-style mask) but PathConv/FindFirst support ‚*‘ and ‚#?‘ also.

if you want to try out sockets.. look into packages/fcl-base/examples/isocksrv.pp and isockcli.pp

maybe I will copy them to examples next time.

Intuition finished!

Posted by ALB42 on 20. November 2013No Comments

After very long time finally finished the Intuition unit including all macros, varargs Versions and documentation, this was really hard work, and I was very busy the last month.
So today there is a release of the newest FPC for AROS with completed Intuition.
As next I will clean the code a little bit and try to update the official SVN.

A source snapshot is included this time. Finished Intuition is a good state I think to make a source release.

Besides this I released the raw XMLs needed to created the HTML/CHM developer documentation for the included aros specific Units.

Releases can be found at FPC AROS Page.

Freepascal Threading

Posted by ALB42 on 22. September 2013No Comments

A new Release of FPC for AROS is out today.
The only new thing is:

* Support for Threads (using TThread class)

Thanks to Mag, he supplied some example codes and the library wrapper unit in the FPC-AROS Wiki.
So my interrest was awaked and I need a little break from the boring basic library rewriting and documentary work.

Implemented id the TThread Class and the Critical sections functionality, „TEvents“ are still not supported as long I dont know exactly how they are working, it seems its not directly possible to do such thing in AROS, maybe must self write a mechanism for it.

AROS Threads (with thread.library) have no chance to suspend/kill from outside and so on.
The suspend I managed with a Mutex Condition, wich can be fired with a „resume“, but this makes it impossible to Suspend the Thread from outside. But this is not allowed at some other platforms as well, Resume and Suspend are even marked as deprecated in newer Delphi/Freepascal versions.
I known a nice replacement for Suspend is the TEvent feature which is still not available for aros… but I’m working on this until this the suspend inside the thread and resume from outside must do it.

An example for the us of threads with suspend resume and critical sections can be found in pp/fp/src/threadtest.pas inside the archive

New Release (rewritten basic units Part 1)

Posted by ALB42 on 16. September 2013No Comments

After a half month of hard work of rewrite the basic units of AROS and make the documentation, I think its time for a new Release to let the people play with it (and find errors, maybe)

So whats new:
Complete rewrite: Exec, AmigaDos, Workbench, Icon, AGraphics
Many new types and constants added. Addtional procedures/functions for variable number of tags as arguments (like known from C). One function in AGraphics is renamed from „GText“ to „GFXText“ comparable to the „DOSFlush“ in AmigaDOS Unit or „ExecInsert“ in Exec.
There are some function which are deprecated or not implemented atm, or only work on real Amigas i try to flag this functions with the right function flags (‚deprecated‘ e.g. „BltClear“, ‚platform‘ e.g. „SetChipRev“, ‚unimplemented‘ e.g. „WaitBlit“) do they should give a warning if a user use them in own code.

Documentation: Exec, AmigaDos, Icon, AGraphics
as HTML here on the Webpage or as CHM as part of the archive file pp/fp/docs/arosunits.chm. For view this files you can use the fp editor, Help->Files but it does not work very well. better is the HH.exe in Windows or the kchmviewer for linux both searchable with index and so on.

like always the download available on the FPC Page

AGraphics finished. Documentation pending

Posted by ALB42 on 8. September 2013No Comments

The AGraphics unit is finished. And all Circular type calls are solved… I’m a little Bit curious if it is possible in Intuition as well… I noticed there are much more of such problems.
Sadly, because of this change, the Structure and the corresponding Constants are now a little bit far form each other. But I think the right type is much more important, especially when nicely linked in the Docu (As I Did in AmigaOS and little bit in Exec) there is no need to look to the Source.

The FPDoc util can also create the CHM file we need as help for FP-IDE would be nice to add it as context sensitive help. Next Days I will start/continue with AGraphics Documentation. Stay tuned.

I got another idea for better convert C-structs to pascal
for example:

struct XXX
{
  Int abc;
}
#define cde abc

Such things you can find everywhere in AROS includes (because of compatibility with AOS4, MorphOS? MayBe)
There is a functionality that records can act like classes in Delphi compat mode, so this record would look like this in Pascal:

TXXX = record
  abc: Integer;
  property cde: Integer read abc write abc;
end;

Needs to be tested but should work well. The property does not mark an other field so it does not extend the records size (SizeOf should stay the same) just an other Access function is added. This also work into other records for example, maybe even some unions could be replaced with this functionality:

TTextFont = record
  tf_Message: TMessage;
  // .... more fields
  property tf_extension: PMsgPort read tf_Message.mn_ReplyPort write tf_Message.mn_ReplyPort;
end;

Working on (A)Graphics

Posted by ALB42 on 8. September 2013No Comments

Finished work at „AmigaDOS“ unit. also changed the documentation.. some of the functions are not descripted in the official reference. Can add a Description later. I’m still thinking how to „save“ the documentation source files. as archive? as seperate SVN (like fpc is doing) or add it into (but then can not add to official SVN)

Now starting with AGraphics unit. wrapper for graphics.library, there ar esome problems to solve… some cycle type uses.. but I think the most of them I can solve.