Quote
I think the two systems are really very comparable in how they deal with bank switching. +4 write to one address switches ROM out (FF3E) , another address to switch ROM in (FF3F). 128 is more complicated, but they simplify it by having four configurable memory configurations
Yep. I think the 128 does whatever to keep at least its interrupt routine (and the things it calls) in the right place so that it doesn't have to mess with disabling interrupts during every single BASIC character fetch. The MMU on the 128 lets it deal with ROM/RAM ranges in a more granular way; whereas the Plus/4 banking is always a swap of all the entire ROM/RAM in the range from $8000 to $FFFF, period full stop (well, perhaps excluding special cases with carts, though I didn't look at that).
All that said, both Plus4 and 128 take a speed hit compared with the C64 (and X16!) version of 'CHRGET' which not only has no need for the SEI/CLI instructions of the Plus 4, but is also able to omit an additional 6 bytes (and 12 CPU cycles) of register writes for bank switching compared to both the Plus4 and C128. Moreover the C64 implements its actual fetch of the next program byte into the accumulator as something akin to an "indirect" e.g., equivalent to something like a fictional 'LDA (txtptr)' instruction, all as a result of the self-modification of the TXTPTR and TXTPTR+1 values inline in the C664 CHRGET routine:
C64 'chrget'
chrget = $73
chrgot = $79
txtptr = $7a
:chrget
0073 inc txtptr
0075 bne chrgot
0077 inc txtptr+1
:chrgot
0079 lda [word: txtptr txtptr+1]
:txtptr
007a [ ] ; low byte of address of next BASIC prog char (or input buffer location in direct mode)
:txtptr+1
007b [ ] ; high byte of address of next BASIC prog char (or input buffer location in direct mode )
007c cmp #$3a
007e bcs exit_routine
0080 cmp #$20
0082 beq chrget
0084 sec
0085 sbc #$30
0087 sec
0088 sbc #$d0
:exit_routine
008a rts
By my rough tally, the C64 version takes 38 to 41 cycles depending on how the branches go and assuming it doesn't go back to the start upon encountering and discarding a space character, whereas the Plus/4 version takes 53 to 57 cycles to complete and the C128 takes 49 to 53 cycles.
And getting back to to the topic of this thread and coming around full circle, I think our little examination of the more 'advanced' BASICs from the other machines leads me to this conclusion:
Not only is C64 derived BASIC 2.0 probably sufficient for the X16, its actually probably the BEST choice for the startup environment/ entry level console, interpreter, 'novice/beginner's' programming language on the machine. Partially due to the space savings from new 65C02 instructions like STZ and the like, the team already greatly enhanced BASIC and KERNAL in the same amount of rom space. But its going to (and should) basically be an extended C64 BASIC, and nothing more. There's not a realistic path for a volunteer team to rewrite Commodore BASIC into something with a highlighted, tab indented syntax IDE with with private subroutine variables, or branches to labels, or long variable names, etc.
After all...
1) its STILL an 8 bit chip. Each memory space can only have 256 values; of which most are already spoken for for letters, numbers, symbols, PETSCII graphics, and the existing pantheon of BASIC tokens. So adding a bunch of new functionality will require using escape characters and double byte tokens (one set for tokens; another set for structure if line numbers were gotten rid of; another set for branch or subroutine labels; another set to define context for private variables; another set for variable name-table hashes, and so on. But from the last few posts, we see all too clearly the performance impact of things that make parsing take even a little bit more work. This is especially the case if all the extra features require banking operations and access to additional RAM.
2) A program that would take more than 40K of code and variables would be unusual to the point of "extremely rare" for just about every 'retro' flavor/context of interpreted program language anyway, particularly on an 8 bit platform. I don't think anything written in BASIC in the downloads for the X16 so far comes even close. The '8bit show and tell' guy recently did a segment on Sid Meier's Pirates and the BASIC listing for that sucker was really REALLY long and still managed to fit in the space available on a stock C64 (and thus would fit on the X16). Doing that long or longer of a program today, someone would probably be better suited using a compiled language, whether 'C' using one of the projects that have support for the X16, or something new and cool like 'PROG8' which is I am following with interest.
Even so, the X16 architecture will permit alternatives. If someone is able to fit a version of QuickBasic or an 8-bit pseudo Python or whatever (including dev environment, runtime interpreter, AND a system kernel) into 16K of ROM bank (or two) , they should write it and see how it goes! But I'm now firmly in the camp that thinks its not reasonable to insist or expect the dev team to go there. The 8BITGUY wanted that 'power on to BASIC' experience and we've more than got that covered.