Google Search

Thursday, October 13, 2011

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


REVERSE A STRING

Aim: -   To write an assembly language program to reverse the given string.
                      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.

0 comments:

Post a Comment