I. Please read about the Condition Code register /Status Register (CC) and its flags types :

The H bit is set to 1 when a carry occurs between the bits 3 and 4 of the ALU during an ADD or ADC instruction

Set, when last result is negative

II. Please read about the Stack Pointer

16 bit variable, indicates next free location on stack.

III.

  1. Consider the program based on previous labs which presents the behavior of chosen flags of CC:

    ld A,#$FE
    add A,#$1
    add A,#$1
    
    ld A,#$E
    add A,#$1
    add A,#$1 
    
    ld A,#$1
    sub A,#$1
    sub A,#$1
    
    ld A,#$2
    sub A,#$1
    sub A,#$1
    
  2. What is the relation between CC and Interrupts ?

    When an interrupt occurs, the CPU registers (CC, X, Y, A, PC) are pushed onto the stack. This operation takes 9 CPU cycles and uses 9 bytes in RAM.

  3. What is the Stack size of our MCU?

    64KBytes

    The stack pointer is a 16-bit register.

  4. What value is adopted by Stack Pointer after the MCU reset (default value) and why ?

    After an MCU reset the Stack Pointer is set to its upper limit value.

  5. What is the lowest value which Stack Pointer can adapt and why ?

    The stack pointer is a 16-bit register. It contains the address of the next free location of the stack. Depending on the product, the most significant bits can be forced to a preset value.

  6. Is there any similarity between CC behaviour and some Sequential digital circuit (which one?)

  7. Find and read about following ASM instructions (Programing Manual):