While looking for information on another Commodore platform, I came across this, "SuperNumbers III", by Richard Curcio. Based on the original SuperNumbers by John R. Bennett, this gives the BASIC programmer "sticky", indestructible variables. See SuperNumbers III and the original SuperNumbers at
Thanks for sharing. I was looking at the code and noticed it assumes that vector 'iError' will always be called with Bank 0 (or Bank 14) in context. Although this is typical, some errors (especially those involving strings) can happen with Bank 1 (or rather 14.1) in context. If/when this happens, the Super Numbers program will crash... because the new vector points to code in Bank 0.
Just in case my imagination was wrong, I took the time to build SuperNumbers. You can download the source code here: Source.src (2.02 KB). You can download the binary here: supernum.bin (175 B).
It is easy to install... just use: BANK0:BLOAD"SUPERNUM.BIN":SYS 4864
Now you can create a "super number" with a statement like this (direct mode): £A = 11
You can test it works with something like: PRINT £A
The cool thing about "Super Numbers" is you can issue CLR or NEW, but you will still get the value (11) when you execute the prior example, PRINT £A
I realize this a rather lame feature, but the main point of Super Numbers is it is fast... much faster than standard BASIC variables.
Anyway, my main point for this long-winded-thread is SuperNumbers will crash if an error occurs when BASIC is looking at Bank 1. As proof, try the following (in direct mode or in a program): PRINT ASC("A"+Z)
You should get a nasty "BING" from the audio chip, followed by a not-very-user-friendly message like this: BREAK PC SR AC XR YR SP ; 1132E 33 FF 16 04 EA
[Edit] Silly me, I forgot to tell you how to fix this bug!
You need to put the code in Common RAM (below 1024 decimal / $400 hexadecimal). That way it doesn't matter what BANK happens to be in context when BASIC attempts to execute your custom code (in this case, SuperNumbers).
As a practical matter, virtually all of Common RAM is used by the OS (operating system = KERNAL + BASIC), which makes fixing the bug a challenge. You could write a small 'stub' to $3E4 (which invokes BANK 0), but this would fail with some extensions like BASIC 7.80 or BASIC 8.
The sad fact is, there is no perfect solution, due to poor OS design. [/Edit]
Last Edit: Jan 21, 2016 3:04:04 GMT by hydrophilic: Thought of something more!