划分溢出错误汇编emu8086

时间:2013-10-23 14:43:41

标签: assembly x86 overflow divide

我有一个关于此的功课,作业的目的是在装配(emu8086)中计算这个f(x)= x ^ 2 + 2x-3。问题是,当我划分结果以便打印它时,我得到一个除法溢出错误,我不知道为什么或如何解决它。有人可以帮忙吗?

TITLE MYPROGRAM

DEDOMENA SEGMENT      

protropimsg db "Dwsse arithmo x:",10,13,"$"
apotelesmamsg db 10,13,"to apotelesma einai",10,13,"$"
x_number db 0
tmp1 db 0
f_result dw 0
dekada db 0
monada db 0

DEDOMENA ENDS


KODIKAS SEGMENT

ARXH:MOV AX,DEDOMENA
MOV DS,AX

LEA DX,protropimsg
MOV AH,09
INT 21h

MOV AH,01h
INT 21h

SUB AH,30h
MOV x_number,AH

MOV AH,x_number
MOV BH,x_number
ADD AH,BH
MOV CH,3
SUB AH,CH

MOV tmp1,AH

MOV AL,x_number
MOV DL,x_number
MUL DL

MOV BL,tmp1
MOV BH,0
ADD AX,BX
MOV f_result,AX

MOV AX,f_result
MOV BL,10 
DIV BL
MOV dekada,AL
MOV monada,AH

LEA DX,apotelesmamsg
MOV AH,09
INT 21h

MOV DL,dekada
ADD DL,30h
MOV AH,02h  
INT 21h

MOV DL,monada
ADD DL,30h
MOV AH,02h  
INT 21h


MOV AH,4CH    
INT 21H

KODIKAS ENDS
END ARXH

1 个答案:

答案 0 :(得分:0)

这看起来不正确:

MOV AH,01h
INT 21h

SUB AH,30h
MOV x_number,AH

中断21h/AH=01h会返回AL中的字符,而不会返回AH中的字符。