Category:Z80 Assembly: Difference between revisions
Content added Content deleted
m (changed tags to display code correctly) |
m (changed tags to display code correctly, corrected align 8 to 256) |
||
Line 172: | Line 172: | ||
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. |
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. |
||
<syntaxhighlight lang="Z80"> |
|||
align 256 ;ensures that the first LDI begins at address &xx00 |
|||
rept &7FF |
rept &7FF |
||
LDI ;LDI takes up two bytes each, so by storing &7FF of them we fill up &0FFE bytes, nearly 4k! |
LDI ;LDI takes up two bytes each, so by storing &7FF of them we fill up &0FFE bytes, nearly 4k! |
||
endr |
endr |
||
RET |
RET |
||
</syntaxhighlight> |
|||
==References== |
==References== |