0

Consider the assembly program snippet below and, knowing that DS = 2000H and CS = 5000H, answer the following question:

INSTRUCTION

1       MOV AX, 3245H
2       MOV DL, O0H
3       MOV CL, 0AH
4       MOV BX, AX
5 LOOP: MOV [BX], DL
6       INC DL
7       INC BX
8       DEC CL
9       JNZ LOOP

(a) What is the content of the AX, DL, CL, BX registers in step 4?

(b) What physical memory location will be accessed the first time the program goes through step 5? What value is stored there?

can anybody help me?

Like, I got that BX =3245H. So the position where DL should be stored in the first iteration of the LOOP should be DL+BX = 2000H + 3245H = 5245H.

The problem is that 5245H > 5000H. So what should I do next, since the space destined for DS is "overtaken" in this operation?

On line 5 it seems that it passes the BL value to the memory position 3245H

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • 1
    I hope you mean DL+BX, not DS+BX. (And in the last paragraph, the DL not BL). Anyway, the offset part of the address is just [BX], so the full logical address is ds:bx = 2000h:3245h. Assuming this is real mode, that means the DS segment base is linear address 2000h << 4. Also, the question doesn't tell you what IP is, so you don't know where the code is relative to that CS value. So there's no reason to assume it's an error even if this did address memory that could also be reached via CS. – Peter Cordes Jan 30 '22 at 04:21
  • (wrote that backwards: hope you mean DS+BX) – Peter Cordes Jan 30 '22 at 13:28

0 Answers0