liveBook · Manning

Absolute addressing

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

An addressing mode that identifies an instruction operand by its full memory address.

Absolute addressing names an operand by its complete 16-bit memory address. Write the address directly after an instruction to read or write a location anywhere in memory, rather than using an 8-bit zero-page offset or calculating an address with an index register. section 3.3.1 section 3.3.2

For a load, `lda $0300` copies the value stored at memory location `$0300` into A. The same full address can be used with X and Y loads: `ldx $0300` and `ldy $0300`. If `$0300` holds `$20`, each register loaded this way receives `$20`. section 3.3.1

Store, then load from a full address

Place `$20` at `$0300`, then read it back: `lda #$20` `sta $0300` `lda $0300` The first instruction puts a direct value in A. `sta $0300` stores it at the absolute address, and the final `lda $0300` retrieves that stored value. Assemble and run the code, then inspect A to verify it is `$20`. section 3.3.1 section 3.3.2

Absolute addresses also supply operands to arithmetic. After storing `$10` at `$0300`, `clc`, `lda #$20`, and `adc $0300` add the memory value to A, producing `$30`. The address identifies where the operand lives; `adc` determines what to do with it. section 4.1.1

Figure 3.10 Load a value stored anywhere in memory into a register.

Use the memory-to-register diagram to distinguish a full absolute address from zero-page and indexed forms. section 3.3.1

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

How deep it goes
Defines 16-bit absolute addressing and demonstrates loads, stores, and addition without detailing instruction encoding.
Examples
Demonstrates `$0300` holding `$20` for loads, register values stored at `$0300`–`$0302`, and `$20 + $10 = $30`.
What it assumes
Teaches absolute addresses through register and memory examples, while assuming instruction syntax such as `lda`, `sta`, and `adc`.
What you can do after
Apply it via 6502 load, store, and ADC instructions to access a specified full memory address.
How it connects
Connects addressing modes with zero-page memory, index registers, registers A/X/Y, stores, and addition with carry.

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.