Addressing modes

Date: 2025-01-05 23:52:01 / Updated: 2025-01-05 23:52:01

Immediate

The data follows the opcode.

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

Direct

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

Assume memory at $0b00 is 00 01 02 03 04 05

 lda     #$0b    * load A with value $0b
 tfr     a,dp    * load the direct page with $0b
 ldy     <$02    * DIRECT forces assembler to use direct. Loads Y with data at `$0b02`, which is `$0203`.

Indexed

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

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

Extended

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

Inherent

The instruction doesn't nave an operand.

 inca


Copyright © 2025, Lee Patterson