To Display reverse of entered String > Assembly Program
To Display reverse of entered String > Assembly Program
Microprocessor
assume cs:code,ds:data
data segment
msg1 db 0Ah,0Dh, 'Enter a string:$'
msg2 db 0Ah,0Dh, 'Reverse of string:$'
msg3 db 08h
db ?
db 8 dup(?)
data ends
code segment
start:
mov bx,data
mov ds,bx
lea dx,msg1
mov ah,09h
int 21h
lea dx,msg3
mov ah,0Ah
int 21h
lea dx,msg2
mov ah,09h
int 21h
lea bx,msg3
inc bx
mov ch,00h
mov cl,[bx]
mov si,cx
print:
mov dl,[bx+si]
mov ah,02h
int 21h
dec si
loop print
mov ah,4ch
int 21h
code ends
end start
Output:
C:\TASM>tasm rev.asm
Turbo Assembler Version 3.0 Copyright (c) 1988, 1991 Borland International
Assembling file: rev.asm
Error messages: None
Warning messages: None
Passes: 1
Remaining memory: 460k
C:\TASM>tlink rev
Turbo Link Version 2.0 Copyright (c) 1987, 1988 Borland International
Warning: no stack
C:\TASM>rev.exe
Enter a string:pratham
Reverse of string:mahtarp
C:\TASM>
Comments
Post a Comment