Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

there is the code using register indirect addressing mode reverse array 1234....

ID: 1928075 • Letter: T

Question

there is the code using register indirect addressing mode reverse array 1234....
what's wrong here?


; multi-segment executable file template.

data segment
data1 db '1','2','3','4'
pkey db "press any key...$"
ends

stack segment
dw 128 dup(0)
ends

code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax

; add your code here

mov bx,0
mov al,data1[ESI]
mov bx,3
mov dl,data1[EDI]

mov data1[EDI],al
mov data1[ESI],dl

mov bx,1
mov al,data1[ESI]
mov bx,2
mov dl,data1[EDI]

mov data1[EDI],al
mov data1[ESI],dl


lea dx, pkey
mov ah, 9
int 21h ; output string at ds:dx

; wait for any key....
mov ah, 1
int 21h

mov ax, 4c00h ; exit to operating system.
int 21h
ends

end start ; set entry point and stop the assembler.

Explanation / Answer

; multi-segment executable file template. data segment data1 db '1','2','3','4' pkey db "press any key...$" ends stack segment dw 128 dup(0) ends code segment start: ; set segment registers: mov ax, data mov ds, ax mov es, ax ; add your code here mov bx,0 mov al,data1[ESI] mov bx,3 mov dl,data1[EDI] mov data1[EDI],al mov data1[ESI],dl mov bx,1 mov al,data1[ESI] mov bx,2 mov dl,data1[EDI] mov data1[EDI],al mov data1[ESI],dl lea dx, pkey mov ah, 9 int 21h ; output string at ds:dx ; wait for any key.... mov ah, 1 int 21h mov ax, 4c00h ; exit to operating system. int 21h ends end start ;