Re: Q_Liberator malaise
Posted: Fri Mar 28, 2025 9:46 pm
Thank you, Martin! I was hoping that someone would be able to add some more context around those snippets of code.
To quote the Q_Liberator manual:
Continuing further into the manual...
Interesting, the common factor here seems to be FOR loops. That could certainly explain why quite a few programs seem to break with seemingly no rhyme or reason. I hadn't heard of AUTOF before, but I also haven't really done much with Q_Liberator (even less than I have with Turbo, both of these are rabbit holes I keep meaning to explore in more detail...), so I went looking in the manual.Martin_Head wrote: Fri Mar 28, 2025 11:42 am I am currently going through QLib_run_asm trying to add comments
This is what I have for these areas
Involves FOR loops.
I am mostly working on the initialisation stuff at the moment. Not really looked into the actual running of the compiled program yet.
To quote the Q_Liberator manual:
Interesting. Perhaps the potential FOR/AUTOF related upper address bit shenanigans only affect programs compiled with Q_Liberator 3.2 or newer? That may explain why various programs seem unaffected...The SuperBASIC interpreter insists that the control variable of a FOR...END FOR
loop be floating point. Release 3.2 supports two methods for speeding up compiled
programs by allowing integer FOR variables.
Continuing further into the manual...
Huh. Perhaps at least one of the bits serves a purpose to indicate that the index variable is integer, for the sake of AUTOF? Crude but "easy" way to tag the type of the variable if you're using a pointer to reference it in the first place... (not sure if they are, just speculating a bit)The first method is suitable for most programs and is achieved via a new option,
AUTO ( -AUTOF if using in the command line interface). This instructs the runtime
system to treat any FOR variable as an integer if the start, end and step are all
integer quantities. If the same variable is later used in a floating point FOR loop,
then the runtime system alters its type to a float automatically. Q_Liberator can do
this because it knows a variable's type at runtime, a prerequisite for a full
implementation of the language.
This raises an interesting question: what happens if one uses QLIB_PATCH to disable AUTOF on a program known to break with 040/060 caches? I could see it possibly preventing those bits from being set... obviously, it's not a real solution, but it would confirm some suspicions...Selecting the AUTO option can greatly speed up many programs, particularly if the
FOR variable is used as an array index, but there is one drawback which may be
encountered. If such a FOR variable is currently an integer and used as a
parameter to an INPUT statement, then INPUT won't let you enter a floating point
number into the variable. INPUT does not know that the variable's type is
changeable. You can get round this easily by INPUTing to another float variable,
then assigning it to the FOR variable. This will change the type to a float.
AUTO can also be turned on or off for any program after compilation using
the QLIB_PATCH utility.