Addressing mode examples.

Example source:

label opcode operand comment


The data follows the opcode.

        lda     #3      * A=4
        adda    #2      * A=6 (A+=2)


Also called base page or base page direct addressing. It combines the DP register with the single byte operand.

* DP=0
        lda     $0      * DIRECT because the address 0 is withing the DP
        lda     <$1234  * DIRECT forces assembler to use direct. Loads A with data at $1234.


Store or load from a memory locaton pointed to by X,Y,U,S.

                ldx     #tiledata       * IMMEDIATE X points to tiledata
                lda     ,x              * INDEXED A=$FD, loaded from the address X points to
tiledata        fcb     $fd


Loading a register from memory and storing a register to memory. The operand value is the address. Note that if the address is within the DP, it will become direct.

    tiledata fcb $fd
             lda tiledata  * EXTENDED A=$FD
             lda $3000     * EXTENDED loads whatever was in memory $3000
             sta $FFD9     * EXTENDED stores A to address FFD9
             inc $3000     * if the byte at $3000 = 1 it would now be 2
             inc >$3000    * forces the assembler to use extended


The instruction doesn't nave an operand.