CS Atlas GATE 2027
COA course
0 / 87 complete

COA/Phase 1 · Instructions & Addressing Modes

Chapter review LI-1.2 · Item 20 of 87

Addressing modes

Read at your own pace. Try the questions before opening the answers.

On this page

ACompressed recap

🧾

EA = where the operand finally is. Immediate (#c, 0 accesses), register (0), direct (EA = A, 1), indirect (EA = M[A], 2), register indirect (EA = R, 1). Displacement d(R): EA = d + R (indexed: big address in the instruction; base: address in the register). PC-relative: EA = next-instruction address + offset; offset = T − (X + L). (R)+ uses then increments; −(R) decrements then uses; step = operand size. Match constructs: constant–immediate, global–direct, pointer in register–register indirect, pointer in memory–indirect, A[i]–indexed, fields/locals–base, *p++–auto-increment, push–auto-decrement, relocatable code–PC-relative.

Table used below: M[200] = 500, M[300] = 400, M[400] = 700, M[500] = 600, M[600] = 900, M[700] = 800, M[800] = 300; R1 = 400, R2 = 200, R3 = 100.

BMerged rule card

1.2.1 Immediate, register, direct, indirect and register-indirect modes

  • EA = where the operand finally is.
  • Immediate #c: operand c (0 accesses). Register R: operand in R (0).
  • Direct A: EA = A (1). Indirect @A: EA = M[A] (2). Register indirect (R): EA = R (1).
  • Total references = fetch words + operand accesses + 1 if the result goes to memory.

1.2.2 Displacement modes: indexed, base, PC-relative; auto-increment and auto-decrement

  • Displacement d(R): EA = d + R. Indexed: big address in instruction, index in register. Base: address in register, small displacement.
  • PC-relative: EA = (address of next instruction) + offset; offset = T − (X + L).
  • (R)+: use M[R], then R += d. −(R): R −= d, then use M[R]. d = operand size.
  • Position-independent code: PC-relative branches.

1.2.3 Choosing modes: arrays, pointers, constants, relocatable code; memory references per mode

  • Constant → immediate; fixed global → direct; pointer in register → register indirect; pointer in memory → indirect.
  • A[i] → indexed; record field / locals → base + displacement; *p++ → auto-increment; push → auto-decrement.
  • Relocatable code → PC-relative (and base register).
  • Data accesses: immediate/register 0; indirect 2; all others 1.
  • Element address = base + i × size.

CInterleaved GATE-style questions

Q1NAT1 markDirect vs indirect

What does LOAD R0, @800 load?

Numerical answer: ________

Q2NAT1 markDisplacement

What does LOAD R0, 300(R2) load?

Numerical answer: ________

Q3MCQ1 markRegister indirect

LOAD R0, (R1) loads:

  • (A) 400
  • (B) 700
  • (C) 800
  • (D) 600

Q4NAT2 marksPC-relative

A 2-byte branch instruction at byte address 0x0200 has an 8-bit offset field holding 0xF0 (two's complement). What is the target address in decimal?

Numerical answer: ________

Q5NAT2 marksAuto-increment walk

R3 = 100. LOAD R0, (R3)+ runs 5 times with 100-byte steps. What does the fifth load fetch? (Use the table.)

Numerical answer: ________

Q6MCQ1 markMode choice

A local variable sits 12 bytes from the start of a block whose address is in register R6. The natural mode is:

  • (A) indirect
  • (B) PC-relative
  • (C) base with displacement 12(R6)
  • (D) immediate

Q7MSQ2 marksStatements

Which are true?

  • (A) Indirect addressing needs two data memory accesses.
  • (B) A pointer stored in memory is dereferenced with indirect mode.
  • (C) Auto-decrement suits pushing onto a stack that grows toward lower addresses.
  • (D) Register mode needs one data memory access.

Q8NAT2 marksMemory references

A two-word instruction ADD @A, @B (operands: memory indirect; result written to the first operand's location). How many memory accesses in total?

Numerical answer: ________

DAnswer Vault

Answer Vault

Try the questions first. Open when you are ready to check.

Q1 Answer: 4001 mark

EA = M[800] = 300; M[300] = 400.

Re-read: Lesson 1.2.1 — Immediate, register, direct, indirect and register-indirect modes

Q2 Answer: 6001 mark

EA = 300 + 200 = 500; M[500] = 600.

Re-read: Lesson 1.2.2 — Displacement modes: indexed, base, PC-relative; auto-increment and auto-decrement

Q3 Answer: (B)1 mark

EA = 400; M[400] = 700.

  • (A) is wrong: That is register mode.
  • (C) is wrong: That is M[700], one hop too far.
  • (D) is wrong: That is M[500].

Re-read: Lesson 1.2.1 — Immediate, register, direct, indirect and register-indirect modes

Q4 Answer: 4982 marks

PC = 0x202 = 514; 0xF0 = −16; target 514 − 16 = 498.

Re-read: Lesson 1.2.2 — Displacement modes: indexed, base, PC-relative; auto-increment and auto-decrement

Q5 Answer: 6002 marks

The EAs are 100, 200, 300, 400, 500 (R3 grows by 100 after each use). The fifth load fetches M[500] = 600.

Re-read: Lesson 1.2.2 — Displacement modes: indexed, base, PC-relative; auto-increment and auto-decrement

Q6 Answer: (C)1 mark

Register holds the start; the instruction holds the small offset.

  • (A) is wrong: The address is not stored in memory.
  • (B) is wrong: Data blocks are not addressed relative to the code.
  • (D) is wrong: The value is not a constant.

Re-read: Lesson 1.2.3 — Choosing modes: arrays, pointers, constants, relocatable code; memory references per mode

Q7 Answer: (A) (B) (C)2 marks

Register mode needs none.

  • (D) is wrong: The operand is in a register.

Re-read: Lesson 1.2.3 — Choosing modes: arrays, pointers, constants, relocatable code; memory references per mode

Q8 Answer: 72 marks

Fetch 2; first operand 2 (address + value); second operand 2; write result 1. Total 7.

Re-read: Lesson 1.2.3 — Choosing modes: arrays, pointers, constants, relocatable code; memory references per mode

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.