liveBook · Manning

Immediate addressing mode

As explained in Classic Game Programming on the NES: Make your own retro video game

Immediate addressing mode supplies a constant operand directly in an instruction, conventionally marked with a number sign.

Immediate addressing supplies a constant operand directly in an instruction, marked with #. With ADC, the value is added to the A register rather than read from a memory address. section 4.1.1

Add a constant to A

Clear the carry flag, load $01 into A, then add the immediate value $05. The result is A=$06. section 4.1.1

Listing 4.2 Adding a direct value
clc          #1
lda #$01
adc #$05

Inspect the complete instruction sequence for adding a direct value. section 4.1.1

How Classic Game Programming on the NES: Make your own retro video game covers it

How deep it goes
Defines direct values and contrasts them with memory-address operands through worked ADC examples.
Examples
Demonstrates CLC, LDA #$01, and ADC #$05 producing A=$06.
What it assumes
Assumes familiarity with the A register and ADC while introducing the # syntax through a small calculation.
What you can do after
Apply it via an online assembler simulator to assemble and run constant-operand arithmetic.
How it connects
Connects immediate operands with ADC, the A register, and the carry flag.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Classic Game Programming on the NES: Make your own retro video game. The section links point to the parts of the book it draws on.