4. Indirect Addressing
Indirect addressing means that the address of the data is held in an intermediate location so that the address is first 'looked up' and then used to locate the data itself.
Many programs make use of software libraries that get loaded into memory at run time by the loader. The loader will most likely place the library in a different memory location each time.
So how does a programmer access the subroutines within the library if he does not know the starting address of each routine?
Answer: Indirect Addressing
It works like this
1. A specific block of memory will be used by the loader to store the starting address of every subroutine within the library. This block of memory is called a 'vector table'. A vector table holds addresses rather than data. The application is informed by the loader of the location of the vector table itself.
2. In order for the CPU to get to the data, the code first of all fetches the content at RAM location 5002 which is part of the vector table.
3. The data it contains is then used as the address of the data to be fetched, in this case the data is at location 9000
A typical assembly language instruction would look like
|MOV A, @5002|
This looks to location 5002 for an address. That address is then used to fetch data and load it into the accumulator. In this instance it is 302.
Challenge see if you can find out one extra fact on this topic that we haven't already told you
Click on this link: using indirect addressing and vector table
Copyright © www.teach-ict.com