JAC! Posted January 18, 2016 Share Posted January 18, 2016 When apemaster (aka Kemal aka Yoda) released the 25 years "Techo Ninja" edition http://atariage.com/forums/topic/236686-new-game-released-tecno-ninja-25-years-anniversary-edition/ a lot of people had trouble starting the program in emulators. The reason behind that was that when Yoda wrote the program 25 year ago, he was faced with the problem that a compiled Turbo Basic program cannot load another part that is also compiled. Back then he came up with a clever trick to circumvent this problem: If the RUNTIME.COM is loaded, (for example by renaming it to AUTORUN.SYS), it tried to automatically load the program "D:AUTORUN.CTB". So what Yoda did was, that he had the TITLE and the MAIN program on disk and depending on which was to be started, he renamed it to "AUTORUN.CTB" and restarts to runtime. Because the default for mounting files as disk images in Altirra is "Read/Only" exactly this renaming failed and the pogram was stuck was a DOS error message (you could not see, because a dedicated display list is active). When he told me amout the issue I thought is was an interesting problem. So after only 8 months of tracing and debugging from time to time, here is the solution. Pitty it won't help TecnoNinja itself because the sources are long lost, but maybe it will be useful for other Turbo Basic fans. The solution is a relcoatable inline machine language routine to which you can pass the name of the file (with ".TUR" extension!). If the routine is called from within regular Turbo Basic,it will return without doing something and you can load the uncompiled program using RUN "D:....TUR". If the routine is called from within the compiled runtime, it will load the compiled program with the ".CTB" extension instead of the ".TUR" extensions. This way you can have a single source that transparently works with uncompiled and compiled programs. The archive contains and ATR and also the MADS source for the routine. RunCTB.zip 6 Quote Link to comment Share on other sites More sharing options...
JAC! Posted May 16, 2016 Author Share Posted May 16, 2016 The week after the post above I finally found the time to read the "Das neue Turbo-Basic XL 1.5 Handbuch" published by the ABBUC in 2015. And guess what, when I arrived at the "RUN" command it stated that "RUN" worked in compiled program and can load compiled programs then. Murphy's law: You HAVE TO FIND THE HARD SOLUTION FIRST YOURSELF, before you can find the easy solution of somebody else. Today I finished proof reading the book and submitted the changes to the ABBUC for the new revision of the book. So I thought that is a good occation to show you the reading books about Atari computer pays off. The whole problem can be reduced to detecting if you are in the interpreter or the compiled runtime. This can be easily distingushed by looking at $2081. It contains $80 is interpreted, $7d if compiled. So basically a simple IF does the trick. RunCTB-Simple.atr 6 Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted May 16, 2016 Share Posted May 16, 2016 Very cool. It's nice that we can still discover new things after all these years! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.