0

我对此有一个作业,作业的目的是在汇编(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
4

1 回答 1

0

这看起来不正确:

MOV AH,01h
INT 21h

SUB AH,30h
MOV x_number,AH

中断21h/AH=01h返回字符 in AL,而不是 in AH

于 2013-10-23T16:23:15.600 回答