How to run a legacy GWBasic script inside linux command line with forced full host cpu speed

1

I have a really obscure old colection of Basic scripts (too many scripts, all of them too long and with too many goto to be worthy to translate them and I personally know nothing at all about qwbasic) that I need to run inside a linux server to call it from an apache instance with a php exec() command.

This is an excerp from the code:

228 IF CA$="Cl" THEN MATRIXA$(A)=CA$
230 IF CA$="Cl" THEN VEO=VEO+1
232 IF CA$="Cl" THEN GOTO 242
234 IF CA$="nH" THEN MATRIXA$(A)=CA$
236 IF CA$="nH" THEN VEO=VEO+1
238 IF CA$="nH" THEN GOTO 242
240 MATRIXA$(A)=YXD$
242 RETURN
244 IF YXD$="" THEN GOTO 782
246 YXD=VAL(YXD$)
248 IF YXD>0 THEN GOSUB 260
250 IF YXD>0 THEN GOTO 106
252 GOSUB 282
254 IF YXD$="=" THEN GOTO 106
256 IF YXD$="#"

I managed to get it to work with two different commands but each one with a caveat

With pcbasic

pcbasic OLDSCRIPT.BAS -n -k='AAAA\rBBBB\r' > /dev/null

-n to use it in from linux command-line and not from a window

-k to insert the keystrokes needed to type 2 params (AAAA and BBBB in the example)

The problem with this approach is that it emulates the computer with a low cpu speed and the scripts are complex matrix operations that take a lot of time.

With OpenBox

The second way I made it to work is using Openbox (and then GWBASIC.EXE) which let me overclock the script to an acceptable speed, but it seems to not be right for me because it must use a Display, so in a server would say:

Openbox-Message: Failed to open the display from the DISPLAY environment variable.

I don't know how to force a linux command run at full speed of my server ignoring the sleep / time synch internal instructions, but it seems to me the way to go.

Maybe I should compile them with bascom? It seems daunting. I just want to interpret it "in turbo mode"

Yiin00b

Posted 2016-02-09T22:49:59.230

Reputation: 11

No answers