{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

programb43 - jc p2 sub al 64h inc bl jmp p1 p2 cmp al 0ah...

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

View Full Document Right Arrow Icon
Microprocessors & Applications (UPTU) Appendix B  Explanation : To find the square of a number we multiply the number with itself. The result is stored in register AX in the Hex form. Now we have to convert the Hex number to decimal. Display the result.  Algorithm : Step I : Initialize the data section. Step II : Get the number. Step III : Compute the square of number. Result is stored in the AX register in Hex form. Step IV : Convert the Hex result to decimal. Step V : Display the result.  Flowchart : Refer flowchart 43.  Program : .model small .data no db 12 .code mov ax, @data Flowchart 43 mov ds, ax mov cl, no mov al, no mul cl mov bx, 00 p1: cmp al, 64h ; convert the hex value in cl to decimal
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: jc p2 sub al, 64h inc bl jmp p1 p2: cmp al, 0ah jc p3 sub al, 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 Microprocessors & Applications (UPTU) Appendix B add cl, 30h mov dl, al int 21h mov ah, 4ch int 21h end Result : C:\programs>TASM SQUARE Turbo Assembler Version 3.0 Copyright (c) 1988, 1991 Borland International Assembling file: SQUARE.ASM Error messages: None Warning messages: None Passes: 1 Remaining memory: 438k C:\programs>TLINK SQUARE Turbo Link Version 3.0 Copyright (c) 1987, 1990 Borland International Warning: No stack C:\programs>SQUARE 144 C:\programs>...
View Full Document

{[ snackBarMessage ]}