6502js icon indicating copy to clipboard operation
6502js copied to clipboard

an example that simulates a z80 ldir is very needed

Open ghost opened this issue 8 years ago • 1 comments

i often ask people with 6502 assembly coding experience how can we do a ldir (like that one from z80) - when some people runs away, others tries to ask with totally useless suggestions - would be great if there would be an example explaining how can we have a routine that shows us how can we have ldir on 6502

ghost avatar Feb 11 '17 15:02 ghost

That's a very complex instruction! For reference:

It takes a source address in HL, a target address in DE, and a 16-bit count in BC. When executed, LDIR will load a byte from the address pointed to by HL, and store it at the address pointed to by DE. It will then increment HL and DE, decrement BC and repeat the whole load/store/increment/decrement dance until BC is 0. An entire memory block could be copied in a single instruction! Copying one byte this way cost 21 cycles though so it wasn’t exactly fast, for a few dozen kilobytes LDIR would take multiple seconds to complete.

Perhaps the best place for this would be codebase64 (original here) or a discussion on the forum at 6502.org?

BigEd avatar Feb 12 '17 12:02 BigEd