Immediate

The opcode contains the value to use with the instruction rather than the address of this value.

The effective address of the instruction is specified using the # character, as listed in the following listing:

Listing: Immediate addressing mode
           XDEF  Entry
initStack: EQU   $0400

MyData:    SECTION

data:      DS.B  1

MyCode:    SECTION

Entry:

           LDHX  #initStack ; init Stack Pointer

           TXS              ; with value $400-1 = $03FF

main:      LDA   #100       ; load register A with (decimal) 100

           BRA   main

In this example, the hexadecimal value $0400 is loaded in value in the register HX and the decimal value 100 is loaded into register A.