Difference between revisions of "680x0:Condition codes"
Spellcoder (talk | contribs) m |
Spellcoder (talk | contribs) (added explaination/example) |
||
Line 1: | Line 1: | ||
+ | {| | ||
+ | |valign=top| | ||
Condition codes are used in branch instructions Bcc and DBcc.<br /> | Condition codes are used in branch instructions Bcc and DBcc.<br /> | ||
− | Replace the cc with any of the | + | Replace the cc with any of the code you see in the list. |
+ | ===Example=== | ||
+ | If you like to branch/goto another place in the code if a signed number is greater or equal to 8 use: | ||
+ | |||
+ | <code><pre> | ||
+ | CMP.B #8,D0 | ||
+ | BGE ItsGreaterOrEqual | ||
+ | |||
+ | ItsGreaterOrEqual: | ||
+ | </pre></code> | ||
+ | |||
+ | |||
+ | ===Signed/unsigned=== | ||
+ | Unsigned numbers can only be positive, while in signed numbers the highest bit is used to tell if the number is negative. As assembler programmer it's up to you to conciously choose the correct condition code for signed/unsigned numbers. | ||
+ | |width=60| | ||
+ | |valign=top| | ||
<table class="sortable"> | <table class="sortable"> | ||
<tr><th>cc</th><th>mathematical</th><th>meaning</th><th>bitcode</th><th>signed</th><th>comment</th></tr> | <tr><th>cc</th><th>mathematical</th><th>meaning</th><th>bitcode</th><th>signed</th><th>comment</th></tr> | ||
Line 33: | Line 50: | ||
</table> | </table> | ||
+ | |} |
Latest revision as of 23:45, 4 March 2008
Condition codes are used in branch instructions Bcc and DBcc.
ExampleIf you like to branch/goto another place in the code if a signed number is greater or equal to 8 use:
Signed/unsignedUnsigned numbers can only be positive, while in signed numbers the highest bit is used to tell if the number is negative. As assembler programmer it's up to you to conciously choose the correct condition code for signed/unsigned numbers. |
|