Handling Two byte variables in assembly

Version 1
    Question: How to perform arithmetic operations on  a two bytes variable in assembly language?



    Since PSoC is an 8 bit MCU, there are no instructions to process 16 bit data directly. Please use carry to perform 2 byte arithmetic. Following is an example for a loop of 500 counts.

    Variable Declaration:

    area bss(ram)
    loopCount: BLK 2


    mov [loopCount+1],f4h
    mov [loopCount],1 ;load 500 to loopCount

    ;Write your code that has to be performed within the loop

    sub [loopCount+1],1  // Subtract 1 from LSB
    sbb [loopCount],0     // Subtract with borrow from MSB
    jnc loop

    Similarly for addition, use the "add" and "adc" instructions.