Author Topic: Converting from Prgm to App  (Read 3187 times)

0 Members and 1 Guest are viewing this topic.

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Converting from Prgm to App
« Reply #15 on: April 13, 2023, 07:37:48 am »
@Ki1o
Alright, so I took a look. I just put a bunch of Disp #>Dec statements everywhere so I could see how far execution got. That showed me that it quit right at the line 'Goto UPDATEEND' in your update program. I tracked the problem down to a specific line elsewhere but I will get to that in a minute.
Luckily, there is an easy solution. I moved all your include programs to the end. Since Axe executes in order, putting all your includes at the end means that you don't need Goto statements at the beginning of them anymore. Unlike C, Axe doesn't care about definition order so putting all your includes at the end doesn't hurt anything. If you look at the source for the RTS I sent you, you will notice that that is how I do it for all my code.

When I moved all your includes to the very bottom of your program, it worked fine. The problem? The line 'Pause 16' is the source of all your troubles. From what I can tell that is a compiler bug. That's impressively bad luck, I have only seen 4 compiler bugs in all my time working with Axe and only one like this one where it wasn't just the fault of a function. (For example, Copy()r is a broken function, don't ever use it) Messing around with it some more, I wasn't able to get it to break in a simple test program so there might be more going on. I have used pause many times (although not really with a goto statement jumping over it) so pause isn't just broken. The workaround of moving all your includes to the bottom should fix your problem and make your code a little cleaner. And congratulations on breaking Axe.  ;)

The trick to debugging things like this is to put Disp statements or some other way of showing information all over the place. You will see what is being executed and what parts it didn't get to. Printing out variables also can help for some tricky logic. With that, it only took me a couple minutes to find the problem Goto statement and by moving around the UPDATEEND label, 10 minutes more to find the Pause statement problem.
I'm still around... kind of.