programb62 - mov cl, buff+1 ; cl=character count mov bx,...

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

View Full Document Right Arrow Icon
Appendix B  Explanation : Firstly, we will accept the string by user. Load the length of string in CX. The space between characters is also counted. This string length is in Hex. Convert the Hex to decimal or BCD, Display the result.  Algorithm : Step I : Initialize the data segment. Step II : Input the string from user. Step III : Load the string length in CX. Step IV : Convert the string length from Hex to decimal. Step V : Display the result. Step VI : Stop.  Flowchart : Refer flowchart 62.  Program : print macro mes mov ah, 09h lea dx, mes int 21h endm .model small .data ms1 db 10, 13, "enter the string: $" ms2 db 10, 13, "$" buff db 81 db 0 db81 dup(0) .code Flowchart 62 mov ax, @data ;initialize data segment mov ds, ax print ms1 ; call macro print to display ms1 on screen mov ah, 0ah ; input the string lea dx, buff int 21h print ms2 ; call macro print to display ms2 on screen
Background image of page 1

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

View Full DocumentRight 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: mov cl, buff+1 ; cl=character count mov bx, 0000h ; bx=00 p1: cmp cl, 64h ; convert the hex value in cl to decimal jc p2 sub cl, 64h inc bl jmp p1 p2: cmp cl, 0ah jc p3 Microprocessors & Applications (UPTU) Appendix B sub cl, 0ah inc bh jmp p2 p3: mov ah, 02h add bl, 30h mov dl, bl int 21h mov ah, 02h add bh, 30h mov dl, bh int 21h mov ah, 02h add cl, 30h mov dl, cl int 21h mov ah, 4ch int 21h end Result : C:\programs>TASM LENSTR Turbo Assembler Version 3.0 Copyright (c) 1988, 1991 Borland International Assembling file: LENSTR.ASM Passes: 1 Remaining memory: 437k C:\programs>TLINK LENSTR Turbo Link Version 3.0 Copyright (c) 1987, 1990 Borland International Warning: No stack C:\programs>LENSTR ENTER THE STRING: TODAY 005 C:\programs>LENSTR ENTER THE STRING: TODAY IS MONDAY 015 C:\programs>...
View Full Document

Page1 / 2

programb62 - mov cl, buff+1 ; cl=character count mov bx,...

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