February 17, 2006
Sample BASIC programs |
On this page you can find the sources for the BASIC sample programs I wrote that one can run in NG-BASIC, and also the classic BASIC programs I had to modify a bit.
Basically, these programs could be run in any BASIC interpreter although with slight modifications.
LOGO
To load: LOAD WEB:LOGO
I couldn’t resist writing a LOGO interpreter after reading some discussion about interpreters-in-interpreters.
< ?php echo str_replace( " ", " ", str_replace( "\n", "
“, file_get_contents( “../phpstuff/console/files/LOGO” ) ) ); ?>ANIMAL
To load: LOAD WEB:ANIMAL
I had to modify this program, original © Creative Computing, to get it to run smoothly. Also, cosmetically it has had a revamp.
< ?php echo str_replace( " ", " ", str_replace( "\n", "
“, file_get_contents( “../phpstuff/console/files/ANIMAL” ) ) ); ?>WUMPUS
To load: LOAD WEB:WUMPUS
Another classic, also original © Creative Computing.
< ?php echo str_replace( " ", " ", str_replace( "\n", "
“, file_get_contents( “../phpstuff/console/files/WUMPUS” ) ) ); ?>VALUHACK
To load: LOAD WEB:VALUHACK
Yes, VALUHACK ported to NG-BASIC. What can I say — I was bored…
< ?php echo str_replace( " ", " ", str_replace( "\n", "
“, file_get_contents( “../phpstuff/console/files/VALUHACK” ) ) ); ?>









Where can I download (link) a free basic program to test run of your programs?
Hi David,
How about this thing right here on this weblog — it is written in Javascript so could run in your browser as well. The above programs can be loaded and run from there.
There are, of course, better alternatives around that run native on your operating system; Google can find plenty of them.
Hi.
I was writing a little BASIC program using your javascript interpreter.
How do I break out of a program that is stuck in an infinite loop?
CTRL-C doesn’t seem to work.
Thanks!
Hmm Ctrl-C works for me in this example:
10 PRINT “Hello there “;
20 GOTO 10
RUN
(hitting Ctrl-C then aborts the program)..
It may have to do with the piece of code it is trying to interpret… Can you confirm that you can or cannot abort the above example?