I'm using this subroutine to switch banks:
Code: Select all
BANKPORT = $7FFD
BANKPORTPREV = $5B5C
SWITCHBANK:
;---------------------------
ld a,(BANKPORTPREV) ; Previous value of port
and $F8
or e ; Select bank (number in e)
ld bc,BANKPORT
ld (BANKPORTPREV),a
out (c),a
;---------------------------
RET
Code: Select all
ld de,$03 ; Switch to Bank 3
call SWITCHBANK
ld de,$00 ; Switch back to original Bank 0
call SWITCHBANK
For example, if I switch in whatever is in bank 3, does that then become bank 0? Or does the computer retain the ID number of whichever bank is switched?
Code: Select all
0,1,2,3,4,5,6,7 <- Original
3,1,2,0,4,5,6,7 <- Switched
3 0
0,1,2,3,4,5,6,7 <- Switched, but just with data
If I have graphics data in bank 3 and a drawing screen in say bank 7, I'd need to instantly swap to the graphics bank, grab the data, then switch to the screen to place it there. If there is a delay in the swap, how is this countered, as I'd essentially be reading from and writing to the $C000 block, so it'd need to be fast - especially as my drawing routine reads and writes bytes within a line of each other.
I've looked at the documentation, but it doesn't seem clear on some of these points.
Many thanks!