微机原理课程设计
一、减奇法求平方根
1.程序源代码
.model small
.data
data1 dw 9h
x db 0
.code
start: mov ax,@data
mov ds,ax
mov ax,data1
mov bl,0
mov cx,1
loop1: sub ax,cx
inc bl
add cx,2h
cmp ax,0
jg loop1
mov x,bl
mov cl,4
shr bl,cl
add bl,30h
mov dl,bl
mov ah,02h
int 21h
and x,0fh
cmp x,09h
jb one
jmp two
one: mov dl,x
add dl,30h
int 21h
jmp over
two:mov dl,x
add dl,37h
int 21h
jmp over
over:mov ax,4c00h
int 21h
end start
评论0