Answer to Question #159064 in Assembler for xherry

Question #159064

Generate a program to proof that the square root of 30 is 900 using NASM Simulator (DOSBox), Briefly explain the steps of your program execution.



1
Expert's answer
2021-01-27T17:31:13-0500

.model small

.stack 64h

.data

           msg db "The square root of 900 is 30", 13,10,'$'

           x         dw 900

           y         dw 30

 

.code

           mov ax,@data

           mov ds,ax

 

           mov bx,y        ; bx=30

           mov ax,x        ; al=900

           div bl              ; result = 900/30

           cmp ax,bx      ; check result

           jnz fin           ; if square root of 900 !=30 goto fin

                                              ; else print msg

           lea dx,msg                 ; "The square root of 900 is 30"

           mov ah,09h                ; print string   

           int 21h

                                   

 fin:

           mov ah,04ch  ; exit

           int 21h

end


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS