I have been using the Einstein compiler without any issues so far with quite complicated Basic programs, but recently I ran into a very strange bug when I tried to execute a DOS command.
To demonstrate the problem I have the following one line program, which simply executes the CATALOG command:
10 PRINT CHR$(4)”CATALOG”
When I run it uncompiled under DOS 3.3 or under ProDOS it works perfectly. If I compile it using Einstein, the compiled version works under DOS 3.3, but under ProDOS it ignores the CHR$(4) and just prints on the screen:
#10 CATALOG
I am also not sure why it is printing #10, when I actually disabled tracing in the compiler options.
Is there any trick to make it work under ProDOS? I find it hard to believe that it is not possible to call DOS commands in ProDOS from an Einstein compiled program. I am not really trying to list files in my program, I am just using this as the simplest example to showcase the problem. I tried version 5.2 as well as 5.3 of the compiler, the result is the same.
Thanks in advance!
Complete shot in the dark, as I'm not familiar with this compiler. But I was always taught to put a semicolon after chr$(4) to concatenate when issuing dos commands. Maybe the compiler wants it as well? Have you tried something like:
10 print chr$(4);"catalog"
This is strictly from memory, but as I recall Einstien supported DOS 3.3 only. It even had disclaimers about using it with ProntoDOS and other DOS 3.3 variants. Most people I knew used Beagle Compiler for ProDOS. It makes sense that the disk routines in DOS and BASIC.SYSTEM would not have common entry points and the compiled code would not likely work. Again from memory only, Beagle Compiler genereated a byte code and needed a runtime engine also ( ?? COMPILER.SYSTEM maybe?? ), like Java or UCSD Pascal P-code.
Einstein was not designed for ProDOS.
That is definitely the case, but all of my compiled code worked perfectly under ProDOS so far, except for when I introduced the need to call DOS. I was hoping that there would be some hack or workaround, but apparently there isn’t. I’ll most likely give the other compilers a try.