Category:68000 Assembly: Difference between revisions
Content deleted Content added
Puppydrum64 (talk | contribs) |
Puppydrum64 (talk | contribs) |
||
Line 124:
* X: The eXtend flag is bit 4 of the CCR, and is similar to the carry flag. It gets set and cleared often for the same reasons and is used with the <code>ADDX</code>, <code>SUBX</code>, <code>NEGX</code>, <code>ROXL</code>, and <code>ROXR</code> commands. Why the 68000 has both this and the carry flag, I still don't know.
* N: The negative flag is bit 3 of the CCR, and is set when the last operation resulted in a "negative" value. What constitutes a negative value depends on the size of the last operation - for <code>.B</code> instructions, $80-$FF. For <code>.W</code> instructions, $8000-$FFFF, and for <code>.L</code> instructions, $80000000-$FFFFFFFF.
* Z: The zero flag is bit 2 of the CCR and works like you would expect - it's set whenever an operation results in zero. Unlike x86 Assembly, this also includes moving 0 directly into a register, clearing a register <b>or memory</b> with <code>CLR</code>, etc.
* V: The overflow flag is set whenever a math operation results in a value crossing the $7F-$80 boundary. (Wraparound from 00 to FF doesn't count as overflow, but it does set the carry flag.)▼
▲* V: The overflow flag is bit 1 of the CCR. It is set whenever a math operation results in a value crossing the $7F-$80 boundary. (Wraparound from 00 to FF doesn't count as overflow, but it does set the carry flag.)
* C: The carry flag is set when a math operation results in a carry or borrow. Rolling over from FF to 00, or a 1 getting "pushed out" via a bit shift or rotate, set the carry flag. When using <code>CMP</code>, the carry flag determines the unsigned magnitude comparison. Carry set is less than, carry clear is greater than or equal.▼
▲* C: The carry flag is bit 0 of the CCR. It is set when a math operation results in a carry or borrow. Rolling over from FF to 00, or a 1 getting "pushed out" via a bit shift or rotate, set the carry flag. When using <code>CMP</code>, the carry flag determines the unsigned magnitude comparison. Carry set is less than, carry clear is greater than or equal.
|