*
*       24- BIT ADDITION
*       NOTE : CPX CHANGES CARRY BIT, WE NEED TO SAVE CARRY BIT (CCR)               
*       ATFER ADDITON, RELOAD IT BEFORE ADDITION
*

*LABEL          OPER.   OPERAND         COMMENT
*****           *****   *******         *******************************

RAMStart        EQU     $0040           ; Starting location of RAM
ROMStart        EQU     $8000           ; Starting location of ROM (FLASH)
ResetVector     EQU     $FFFE           ; Reset vextor address


                ORG     Resetvector
                FDB     MAIN


                ORG     RAMStart
A_Data          FCB     $AA,$BB,$CC     ; 24 bit number I
B_Data          FCB     $01,$BB,$CC     ; 24 bit number II
C_data          RMB     3               ; Reserve 10 memory bytes
TEMP            FCB     $00


                ORG     ROMStart

                
MAIN            LDHX    #$03
                CLC

LOOP            LDA     TEMP
                TAP                     ; TRANSFER ACCUMULATOR TO CCR
                LDA     A_Data-1,X
                ADC     B_Data-1,X
                STA     C_Data-1,X
                TPA                     ; TRANSTER CCR TO ACCUMULATOR
                STA     TEMP
                
                DECX
                CPX     #$00
                BNE     LOOP

                NOP
                NOP
                                
