ALP to reverse the given string

title reverse the given string
.model small
.stack 100h
main proc
mov ax, @data
mov ds, ax
mov si, offset string ;load base address of string in si register
mov cx, len ;move length in cx register
add si, cx ;character incrementing ie SI=SI+CX, one character beyond string
dec si
BACK: mov dl, [si] ;display character
mov ah, 2
int 21h
dec si ;decrementing address pointer
loop BACK
mov ax, 4c00h
int 21h
main endp
string db ‘This is an ALP’
len dw $-string
end main

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top