Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

an example that simulates a z80 ldir is very needed #6

Open
ghost opened this issue Feb 11, 2017 · 1 comment
Open

an example that simulates a z80 ldir is very needed #6

ghost opened this issue Feb 11, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 11, 2017

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

@BigEd
Copy link
Collaborator

BigEd commented Feb 12, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant