Just putting this here in-case someone else mis-reads their assembler documentation as I did recently ...
The mnv and mvp instructions take a source and destination bank numbers, so it's a 3-byte instruction, so naively, you might code it
Code:
mvn 1,4
to move from bank 1 to bank 4. (after setting up A, X & Y).
However this won't work as the assemblers (at least ca65, and I think some others) want the full 24-bit address, even though they strip off the bottom 16 bits, so this ought to be:
Code:
mvn $01000000,$04000000
I now use a little macro in ca65 for simple moves with immediate values
Code:
; bmn
; Block move macro
.macro bmn len,from,to
lda #len-1
ldx #(from & $FFFF)
ldy #(to & $FFFF)
mvn (from & $FF0000),(to & $FF0000)
.endmacro
and so on for other variants.
Anyway. might help someone wondering why random RAM appears to be clobbered..
It's also a shame in a way that the from & to banks can't be easily changed dynamically without self modifying code. (No change from the PDP-8 there, then
-Gordon
_________________
--
Gordon Henderson.
See my
Ruby 6502 and 65816 SBC projects here:
https://projects.drogon.net/ruby/