summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Optimizing-assembly-code.md36
1 files changed, 18 insertions, 18 deletions
diff --git a/Optimizing-assembly-code.md b/Optimizing-assembly-code.md
index d1dd25f..34378d0 100644
--- a/Optimizing-assembly-code.md
+++ b/Optimizing-assembly-code.md
@@ -638,8 +638,8 @@ But do:
You can do:
-```
-; 7 bytes, 11 cycles
+```asm
+ ; 7 bytes, 11 cycles
ld l, a
ld h, 0
add hl, hl
@@ -648,8 +648,8 @@ You can do:
add hl, hl
```
-```
-; 7 bytes, 11 cycles
+```asm
+ ; 7 bytes, 11 cycles
ld l, a
ld h, 0
rept 4
@@ -659,8 +659,8 @@ endr
But if `a` is definitely small enough, and its value can be changed, then do:
-```
-; 7 bytes, 10 cycles; sets a = a * 2; requires a < $80
+```asm
+ ; 7 bytes, 10 cycles; sets a = a * 2; requires a < $80
add a
ld l, a
ld h, 0
@@ -669,8 +669,8 @@ But if `a` is definitely small enough, and its value can be changed, then do:
add hl, hl
```
-```
-; 7 bytes, 9 cycles; sets a = a * 4; requires a < $40
+```asm
+ ; 7 bytes, 9 cycles; sets a = a * 4; requires a < $40
add a
add a
ld l, a
@@ -679,8 +679,8 @@ But if `a` is definitely small enough, and its value can be changed, then do:
add hl, hl
```
-```
-; 7 bytes, 8 cycles; sets a = a * 8; requires a < $20
+```asm
+ ; 7 bytes, 8 cycles; sets a = a * 8; requires a < $20
add a
add a
add a
@@ -689,8 +689,8 @@ But if `a` is definitely small enough, and its value can be changed, then do:
add hl, hl
```
-```
-; 7 bytes, 7 cycles; sets a = a * 16; requires a < $10
+```asm
+ ; 7 bytes, 7 cycles; sets a = a * 16; requires a < $10
add a
add a
add a
@@ -699,8 +699,8 @@ But if `a` is definitely small enough, and its value can be changed, then do:
ld h, 0
```
-```
-; 7 bytes, 7 cycles; sets a = a * 16; requires a < $10
+```asm
+ ; 7 bytes, 7 cycles; sets a = a * 16; requires a < $10
rept 4
add a
endr
@@ -710,8 +710,8 @@ endr
Or if the value of `a` can be changed and you want to optimize for speed over size, do:
-```
-; 8 bytes, 8 cycles; sets a = l
+```asm
+ ; 8 bytes, 8 cycles; sets a = l
swap a
ld l, a
and $f
@@ -722,8 +722,8 @@ Or if the value of `a` can be changed and you want to optimize for speed over si
Or do:
-```
-; 8 bytes, 8 cycles; sets a = h
+```asm
+ ; 8 bytes, 8 cycles; sets a = h
swap a
ld h, a
and $f0