Status: Tags: #cards/cmpt295/assembly Links: Central Processing Unit (CPU)
Condition Codes
Principles
CF - Carry Flag (for unsigned) ?
- indicates whether there is overflow
ZF - Zero Flag ?
- if result is 0
SF - Sign Flag (for signed) ?
- indicates whether result is a -ve number
OF - Overflow Flag (for signed) ?
- indicates whether result creaed +ve or -ve overflow
Changing
cmp* and test* set condition codes
Branching ?
- cmp* instruction ;; compare
- [](https://gyazo.com/413b54162a61412135b65b301ce8b0d7)
- doesn't save result
- set condition codes based on src1-src2
- test* instruction (test)
- $j^x$ instructions (jump)
$j^X$ use condition codes
Examples
function with if/else and return
?
- Code false condition first
Backlinks
|
|
References:
Created:: 2022-02-05 20:58