这是我写的判断二元一次方程是否有根,但是有些问题,就是老是输出tag=0.就是没有根。麻烦各位帮看一下是那里出问题了。先谢谢了。
.model small
.stack
.data
_a db ?
_b db ?
_c db ?
tag db ?
msg1 db'please input a=' , '$'
msg2 db'please input b=', '$'
msg3 db'please input c=', '$' ;10
msg4 db'tag=1, this formulia has root', '$'
msg5 db'tag=0, this formulia has not root', '$'
.code
.startup
mov dx,offset msg1
mov ah,9
int 21h
mov ah,0h
int 16h
mov _a,al ;21
mov dl,al
mov ah,2
int 21h
call dpcrlf
mov dx,offset msg2
mov ah,9
int 21h
mov ah,0h
int 16h ;30
mov _b,al ;
mov dl,al
mov ah,2
int 21h
call dpcrlf
mov dx,offset msg3
mov ah,9
int 21h
mov ah,0h
int 16h ;40
mov _c,al
mov dl,al
mov ah,2
int 21h
call dpcrlf
;start0:mov ah,9
; int 21h
; xor ax,ax
; mov ah,0
; int 16h
; mov dx,ax
;mov ah,2
;int 21h
start1:mov al,_b ;33
imul al
mov bx,ax
mov al,_a
imul _c
mov cx,4 ;37
imul cx
xor dx,dx
mov dx,ax
cmp bx,dx
jae yes
jmp done
yes: mov tag,1
mov dx,offset msg4
mov ah,09h
int 21h
.exit 0
done: mov tag,0
mov dx,offset msg5
mov ah,09h
int 21h
.exit 0
dpcrlf proc
push ax
push dx
mov dl,0dh
mov ah,2
int 21h
mov dl,0ah
mov ah,2
int 21h
pop dx
pop ax
ret
dpcrlf endp
end