Adam’s Engineering College, Paloncha ECE Department –MPI LAB Experiment No.: 14 Page 1 of 2
Year : III/IV B.Tech II Semester
REVERSE A STRING
Aim: - To write an assembly language program to reverse the given string. Registers: - AX Description: - Reversing the given string and the result is stored in the pointer. Ports:- None. DATA SEGMENT A DB ‘MPI LAB’ DATA ENDS CODE SEGMENT ASSUME CS: CODE, DS: DATA, ES: DATA START:
L1:
Lab in-charge
MOV AX, DATA MOV DS, AX MOV ES, AX MOV CL, 03 LEA SI, A MOV AX, 04 ADD DI, AX MOV AL, [SI] XCHG AL, [DI] MOV [SI], AL HOD, ECE
Adam’s Engineering College, Paloncha ECE Department –MPI LAB Experiment No.: 14 Page 2 of 2
Year : III/IV B.Tech II Semester
INC SI DEC DI LOOP L1 CODE ENDS END START Result: The given string is reversed.
Lab in-charge
HOD, ECE