beebasm
beebasm copied to clipboard
Allow use of abbreviations in PUTBASIC input
There's some discussion and a link to a (hacky, experimental) implementation over at stardot: https://stardot.org.uk/forums/viewtopic.php?f=55&t=13638
While very cool, I'm not too keen on the idea of using the BASIC ROM's own tokeniser - jsbeeb naturally has a 6502 emulator and the BASIC ROM available at run time, neither of which is true for beebasm. The latter in particular creates awkward copyright issues around what is (to us) a binary blob, and it seems best to me just to steer clear.
The trouble with the minimum abbreviations listed in the user guide is that "useless" abbreviations are omitted. For example, "AS." resolves to ASC rather than ASN but this isn't documented.
BASIC2 has a list of keywords and functions sorted on the first letter only, so it's roughly alphabetical. Abbreviations are resolved to the first match in the list. For example, PRINT is the first P so it gets the abbreviation "P.".
The implementation in beebasm would be more obviously correct if it simply used the list of keywords dumped from the BASIC ROM and searched through it in order.
On the other hand, there probably isn't a basic program in existence that is both non-tokenised and uses these useless abbreviations.
FWIW, here's some code to dump the keywords from the BASIC 2 ROM.
10S%=&8071
20FORI%=1TO126
30A$=""
40REPEAT
50A$=A$+CHR$(?S%)
60S%=S%+1
70UNTIL?S%>=128
80PRINT """"A$""",0x"STR$~(?S%)",0x"STR$~(S%?1)
90S%=S%+2
100NEXT