1
$\begingroup$

Indirect addressing allows you to reference memory locations, larger than the operand limit of a CPU.

i.e

1 | ADD 2 3
2 | #2
3 | *32000
...
32000 | #5

This will add memory location 2 and 3, 3 points to location 32000, so when it's evaluated, the effect is:

1 | ADD 2 32000

Even though 32000 may exceed the operand size limit.

My question is, why do this?

Why not simple have this:

1 | ADD 2 3
2 | #2
3 | #5

It saves time wasted on extra references to memory and space in memory.

$\endgroup$
3
$\begingroup$

Indirect addressing is possible without instructions that implement it explicitly. These instructions exist for our convenience, and not just for reaching a position that doesn't fit the address space of a direct addressing instruction (although this will become quite natural if your program is big enough): that's how we implement subprograms and arrays, for instance.

$\endgroup$
  • $\begingroup$ So, it'd be something automatically done by the compiler / os? Is its real use basically just a pointer, like in c++ etc as opposed to some memory work around? $\endgroup$ – Tobi Feb 17 '17 at 14:34
  • $\begingroup$ Well, there usually are explicit instructions for indirect addressing, that a high-level language would use to implement its constructs. We wouldn't rely on any work around in the "real world". Pointers are an abstract extension of the concept of indirect addressing. $\endgroup$ – André Souza Lemos Feb 17 '17 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.