Amiga-Development

Please login or register.

Login with username, password and session length
Advanced search  

News:

Created for developers of all Amiga camps

Pages: 1 [2]

Author Topic: Pascal executable fires grimm reaper on Sam440 with AmigaOS 4.1 FE Update 1  (Read 1011 times)

0 Members and 2 Guests are viewing this topic.

ALB42

  • Moderator
  • Newbie
  • *****
  • Posts: 22
    • View Profile

hmm, I don't have this effect, I tried in UAE with AmigaOS 4.1 Update 6 compiled 3 times always work, always same result (binary diff gives 0 bytes difference) I also used the nightly 11.03.2017

Maybe your RAM has a problem? or your harddisk, I'm not sure how this can be. maybe you try to close some programs or so hard to say whats the reason.

if it does not reach the writeln at begin already it means it crashes in the preparation already (opens some libraries, alloc memory pool and such stuff)
Logged

Fastbit66

  • Newbie
  • *
  • Posts: 14
    • View Profile

@ALB42:

Thanx a lot for your comment.

This is really weird ! I will test on a different partition on the Hd.

The System itself runs stable so i don't think there is a RAM Problem.
The c sources from the sdk Compile and run fine.

Will see what happenes.

Andi
Logged

magorium

  • Full Member
  • ***
  • Posts: 200
  • Programming is an art form that fights back
    • View Profile

@Fastbit66:
i am not very proficient with linker or compiler related issues.

However, we can try some simple deduction (in case you are sure it is not hardware related issues).

Make the simplest of program and see if that (always) works for you:
Code: (pascal) [Select]
program test;

begin
  WriteLn('Hello world');
end.

Then try add up the ante:
Code: (pascal) [Select]
program test;

Uses
  SysUtils;

begin
  WriteLn('Hello world');
end.

Then the next unit:
Code: (pascal) [Select]
program test;
Uses
  SysUtils, Exec;

begin
  WriteLn('Hello world');
end.

etc. etc. until you can reproduce your problem again. All the units are listed in the uses clause of the winpubscreen example: SysUtils, Exec, AGraphics, Intuition and Utility;

Something that is definitely different in the winpubscreen example is the use of the forward declaration of routine handle_window_events.

You can try to remove that line and place that function above the main routine.

Please feel free to ask in case you did not understand something and/or have additional questions.

edit PS:
I just realize, perhaps the tag ending is a problem.

In the call to OpenWindowTags, where you can see the TAG_END, add another TAG_END (or a zero, which is factually a TAG_END). Perhaps they always need to be even (pairs) on OS4.
« Last Edit: March 12, 2017, 09:36:32 PM by magorium »
Logged

Fastbit66

  • Newbie
  • *
  • Posts: 14
    • View Profile

@ALB42
@magorium

IT WORKS !!!

Seems in fact I have a problem with hd.

For a quick test I put the source files into the RAM Disk and compiled.

ALL demo programs from the nightly build 11.03.2017 work out of the box without any changing.

I compiled every source several times and then changed it a bit and recompiled it again.

ALL OK :) Thread example and mui example also fully functional!

Guys you are great - Thanks a lot for your help and hints.

Now I will test a bit more the whole environment anf then try to make a gui with reaction on AOS 4.

Bye the way - has anyone of you an example how to add a reaction gadget to a window?

Oh  If you want me to test something for you - please let me know. I am looking forward to helping you !


Best regards !!!

Andi
Logged

magorium

  • Full Member
  • ***
  • Posts: 200
  • Programming is an art form that fights back
    • View Profile

Hi Fastbit66,

Thank you very much for reporting back on your issues. Dumb is that i forgot to suggest compiling in ram disk as that rules out at least HD related issues (memory issue will appear more often there though  ;)).

With regards to your question about reaction. I don't think our (current) headers have everything in place to program for/with reaction. In basics it is just calls to intuition, but most OS4 specifics are not in place (ALB42 would know for sure).

In theory you could just follow examples such as mentioned here, and i also noticed a video here (haven't looked at it myself yet).

The only difference with regards to the c examples should be the explicit use of library interfaces. So everywhere where you read things like...
Code: [Select]
IExec->Wait
IIntuition->GetAttr
IGraphics->SetAPen
.. you omit the library interface so that you just call Wait, GetAttr, and SetAPen.

At least, that is my understanding atm.

Please keep in mind that reaction is very OS4 oriented and as such has not got any priority for us. All the (other) basic libraries are in place though such as dos, graphics, intuition etc but, i do not know for sure if all OS4 additions are in place.

My main focus so far was on getting Classic, AROS and MorphOS headers on par with eachother. afaik ALB42 added some additional extensions that are (yes or no) platform specific.

That is also the part were we could use some help  :P

If you feel/experience something is missing for your needs then please do tell.

Please also see this page for what headers are  available.

Also please note that although we try to do everything in our power to add to our existing library that we are limited time wise and hardware wise.

In case you are able to help us create missing or add to existing headers then we would consider that very helpful and would allow for others to make use of your work as well. Reporting back on missing features will also aid us.

When reporting issues, also keep in mind that we are bound to existing (and available) SDK's.

PS: i forgot to mention, one other field that is platform specific is the use of hooks. We can get into details about those when you are running into that.
« Last Edit: March 13, 2017, 06:06:28 PM by magorium »
Logged

Fastbit66

  • Newbie
  • *
  • Posts: 14
    • View Profile

@magorium:

Thanks a lot for your anwswer and the interesting links.

I will take a depp look into them and hopefully this gets me starting :)

As a little test I coded an openscreen example from c to pascal:

Code: [Select]
program sreentest;

uses
   exec,intuition,utility;

var
  screen : PScreen;
       i : cardinal;


begin

   screen := OpenScreenTags(nil,
   [
    SA_Left      ,0,
    SA_TOP       ,0,
    SA_Width     ,1280,
    SA_Height    ,1024,
    SA_Depth     ,16,
    SA_Title     ,AsTag(PChar('MyScreen')),
    TAG_END
   ]
   );




   if Assigned (screen) then
      begin

        for i:= 1 to 200000000 do
          begin
          end;
         CloseScreen(screen);

       end

   else
   writeln('Could not open Screen!');

end.
That worked ok :)

Once I get all the stuff I will maybe able to code reaction gadgets. And - one never know - it could lead to Header Files for
fpc AmigaOS ;)

I must admit that I never have done things like that before. But I really would like to learn all the necessary stuff
to achieve the goal one day.

I am deeply impressed about your work and dedication for all we have so far available on Amiga Systems.
And your statement:
Quote
Please keep in mind that reaction is very OS4 oriented and as such has not got any priority for us. All the (other) basic libraries are in place though such as dos, graphics, intuition etc but, i do not know for sure if all OS4 additions are in place.

My main focus so far was on getting Classic, AROS and MorphOS headers on par with eachother. afaik ALB42 added some additional extensions that are (yes or no) platform specific.

makes completly sense to me in context with achieving a maximum of system indepandance.

ÖHHMM...i think you will start laughing now but if you look at my little code you will see that I wait in a loop before I close the screen. Shame on me ..I know this is lousy.. ::) I tried Delay but tht's not found by the compiler...
Then i tried Wait - but this waits forever even with a given value of e.g. 10

The loop waits for roughly 4 seconds on my SAM440

Best regards - see you :)

Andi



Logged

magorium

  • Full Member
  • ***
  • Posts: 200
  • Programming is an art form that fights back
    • View Profile

Thanks a lot for your anwswer and the interesting links.
You're most welcome.

The fpcamigawiki is our main source of information. Please feel free to point out mistakes or better yet, in case you have information you would like to add to actually add it.

As you perhaps can see for yourself there are some things lacking especially when it comes to MorphOS and OS4.

Other interesting links are the official Free Pascal wiki pages, Amiga, AmigaOS4, AROS and MorphOS (even though the AROS wiki links back to ALB42's fpcamigawiki)

And of course there is the main Free Pascal wiki entry here, with a extensive list of topics, examples etc. As a general rule of thumb: google search: "freepascal topic" and you usually end up in either the documentation, the wiki or an example somewhere on the web (to get ahead of things, do a search "freepascal delay" and you understand why we can't name our Dos library function delay also delay).

Quote
As a little test I coded an openscreen example from c to pascal:
If you are new to Pascal then taking small steps will help you a lot. You might discover it is not that far from C.

The main difference start when using OOP or modern languages constructs such as advanced records, helpers and last but not least the additional (and extensive list of) Pascal libraries (some of them available in native Pascal (such as json, xml, dbf), others depend on external libraries).

Quote
I must admit that I never have done things like that before. But I really would like to learn all the necessary stuff
to achieve the goal one day.
Just take your time, and in case of question then please feel free to ask. In case you prefer then feel free to PM (although doing it openly will help others that want to travel the same journey).

Quote
...makes completly sense to me in context with achieving a maximum of system indepandance.
One thing that was missing from my previous reply is indeed that ALB42 and me mostly work on getting the other Pascal units working for our platforms. In that regards some OS specific functionality isn't as interesting as it otherwise might be.

For example for Lazarus (visual building applications) there were several approaches and ALB42 ended up with what we currently have available. It is a constant process of development and progress (and sometimes sat-backs).

Quote
I tried Delay but tht's not found by the compiler...
Ah yes, sorry.

I should have mentioned that some of our API function names (whether it Amiga, AROS or MorphOS) collide with Pascal functions that are available (all or not available in a particular unit).

Also to stay consistent with the naming we had to change some of the names for our native API calls. A list of changes can be found here.

There you can see that the function that you are looking for is now named DosDelay()  ;)

Perhaps also an idea to mention is that c makes extensive use of include files (.h files) while it is normal for Pascal to have a unit that contain both the header (in the interface section) as well as the actual implementation (in the implementation section).

In case you are truly lost with Pascal then you can always attempt to get yourself a bit more familiar with things using the official Free Pascal documentation.

Of course, in case you get stuck then feel free to ask (although nobody is able to teach you the Pascal language as only you yourself is able to do so). If you are reasonably seasoned with c programming then (i guess) the most difficult part  would be to get yourself familiar with the standard Pascal libraries and getting to know where exactly everything is tucked away  :)

Regards,
Ron.
Logged

Fastbit66

  • Newbie
  • *
  • Posts: 14
    • View Profile

Hi Ron !

Thanx for the links and hints.
That really helps a lot :)

I am not completely new to Pascal but it has been many years ago sinne These days.
I used turbo pascal 6.0 under ms dos. Was cool.
But for my Job I had to Learn c and visual Basic.
About a month ago I surfed in.the inet and found something about free Pascal.
Wow cool i thought...let's take a look...
And in addition the Lazarus IDE...
Great! So I installed it on my Ubuntu Box. Real fun!!

And then fpc for Amiga!!! Awsome  8)

So Now I will go for it. Have to learn again the basic syntax and units but
I am Happy to do this.

And many thanks for your offer to ask if I run in Trouble.
And this will mostlikely happen :)

Best regards
Andi
Logged

magorium

  • Full Member
  • ***
  • Posts: 200
  • Programming is an art form that fights back
    • View Profile

Aaah, ok  :)

Thank you for the elaboration on that Fastbit66, as it explain a few things i was wondering about ;D

OK, then i case you would like a quick starter refreshment course then you could use the one from tutorialspoint here to get you back into shape.

In case you'd like a crash-course into modern language features then you could use the tutorial from here.

In case you stumbled upon my github then please keep in mind that most of my work expressed therein is aimed to be used with the FPC 3.0 compiler (trunk version which you are currently working with is actually version 3.1).

There are a lot of changes/improvements that are part of trunk that are not present in the official release and therefor FPC 3.0.x is showing its age by now.

That can work pretty confusing if you are not aware, so i thought to mention it.

There is nothing or anyone to blame for the current incompatibilities between versions, and tbh we could use some other extra improvements to go into trunk in order to get those improvements to be part of the next official release of FPC.

Keep in mind that FPC 3.0 was the first official release that supported again all our platforms in the way it currently does thanks to the fantastic work done by Chain-Q and ALB42.

Chain-Q is afaik mostly targeting MorphOS and m68k while ALB42 and me are more AROS oriented tbh ALB42 is supporting all with his work). As long as you do not use platform specific features then your code should be able to compile for all (including Windows/Linux and MacOS targets, to name a few).

Atm i use Windows for cross-compiling to Amiga, AROS and MorphOS but as long as there are no platform specic changes needed i can test my code on Windows first  :D

Regards,
Ron.
Logged

Fastbit66

  • Newbie
  • *
  • Posts: 14
    • View Profile

Hi Ron !

Hey thanx a lot for the two links. They are perfect for getting into Pascal again :)

And I visited your github (of couse );)

Fantastic what is going on with fpc for Amiga OS like systems.

All you guys who are working so hard for it ....GREAT !!!!

So now my journey can begin. 

Oh and i looked especially to the object pascal link.
All the oop stuff is there ..COOL.

And in Pascal it looks much more friendly and cleaner to me than in c++ (which can really be painfull )  :o

regards
Andi


Logged
Pages: 1 [2]