diff options
| author | nitro2k01 <nitro2k01@gmail.com> | 2020-11-26 18:51:33 +0100 |
|---|---|---|
| committer | nitro2k01 <nitro2k01@gmail.com> | 2020-11-26 18:51:33 +0100 |
| commit | 6ae7cdf4bb40aa1f43ec5946223ef4fd19bfddfe (patch) | |
| tree | b8493bc00e0b2ef557d0d884646f6d7a6a77514b /Optimizing-assembly-code.md | |
| parent | e0ebf4eb7b63769a4bf3bb7f0cd6479a788cbc8d (diff) | |
Added version of the bit reverse code adapter for GB.
Diffstat (limited to 'Optimizing-assembly-code.md')
| -rw-r--r-- | Optimizing-assembly-code.md | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Optimizing-assembly-code.md b/Optimizing-assembly-code.md index 4bda4b0..121a719 100644 --- a/Optimizing-assembly-code.md +++ b/Optimizing-assembly-code.md @@ -223,6 +223,23 @@ But do: xor b ``` +A slightly faster version of the above code that takes advantage of the `swap` opcode that exists on the GB but is missing on the Z80. (Adapted by nitro2k01.) + +``` + ; 15 bytes, 15 cycles + ld b, a + rlca + rlca + xor b + and $aa + xor b + ld b, a + swap b + xor b + and $33 + xor b + rrca +``` ### Set `a` to some constant minus `a` |
