Language…
18 users online: anonimzwx, codfish1002, DanMario24YT,  Deeke, Golden Yoshi,  Gonzales555, Green, Heitor Porfirio, iamtheratio, imamelia, Irondill, koffe190, LightAligns, MorrieTheMagpie, PMH,  Segment1Zone2, TheOrangeToad, xxxblackangel2208xxx - Guests: 271 - Bots: 235
Users: 64,795 (2,375 active)
Latest user: mathew

MVN/MVP

I'm trying to move a block of bytes from rom to ram using the MVP instruction and I'm having trouble getting it to work. I'm trying to move 0x30 bytes from 'table' to $7FB000 and this is what I currently have:
Code
	PHB
	REP #$30
	LDA #$2F
	LDX.w #table
	LDY #$B000
	MVP $7F,<???>	
	SEP #$30
	PLB
	RTS

table:
	db $FC,$38,$FC,$38,$FC,$38,$FC,$38...

The problem I'm having is how can I get the table's bank where <???> is. I tried:
Code
	MVP $7F,#table>>16	

which just gives an error when assembling.

I suppose I could just use a loop and LDA/STA, but I figured this might save some cycles (correct me if I'm wrong). I also tried using DMA to do this, but I ran into an issue with timing + I kinda want to know how to use MVP.

Any help is appreciated.


Well, there's a few problems here. The assembly error you're getting though is that you need need to specify it as "MVP $7F,table>>16" (no #).

Second, though, REP #$30 makes A/X/Y 16-bit, but LDA #$2F is loading an 8-bit value. You want LDA #$002F.
And third, your starting positions are a bit incorrect. MVP copies from the top of each block and moves downwards; that is, your starting positions should actually be #$B000+$2F and #table+$2F. Alternatively, just use MVN instead as that starts from the bottom of the blocks like you currently have.



Now, this all said, it's worth noting that it's usually better to just use a DMA instead of MVN/MVP to transfer data from ROM to RAM (you can DMA into register $2180). This particular case doesn't matter that much though since the data is so small, but for larger cases you should definitely do that instead.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Ah, I see. Thank you Thomas.