Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Stack Organization, Instruction Formats and All Addressing Modes

Lesson 13 of 17 in the free Computer Organization and Architecture notes on Siksha Sarovar, written by Rohit Jangra.

Addressing Mode Types

---

Stack Organization

A stack is a LIFO (Last-In, First-Out) data structure managed by the Stack Pointer (SP).

PUSH operation (SP grows toward high memory):

  • SP ← SP + 1
  • M[SP] ← DR (write data to top of stack)

POP operation:

  • DR ← M[SP] (read from top of stack)
  • SP ← SP − 1

Stack-based arithmetic — Reverse Polish Notation (RPN):

Expression: A + B × C in RPN = A B C × +

StepOperationStack Contents
1PUSH AA
2PUSH BA, B
3PUSH CA, B, C
4MUL (pop B,C; push B×C)A, B×C
5ADD (pop A, B×C; push result)A+B×C
6POP result(empty)

---

Comprehensive Addressing Modes (10 Modes)

#ModeDefinitionEA FormulaExample (x86)AdvantageDisadvantageMemory Accesses
1ImmediateOperand IS the constant in instructionNo EA (value is immediate)MOV AX, 5No memory access; fastFixed value only0
2DirectInstruction contains effective addressEA = address in instructionMOV AX, [1000]SimpleSmall address field1
3IndirectInstruction contains address of addressEA = M[address in instruction]MOV AX, @addrLarge address spaceExtra memory cycle2
4RegisterOperand in specified registerEA = registerMOV AX, BXFastest (no memory)Limited registers0
5Register IndirectRegister holds effective addressEA = contents of registerMOV AX, [BX]Flexible pointersExtra register access1
6Base RegisterEA = base reg + constant offsetEA = BR + displacementMOV AX, [BX+5]Code relocation1
7IndexEA = index reg + constantEA = IX + constantMOV AX, [SI+100]Array access1
8RelativeEA = PC + signed offsetEA = PC + offsetJMP +5 (short jump)Position-independent codeShort range1
9AutoincrementEA = reg; then reg ← reg+1EA = reg (post-increment)LODS (string ops)Loop iterationSide effects1
10StackImplicit SP; PUSH/POPEA = SP (implicit)PUSH AXNo address neededSequential access only1

---

---

📝 Exam Tips: - Immediate: fastest, no memory access; value is constant (limitation) - Indirect: most flexible (can reach any address), but SLOWEST (2 memory accesses) - Register: fastest after immediate (0 memory accesses) - Base+displacement: used for accessing structure fields; index: used for array elements - Relative addressing makes code position-independent (used in shared libraries)