0
2.4kviews
Write an assembly language code to reverse a string of 10 characters.
written 7.0 years ago by | modified 3.0 years ago by |
Data Segment
str1 db 'String_Reverse','$' strlen1 dw $-str1
strrev db 20 dup(' ')
Data Ends
Code Segment
Assume cs:code, ds:data
Begin:
mov ax, data
mov ds, ax
mov es, ax
mov cx, strlen1
add cx, -2
lea si, str1
lea di, strrev
add si, strlen1
add si, -2
L1:
mov al, [si]
mov [di], al
dec si
inc di
loop L1
mov al, [si]
mov [di], al
inc di
mov dl, '$'
mov [di], dl
Print:
mov ah, 09h
lea dx, strrev
int 21h
Exit:
mov ax, 4c00h
int 21h
Code Ends
End Begin
ADD COMMENT
EDIT
1 Answer