summaryrefslogtreecommitdiff
path: root/Optimizing-assembly-code.md
diff options
context:
space:
mode:
Diffstat (limited to 'Optimizing-assembly-code.md')
-rw-r--r--Optimizing-assembly-code.md8
1 files changed, 8 insertions, 0 deletions
diff --git a/Optimizing-assembly-code.md b/Optimizing-assembly-code.md
index 9933b84..c411b16 100644
--- a/Optimizing-assembly-code.md
+++ b/Optimizing-assembly-code.md
@@ -871,6 +871,14 @@ And if the constant is 8-bit and nonzero (i.e. 0 < `FooBar` < 256), then do:
ld h, a
```
+And if the constant is zero (i.e. `FooBar` == 0 and `a` + `FooBar` == `a`), then do:
+
+```asm
+ ; 3 bytes, 3 cycles
+ ld l, a
+ ld h, 0
+```
+
### Set a 16-bit register to `a` \* 16