Category:Z80 Assembly: Difference between revisions
m
→LDIR is slow: formatting
Puppydrum64 (talk | contribs) |
Puppydrum64 (talk | contribs) m (→LDIR is slow: formatting) |
||
Line 122:
Some programmers have taken this to its logical extreme by filling several kilobytes' worth of memory with <code>LDI</code> instructions, then pick how many they want to execute by offsetting a pointer to that section of memory. If you have plenty of bytes to burn and the need for speed, it can be a viable option.
<lang z80>align 8 ;ensures that the 0th LDI begins at address &xx00▼
▲align 8 ;ensures that the 0th LDI begins at address &xx00
rept &7FF
LDI ;LDI takes up two bytes each, so by storing &7FF of them we fill up &0FFE bytes, nearly 4k!
endr
RET</lang>
|