*
*
*               INDEXED ADDRESSING EXAMPLE WITH INDEX REGISTER II
*
*

*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,$DD     ; 32 bit number I
B_Data          FCB     $01,$BB,$CC,$DD     ; 32 bit number II
C_Data          RMB     4                   ; Reserve 4 memory bytes



                ORG     ROMStart

                ; Add last bytes
MAIN            LDHX    #$4
                CLC                          ; Clear Carry Bİt

ALOOP           LDA     A_Data-1,X
                ADC     B_Data-1,X           ; Add with carry
                STA     C_Data-1,X
                DBNZX   ALOOP           ; Decrement and brach if not equal zero X

                NOP
                NOP



