Indirect addressing is mentioned in respect to generic assembly languages in chapter 4 section 4.1.3. In the Hack CPU all memory references are indirect through the A Register.
In the context of algorithms, indirect addressing refers to variables that contain addresses of other variables.
For example, to implement an array that holds strings, usually the array holds addresses of the actual strings (called
pointers). This lets the strings use only as much memory as they individually require, rather than every string requiring the same amount of memory.
Simple string array uses 48 words in memory:
1000: first
1016: something longer
1032: last
1048:
Indirect string array uses 28 words in memory:
1000: 1001 1008 1024
1003: first
1008: something longer
1024: last
1028:
Using pointers also makes many data manipulations faster. For instance, if I want to sort this string list alphabetically all I need to do is change the pointers; I don't need to move the string data.
1000: 1001 1024 1008
1003: first
1008: something longer
1024: last
1028:
--Mark