summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-11-29 16:15:48 -0500
committerRangi <remy.oukaour+rangi42@gmail.com>2020-11-29 16:15:48 -0500
commit3779a73dea11f10b9ee9c5d826d7eb6a83389a64 (patch)
tree7766a66fde4555c3a585b0cf2ecc6d21c0ebe07b
parent36dfd67276d0a6519925af21734546be48edad2f (diff)
hl = a
-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