Alarm Siren wrote:
I decided that it was important that the bank bits be readable as well as writable so that subroutines / interrupts can save and restore them.
Yeah, it's nice to be able save and restore. There are various approaches, offering different tradeoffs.
The BBC Micro solution Ed mentioned requires twice as much writing, as everything written to the (write-only) bank register must also be written to the image in memory to keep it current.
One way to beat the double-write business is to change the fact the bank register is write-only. To read it back all you need is to attach it to some unused bits of a VIA -- much as you plan to do now, except the VIA would be for reading only.
Of course the ultimate solution is an '816, which, upon interrupt and RTI, manages the save/restore of the entire 24-bit address transparently. But I admit there's educational value in doing things the hard way.
Edit: Thanks, Michael, for your thoughts on non-memory-mapped I/O. The 'C02 is an obvious candidate, as there are so many unused opcodes. But the '816 is also eligible, thanks mainly to WDM -- a two-byte NOP whose 8-bit operand is completely up for grabs.
-- Jeff
_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html