It turns out Monte did not work on the 6502 version, but pointed me in the direction to figure all of this out.
The A% format originates not in MS BASIC, but the one they based it on, BASIC-PLUS on the PDP-11. Like the later MS version, BASIC-PLUS indicated an integer value with the %, so for instance A%
. As in the MS version, integer variables were a 16-bit signed value. It is not clear whether BASIC-PLUS had a separate integer math package.
This feature reappeared in later versions of MS BASIC, although I have not tracked down which one exactly. It does not appear to be part of the original 6502 version that was supplied to Atari, for instance. As it was available on some Commodore machines, this implies it happened relatively early in the evolution.
In any case, the MS version used integer variables only as indexes and values in arrays. This allowed a more compact in-memory format, which was especially useful for large arrays of numbers like machine code stored in a SYS
array.
With these limited use-cases, there was no need for a separate math unit - this was being done for size not speed - and so any math using these variables simply converted it to the 9-byte FP format and used the existing FP math routines.
It would be interesting to modify the CBM code to add a separate integer math library with just the basic routines in it, perhaps only plus and minus. I suspect this would have a large effect on average program performance.