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.
; ml p.asm
.model small
.stack 64h
.data
msg db "The square root of 900 is 30", 13,10,'$'
.code
mov ax, @data
mov ds, ax
mov bx, 30 ; bx=30
mov ax, 900 ; al=900
div bl ; result = 900/30
cmp ax, bx ; compare result and bx=30
jnz final ; if square root of 900 !=30
; else
lea dx, msg ; "The square root of 900 is 30"
mov ah, 09h ; print string
int 21h
final:
mov ah, 04ch ; exit
int 21h
end
Comments
Leave a comment