diff options
-rw-r--r-- | Optimizing-assembly-code.md | 13 |
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 |