ASM program to reverse the given string

Aim: – To write an assembly language program to reverse the given string.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
MOV AX, DATA
MOV DS, AX
MOV ES, AX
MOV CL, 03
LEA SI, A
MOV AX, 04
ADD DI, AX
L1:	MOV AL, [SI]
XCHG AL, [DI]
MOV [SI], AL
INC SI
DEC DI
LOOP L1
END

Result: The given string is reversed.

Leave a Reply