Jump to content
JAC!

Multi-Part Loader for Compiled Turbo Basic XL 1.5 Programs

Recommended Posts

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.

 

[attachment=430722:RunCTB.png]

 

The archive contains and ATR and also the MADS source for the routine.

 

 

 

Share this post


Link to post
Share on other sites

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.

 

[attachment=451058:RunCTB-Simple.png]

 

[attachment=451059:RunCTB-Simple.atr]

 

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...