Immediate addressing

From C64-Wiki
Jump to navigationJump to search

Immediate addressing is an addressing form in which the byte value to be used or retrieved in the instruction, is located immediately after the opcode for the instruction itself. For instance, this "Load Accumulator"-instruction

A9 40     LDA #64

consists of the byte A9 (169 in decimal; the opcode for the LDA in the immediate addressing mode), and the byte which is to be loaded into the accumulator, in this example 64, or $40 in hexadecimal. Note that all instructions in the immediate addressing mode always take up two bytes in program memory; one for the opcode, and one for the byte to be taken "immediately".

The following 11 machine language instructions support immediate addressing: ADC, AND, CMP, CPX, CPY, EOR, LDA, LDX, LDY, ORA, and SBC.