I’ve been reading with interest your trials and tribulations regarding the bank switching on the 128s – I don’t think I’m ever going to be at a competence to actually use bank switching, and apologies for jumping on your thread
. But I was wondering if with the double buffering something would need to be like this?
Bank 2, is our main code, held in 0x8000 to 0xC000 (Lets call this LOC2)
Bank 0 is the “original” bank in 0xC000 to 0xFFFF (Lets call this LOC3)
So, the code in LOC2, would be along the lines of
1) Turn off interrupts
2) CALL Your Sub Routine
3) Store the stack pointer into BANK 2 memory
4) Switch LOC3 to BANK7 or 5 (from here on you cannot use any existing RETS or POPS)
a. *Rather than step 3 above, could you flip to the shadow registers?
5) Set the stack pointer to somewhere LOC3
6) DO ALL THE STUFF - drawing sprites, changing screen etc, setting the screen– using Push/ Pop and Calls/Returns etc
7) Finish all your RETURNS and POPS (you won’t be able to use them again)
8) Switch LOC3 to BANK 0
9) Load the stackprnter saved at step 2 into the stack pointer (or flip back the shadow registers?)
10) Turn on interrupts
11) RETURN from your Sub routine
12) Do The Screen Flip
What I’m understanding is that the speccy way, basically means that the only way to get data from Bank 0, to Bank 1,3,4,6 & 7 is to copy it to bank 2 or bank 5 first?
So, basically there will be lots of copying memory from the different banks, probably having to use the spare memory in the main display bank (Bank 5 –sharing with ULA so slower). So the majority of your program code would have to be in bank 2 (or at least this would have to be the “master control” code)
There were basic command for saving to the M: (file commands) - could you create a "files" larger than 16k, (I'd assume you wouldn't be able to span the banks? Were there basic commands or extensions for writing to/flipping the display screen and reading/writing to it?
*From other reading, I understood that the shadow registers are often used by the ROM, so best never to use them …