Discussion3 - What is the purpose of the Code Condition Register and how can we use it for decision making functions within assembly language The

Discussion3 - What is the purpose of the Code...

This preview shows page 1 - 2 out of 2 pages.

What is the purpose of the Code Condition Register and how can we use it for decision making functions within assembly language? The condition code register is an 8 bit register that is also referred to as the flag register. Five of the flags are called conditional flags meaning that they indicate some conditions that result after an instruction is executed. The 5 flags are the C (carry), H (half carry), Z (zero), N (Negative), and V (overflow). Two of the bits I and X are set aside for the interrupt masking and one bit, the S bit is for the stop option. [ CITATION Maz20 \l 1033 ] The Carry flag is set whenever there is a carry out from the D7 bit. This flag bit is affected after and 8- or 16-bit addition or subtraction. The Half Carry is used by instructions that perform binary coded decimal arithmetic. The Zero flag is there to reflect the results of an arithmetic or logic operation. If the result is zero, then Z=1, this means that Z=0 if the result is not zero. The Overflow flag is set whenever the result of a signed number operation is too large, causing the high order bit to overflow into the sign bit. This flag is mainly used to detect errors in unsigned arithmetic operations while the overflow flag is used to detect errors in signed arithmetic operations. The negative flag reflects the result of an arithmetic operation as well. If the D7 bit of the result is zero, then N=0 and the result is positive. If the D7 bit is one, then N=1 and the result will be negative. The condition code register uses the status flags or conditional flags to make decisions. The instructions it receives from the flags will make a conditional jump based on the status of the flag bits. References Mazidi. (2020). In HCS 12 microcontroller and embedded systems (p. 78).

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture