programb63 - buff db 81 db db 81 dup(0.code Flowchart 63...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Appendix B  Explanation : Accept the string from user using function 09H under INT 21H. Accept this string after enter is pressed into buffer. Load the string length in CX. Load the length of string also in DI. Character by character reverse the string by taking the last element first. Display the result i.e. reversed string.  Algorithm : Step I : Initialize the data segment. Step II : Accept the string from user. Step III : CX = string length. Step IV : Load the string in BX. Step V : DI = string length. Step VI : DL = [BX + DI] Step VII : Decrement DI to next character, if DI 0. go to step 6. Step VIII : Display the reversed data in ‘DL’. Step IX : Stop.  Flowchart : Refer flowchart 63.  Program : print macro mes ; initialize macro mov ah, 09h lea dx, mes int 21h endm .model small .data ms1 db 10, 13, "enter the string: $" ms2 db 10, 13, "$" ms3 db 10, 13, "reverse string is: $"
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: buff db 81 db db 81 dup(0) .code Flowchart 63 mov ax, @data mov ds, ax print ms1 ; call macro to diplay ms1 on screen mov ah, 0ah ; input the string till enter is pressed lea dx, buff int 21h mov ch, 00 ; initialize ch=00 mov cl, buff+1 ; cl= length is string lea bx, buff ; inc bx Microprocessors & Applications (UPTU) Appendix B mov di, cx print ms2 back: mov ah, 02h mov dl, [bx+di] int 21h dec di jnz back mov ah, 4ch ; normal termination to dos int 21h end Result : C:\programs>TASM REVERSE Turbo Assembler Version 3.0 Copyright (c) 1988, 1991 Borland International Assembling file: REVERSE.ASM Error messages: None Warning messages: None Passes: 1 Remaining memory: 437k C:\programs>TLINK REVERSE Turbo Link Version 3.0 Copyright (c) 1987, 1990 Borland International Warning: No stack C:\programs>REVERSE ENTER THE STRING: ABCDEFGHI IHGFEDCBA C:\programs>...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

programb63 - buff db 81 db db 81 dup(0.code Flowchart 63...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online