Q.What is an addressing mode? Why is it necessary?
[!TLDR]
An addressing mode tells the CPU how and where to find the operand of an instruction; having several modes gives flexible, compact data access.
When the 8051 executes an instruction it must know where the operand is. The addressing mode defines this. The 8051 supports: immediate (data is a constant in the instruction, e.g. MOV A, #25H), register (operand is in a register, e.g. MOV A, R0), direct (operand is at a given RAM address, e.g. MOV A, 30H), register-indirect (a register holds the address, e.g. MOV A, @R0) and indexed (a base register plus offset, e.g. MOVC A, @A+DPTR).
They are necessary because different situations call for different ways of reaching data — a constant, a fast register, a fixed memory cell, or a computed address. This flexibility makes programs shorter, faster and easier to write.
[!ANSWER]
An addressing mode is the technique by which an instruction specifies its operand's location; it is necessary to give the programmer flexible and efficient ways of accessing data such as constants, registers and memory.
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.