diff options
| author | Rangi <remy.oukaour+rangi42@gmail.com> | 2021-02-22 17:27:35 -0500 |
|---|---|---|
| committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2021-02-22 17:27:35 -0500 |
| commit | 0c6d65daa72dacff7689349ab18e13a9a5cebfd3 (patch) | |
| tree | 91e94528b54a5a90f9c4d015ec81a28ae13ed1ec /Optimizing-assembly-code.md | |
| parent | 1a858174c61362aa216d31441bd35ddf05ff7b55 (diff) | |
call cc
Diffstat (limited to 'Optimizing-assembly-code.md')
| -rw-r--r-- | Optimizing-assembly-code.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Optimizing-assembly-code.md b/Optimizing-assembly-code.md index f545ca4..dbcf2f1 100644 --- a/Optimizing-assembly-code.md +++ b/Optimizing-assembly-code.md @@ -56,6 +56,7 @@ WikiTI's advice fully applies here: - [Inlining](#inlining) - [Fallthrough](#fallthrough) - [Conditional fallthrough](#conditional-fallthrough) + - [Call a function depending on a flag](#call-a-function-depending-on-a-flag) - [Call `rst $38` depending on a flag](#call-rst-38-depending-on-a-flag) - [Jump and lookup tables](#jump-and-lookup-tables) - [Chain comparisons](#chain-comparisons) @@ -1470,6 +1471,27 @@ But do: ``` +### Call a function depending on a flag + +(The example uses `z`, but `nz`, `c`, or `nc` would also work.) + +Don't do: + +```asm + ; 5 bytes, 3 or 9 cycles + jr nz, .skip + call Foo +.skip +``` + +But do: + +```asm + ; 3 bytes, 6 or 3 cycles + call z, Foo +``` + + ### Call `rst $38` depending on a flag (The example uses `z`, but `nz`, `c`, or `nc` would also work.) |
