The code is plain C99, so it should compile on just about anything. (Famous last words!) I've developed it on Linux, but it should build easily on any Unix-like system. I'm hoping someone will step forward to create the necessary build script/project file to build it on Windows, which I don't think will be that big a job.
De-tokenisation is useful if you have a tokenised program which you want to examine:
Code: Select all
$ xxd test.tok
00000000: 0d00 0a15 f120 2248 656c 6c6f 2c20 776f ..... "Hello, wo
00000010: 726c 6421 220d ff rld!"..
$ basictool test.tok
10PRINT "Hello, world!"
Code: Select all
$ basictool -f test5.bas
1 FOR I=1 TO 100
2 FOR J=1 TO 100
3 PRINT I*J:
IF I+J>42
THEN PRINT "Foo!":
FOR K=1 TO 100:
NEXT
4 NEXT
5 NEXT
Code: Select all
$ cat test.bas
10P. "Hello, world!"
$ basictool -t test.bas test.tok
$ xxd test.tok
00000000: 0d00 0a15 f120 2248 656c 6c6f 2c20 776f ..... "Hello, wo
00000010: 726c 6421 220d ff rld!"..
You can also pack the program using ABE:
Code: Select all
$ cat test3.bas
square_root_of_49 = 7
my_variable = 42 + square_root_of_49
PRINT my_variable
$ basictool -p -t test3.bas test3.tok
$ basictool test3.tok
1s=7:m=42+s:PRINTm
basictool *doesn't* generate .ssd output; you'll need to use something like MMB_Utils to do that, if you need it.
If you're interested, you can read more and download the code from github.
It works for me, I hope it will work for you! If you try it and have problems please post here so I can investigate.
I'll close with a lightly tweaked copy of the credits from the github README; obviously basictool builds on a lot of existing code:
- BBC BASIC was (of course) originally published by Acorn.
- The BASIC editor and utilities were originally published separately by Altra. The Advanced BASIC Editor ROMs are (C) Baildon Electronics. Thanks to Dave Hitchins for his support for developing basictool using these ROMs.
- 6502 emulation is performed using lib6502. This was originally written by Ian Piumarta, but the version of lib6502 used in basictool is taken from PiTubeClient.
- Cross-platform command line parsing is performed using cargs.