0
31kviews
Write assembly language program for 8086 to reverse a string of characters.
1 Answer
1
4.0kviews
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
Please log in to add an answer.