Well... I went high with all of this, and took the "Change Log.txt" of the file that Daryl/8BIT posted earlier, and applied the changes to the basic.asm file that Andrew/Bitwise posted today.
Deleted the .65C02 directive, replaced some opcodes (#XBA -> XBA and #TCS -> TCS) and compiled it with the Dev65.jar file and uploaded it to the board.
And it works. But I don't go too high, so... How can I tell if the compiled code is working in native or emulated mode?
My version does a SEC/XCE at the start to force the emulation mode.
When I browsed the 65C02 source I found a few TXS instructions which will execute differently in the two modes. In emulation mode the high byte of the stack pointer is always $01 but in native mode it gets set from the high byte of the X register which is $00 if X&Y are set to 8-bits. This would leave the stack pointer on zero page and could overwrite the interpreters variables if the code recursed a lot (like in a complex math expression).
So I opted to put the processor in emulation mode for safety.
My version does a SEC/XCE at the start to force the emulation mode.
When I browsed the 65C02 source I found a few TXS instructions which will execute differently in the two modes. In emulation mode the high byte of the stack pointer is always $01 but in native mode it gets set from the high byte of the X register which is $00 if X&Y are set to 8-bits. This would leave the stack pointer on zero page and could overwrite the interpreters variables if the code recursed a lot (like in a complex math expression).
So I opted to put the processor in emulation mode for safety.
I just recently noticed that you were kind enough to use my CMOS version of EhBasic for porting to the 65C816 SXB. Just an FYI, I did another update to the CMOS code after Klaus released a p5 patched version. My updated CMOS version 2.22p5C has those updates, plus 100% of the Cold/Warm start code and additional code to implement LOAD and SAVE which links to my C02Monitor for Xmodem-CRC upload and download functions. The only problem porting to the 65C816 related chips would be some usage of the page zero bit manipulation instructions... all are related to the Xmodem LOAD/SAVE... 3 in total. There's also a few more performance enhancements as well... one to the CHRGET/CHRGOT equivalent routine by Mike Barry.
I'm adding the updated source code here for convenience, hope you (and others) find it useful.