Addressing Modes — IMM
The operand of an instruction that uses immediate addressing immediately follows the instruction’s opcode in memory.
Immediate addressing is often using with LDA and LDX…
As well as with ADC, ADD, SBC, and SUB for arithmetic operations…
…CMP, CPX, and BIT for register comparison and testing…
And with AND, EOR, and ORA for combinatorial logic…
Notes:
Immediate addressing is used to specify values that remain constant during program execution. On the 68HC05, the address from which an immediate value is read is always one more than the address of the instruction reading that value.
Assembling LDA #$40 at address $1000, for example, will place $A6 (the opcode for LDA when immediate addressing is used) in memory location $1000 and $40 (the operand) in memory location $1001.
The pound sign (#) is used to designate an operand as an immediate value in Motorola assembly language syntax. It can also be used with assembler-defined symbols. For example, if ASCTONUM is equated to $30, the instruction SUB #ASCTONUM will subtract $30 (decimal 48) from the accumulator.
Pound sign omission is a common assembly language programming error. LDA $40 will not load the accumulator with immediate value $40 (decimal 64). The absent pound sign designates $40 as a direct address, so LDA $40 will load the accumulator with the contents of memory location $0040. For similar reasons, adding a pound sign where it is not required is also a common error.