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.



Expert's answer

.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!

LATEST TUTORIALS
APPROVED BY CLIENTS