summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-11-29 00:12:17 -0500
committerRangi <remy.oukaour+rangi42@gmail.com>2020-11-29 00:12:17 -0500
commitd7ffa5c08dc04f32ce3fb87476bced31c768c689 (patch)
treea811d32170474f66dc2a933b9dd23332a809505b
parent42500d4edeefb71f7163c7bf5b693a2c598616b6 (diff)
comments
-rw-r--r--Optimizing-assembly-code.md13
1 files changed, 7 insertions, 6 deletions
diff --git a/Optimizing-assembly-code.md b/Optimizing-assembly-code.md
index 7a3609d..8f18570 100644
--- a/Optimizing-assembly-code.md
+++ b/Optimizing-assembly-code.md
@@ -88,9 +88,10 @@ Don't use the optimized versions if you need to preserve flags. As such, `ld a,
```asm
ld a, [wIsTrainerBattle]
- and a ; sets flag Z if [wIsTrainerBattle] is 0
- ld a, 0 ; sets a to 0 without affecting Z
+ and a ; sets zero flag if [wIsTrainerBattle] == 0
+ ld a, 0 ; sets a to 0 without affecting zero flag
jr nz, .is_trainer_battle
+ ; is not trainer battle
```
@@ -184,8 +185,8 @@ Don't do:
```asm
; 26 bytes, 26 cycles
rept 8
- rra
- rl b
+ rra ; nor rla
+ rl b ; nor rr b
endr
ld a, b
```
@@ -234,8 +235,8 @@ Or if you really want to optimize for size over speed, then don't do:
; 10 bytes, 59 cycles
ld bc, 8 ; lb bc, 0, 8
.loop
- rra
- rl b
+ rra ; nor rla
+ rl b ; nor rr b
dec c
jr nz, .loop
ld a, b