Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2   Go Down

Author Topic: Problem with AMOS compiler  (Read 11786 times)

0 Members and 7 Guests are viewing this topic.

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Problem with AMOS compiler
« on: May 25, 2015, 12:18:44 PM »

I seem to have a big problem with AMOS compiler. I run AMOS compiler from disk and I select to compile my game. When it is 100% compiled I attempt to run it, it exits with illegal function call. Yet, the very same source code that it compiled if I run it from the editor directly it works 100%.

I don't know what to do there.
Logged

Xertese

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 47
  • Generic Amiga User
Re: Problem with AMOS compiler
« Reply #1 on: May 25, 2015, 12:44:28 PM »

Amos compiler is noturiously bad and when coding there are some things you have to avoid because they will not compile like certain procedure calls that's why i avoid using procedures alltogether in favour of subroutines.

Are you sure you compiled it correctly as there are a few choices to either compile it to run from the Amos editor or WB or you can make a self booting copy which isn't that hard you just need a blank disk with a boot block on it create an S folder and inside that folder use memacs to create a startup sequence which is as simple as putting the name of your compiled program in to it.
Logged

Hungry Horace

  • Amorphous Blue-Blob Man
  • Site Admin
  • A4000T
  • ******
  • Karma: 307
  • Offline Offline
  • Gender: Male
  • Posts: 3,364
  • Don't forget... Ameboid's need love too!
    • AUW
Re: Problem with AMOS compiler
« Reply #2 on: May 25, 2015, 06:11:39 PM »

I have seen similar before, and some common faults i've found with the compiler...

- too many ELSE IF statements together.
- screens not open in compiled version  (where opened by default in editor)

...  it can be hard to debug, but one of the easiest things you can do is add an 'exit' routine into the code, where it displays a mesage and quit.

Then keep moving a call to this routine further and further through your (compiled) code until you find out what point it is failing. (i.e. when you dont see the exit message but the failure, you know where it went wrong)

The other option it to add debug messages throughout your code, that right some information about progress on the CLI... (i use CLI WRITE to do this, but that may be an AMCAF extension command) then run your compiled code from amiga CLI and see what the last debug message was to occur.

Once you've located where it's going wrong, you can work out what modification is needed.... it's probably only minor, but i appreciate it can be infurriating up until that point!
Logged
Quote from: KillerGorilla
because winuae is made of code and your amiga is made of stuff

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Problem with AMOS compiler
« Reply #3 on: May 25, 2015, 06:15:30 PM »


Horace is right, the default screen (Screen 0 I believe) is opened by the Editor as default when programs are run.
Logged

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: Problem with AMOS compiler
« Reply #4 on: May 25, 2015, 06:28:26 PM »


Horace is right, the default screen (Screen 0 I believe) is opened by the Editor as default when programs are run.

Are you saying I need to use Screen 0 in order to compile my game? I have an If statement that checks if you are using NTSC or PAL machine and based on that open appropriate screen size. I use Screen 1 for that. Is that wrong? Should I have used Screen 0 instead? Are you using I cannot put Screen open inside an If statement? By the way it is essential I use a lot of If statements in my game as I have turned it into a full  blown RPG game. That means I will be using lots, lots and lots of If statement and or else if.
« Last Edit: May 25, 2015, 06:31:21 PM by xboxisfinished »
Logged

Hungry Horace

  • Amorphous Blue-Blob Man
  • Site Admin
  • A4000T
  • ******
  • Karma: 307
  • Offline Offline
  • Gender: Male
  • Posts: 3,364
  • Don't forget... Ameboid's need love too!
    • AUW
Re: Problem with AMOS compiler
« Reply #5 on: May 26, 2015, 01:32:57 PM »

the points about ELSE IF and the SCREEN optison are totally separate - please do not confuse that there is any issue of having screen functions inside the IF statement (if everything is openned correctly)

The point being made is, that .. the AMOS Editor automaticalyl opens a default screen when you run it. Compiled code may not, unless you set the option to.

E.g  the following should work in the Editor as a lone programme:

Code: [Select]
PRINT "hello"
This will print the word 'hello' to screen 0.

however, the compiled version may not work, and must include code to open the screen....

Code: [Select]
SCREEN OPEN 0,320,256,16,Lowres
PRINT "hello"

Perhaps the NTSC/PAL check requires one screen to already be open to test? If so, you can try something like this....

Code: [Select]
SCREEN OPEN 0,320,256,16,Lowres
SCREEN HIDE 0
IF NTSC = TRUE
SCREEN OPEN 1,320,200,16,Lowres
ELSE
SCREEN OPEN 1,320,256,16,Lowres
ENDIF

SCREEN CLOSE 0



On a totally separate matter,  the problem with ELSE IF is not a problem of too many IF statments, so do not worry about your over all program size.

The following is absolutely fine:

Code: [Select]
IF A=0
 DO SOMETHING
ENDIF

IF A=1
 DO SOMETHING ELSE
ENDIF

IF A=2
 DO SOMETHING ELSE
ENDIF
...
and this can continue forever without problem.

The issue arises when you have one IF statement, and too many ELSE IF statements with it. I cannot remember what the limit is. (30-40?)

so for example, although you could continue like this for a long time in the Editor, the compiled program may throw up a problem ...


Code: [Select]
IF A=0
 DO SOMETHING
ELSEIF A=1
 DO SOMETHING ELSE
ELSEIF A=2
 DO SOMETHING ELSE
..
.. (more ELSE IF statmentsto go here)
..
ELSEIF A=64
 DO SOMETHING ELSE
ENDIF


your best bet is still to debug the code and try and find the actual code that fails. without it, this is all speculation as to where the problem might be.

Another thought is that you have changed the AMOS interpretter settings, say to allow for a higher number of BOBS, but are compiling on a disk copy where the limit is set lower. On this basis, i would always recommend launching the editor from within the editor menu, to ensure consistancy of extensions, interpretter settings etc.
« Last Edit: May 26, 2015, 01:35:31 PM by Hungry Horace »
Logged
Quote from: KillerGorilla
because winuae is made of code and your amiga is made of stuff

Xertese

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 47
  • Generic Amiga User
Re: Problem with AMOS compiler
« Reply #6 on: May 26, 2015, 03:19:23 PM »

As Horace says or you could have as your first executable line "close screen 0" solves all known issues in that department.
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Problem with AMOS compiler
« Reply #7 on: May 26, 2015, 09:46:11 PM »

As Horace says or you could have as your first executable line "close screen 0" solves all known issues in that department.

No, because that will work fine in the Editor. If you compile that you will get a "Screen not open" error in the compiled program.


I suspect it could be an issue with the Ntsc function, though I haven't had time to confirm it.
I know that the True and False functions have caused others occasional problems in the past - they don't always return the values they are supposed to, and I suspect it could be the same with the Ntsc function.
« Last Edit: May 26, 2015, 09:48:50 PM by Lonewolf10 »
Logged

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: Problem with AMOS compiler
« Reply #8 on: May 27, 2015, 05:28:14 AM »

Still not working >< I have removed lots of else if from my program...still couple of more to remove for sure. I removed completely the NTSC from the equation....and still have a problem ><
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Problem with AMOS compiler
« Reply #9 on: May 27, 2015, 05:13:09 PM »


Hmmm... if you feel like uploading your code I can take a look. 2 people working on the same problem should the solution quicker ;)
Logged

Hungry Horace

  • Amorphous Blue-Blob Man
  • Site Admin
  • A4000T
  • ******
  • Karma: 307
  • Offline Offline
  • Gender: Male
  • Posts: 3,364
  • Don't forget... Ameboid's need love too!
    • AUW
Re: Problem with AMOS compiler
« Reply #10 on: May 28, 2015, 11:41:35 AM »

Still not working >< I have removed lots of else if from my program...still couple of more to remove for sure. I removed completely the NTSC from the equation....and still have a problem ><

Are you sure this is the problem, and used the debugging suggestion from above (using WRITE CLI) Have you identified the faulty routine in your code?

There is no point in removing ELSE IF statements unless you know that is the problem.

Also, did you try compiling directly from the editor?

Quote from: lonewolf10
Hmmm... if you feel like uploading your code I can take a look. 2 people working on the same problem should the solution quicker

I have to agree with this. Knowing the extent of the problem might also help with bug-fixes to the compiler later on.
Logged
Quote from: KillerGorilla
because winuae is made of code and your amiga is made of stuff

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: Problem with AMOS compiler
« Reply #11 on: May 28, 2015, 01:37:55 PM »

Attached here is the source code as request. When I attempted to compile it from within AMOS it gives me error with missing extension or some sort. When I attempt to set interpret it gives me error with configuration when I load configuration and it gives me error when I click in any of the set settings.

Anyways here is the source code as requested.

P.S "Just so you know, I am not using WinUAE at all! I am using REAL Amiga computer to develop all my games. :)"
« Last Edit: May 28, 2015, 01:42:10 PM by xboxisfinished »
Logged

Xertese

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 47
  • Generic Amiga User
Re: Problem with AMOS compiler
« Reply #12 on: May 28, 2015, 04:18:28 PM »

Attached here is the source code as request. When I attempted to compile it from within AMOS it gives me error with missing extension or some sort. When I attempt to set interpret it gives me error with configuration when I load configuration and it gives me error when I click in any of the set settings.

Anyways here is the source code as requested.

P.S "Just so you know, I am not using WinUAE at all! I am using REAL Amiga computer to develop all my games. :)"

I suspect some Libs are missing try compiling it using the compiler from WB
Logged

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: Problem with AMOS compiler
« Reply #13 on: May 28, 2015, 06:06:11 PM »

Attached here is the source code as request. When I attempted to compile it from within AMOS it gives me error with missing extension or some sort. When I attempt to set interpret it gives me error with configuration when I load configuration and it gives me error when I click in any of the set settings.

Anyways here is the source code as requested.

P.S "Just so you know, I am not using WinUAE at all! I am using REAL Amiga computer to develop all my games. :)"

I suspect some Libs are missing try compiling it using the compiler from WB

In my first attempt of compiling I said include ALL AMOS library in the program and still fails miserably. So that did not work at all. You have my source code, can you please check it out with the compiler? I possibly may have hit a bug or something..or at least helped find a solution that got written here for future people to avoid going through the same frustration as me.
Logged

bruceuncle

  • AMOS Dev
  • A500
  • *****
  • Karma: 6
  • Offline Offline
  • Gender: Male
  • Posts: 425
  • WINUAE Amiga User
Re: Problem with AMOS compiler
« Reply #14 on: May 29, 2015, 03:28:56 AM »

Attached here is the source code as request. When I attempted to compile it from within AMOS it gives me error with missing extension or some sort. When I attempt to set interpret it gives me error with configuration when I load configuration and it gives me error when I click in any of the set settings.
Thanks for the source code.  I'm currently trying to understand the details of the AMOS compiler sources.  So any examples of stuff that either won't compile or gives errors when run are most appreciated.  That way I stand some chance of nailing the problems in the debugger.

As a side note.  It's great to see how you've taken to AMOS.  Well done for getting involved.  ;)  And I can promise you a much improved version in the future.  It just takes time...
Logged
Repeat after me ...  "The AMOS Pro architecture is complex but it is not complicated."
Pages: [1] 2   Go Up
 

TinyPortal 2.2.2 © 2005-2022