Absolute Vs Symbolic Addressing
Symbolic Addressing vs Absolute Addressing
When we write computer programs in a high level language we use Symbolic Addressing, where we refer to memory locations using identifier names for variables, functions , data structures etc.
Example program to calculate profit
LDD REVENUE SUB COST STR PROFIT
This program is easy for humans to read. If we used absolute addressing instead it would be very difficult to understand the purpose of the code
This has two key advantages in assembly language programming:
- First it makes the programs easier to read as we are using words that mean something to us.
- Second it means that if the memory location where that data is stored changes we only have to change it once in our program.
The computer cannot process these symbolic addresses so when the program is assembled all symbolic addresses are replaced with the memory address assigned to that symbol. The assembler builds a symbol table or symbolic names and the corresponding addresses in memory.
Profit program after the symbolic addresses have been swapped out
LDD #4454 SUB #3326 STR #4410