Category:Z80 Assembly: Difference between revisions
Content added Content deleted
Puppydrum64 (talk | contribs) m (→LDIR is slow: formatting) |
Puppydrum64 (talk | contribs) m (→Bit Shifting) |
||
Line 84: | Line 84: | ||
RLCA ;6 bytes total</lang> |
RLCA ;6 bytes total</lang> |
||
Not only is the second method shorter, it's also faster. The accumulator-specific bit rotates take 1 byte and 4 clock cycles each. They are different, however, because unlike the two-byte versions, these <i>do not affect the zero flag.</i> This isn't a big deal, however, as more often than not if you're rotating the accumulator you're not expecting to get zero as the output anyway. |
|||
Not only is the second method shorter, it's also faster. |
|||
For 16-bit bit shifting, use A instead of the other half of the register pair for faster results (unless you're checking for equality to zero, or you need the accumulator for something else.) |
|||
<lang z80>rept 4 ;inline the following 4 times, back to back: |
|||
SRL H |
|||
RR L |
|||
endr |
|||
rept 4 ;this version is faster. |
|||
SRL H |
|||
RRA |
|||
endr</lang> |
|||
===Inlined bytecode=== |
===Inlined bytecode=== |