思想:
输入一个2位数与一个1位数做除或乘法,
我的想法是先输入这2位数,输入运算符号,进行判断,当输入的是*时,
跳到SHENGFA,当不是*时,直接输出"/"做除法.
不过怎么输,它的结果都是 ":00 "望各柆帮下小女子
code SEGMENT
ASSUME CS:CODE
MAIN:
MOV AH,1
INT 21H
SUB AL,30H
MOV BL,10
MUL BL
MOV BX,AX
MOV AH,1
int 21h
sub AL,30H
CBW
ADD AX,BX
PUSH AX
MOV DL , '* '
MOV AH,1
INT 21H
CMP DL, '* '
JZ SHENG
MOV AH, 2
MOV DL, '/ '
INT 21H
MOV AH,1
INT 21H
SUB AL,30H
CBW
MOV BX,AX
POP AX
DIV BL
MOV AH,2
MOV DL,AL
ADD DL,30H
INT 21H
MOV AH ,4CH
INT 21H
SHENG PROC NEAR
MOV AH,1
INT 21H
SUB AL,30H
CBW
POP AX
MUL BX
PUSH DX
PUSH AX
MOV AH,2
MOV DL, '= '
INT 21H
POP AX
MOV AX,100
DIV BL
MOV AH,2
MOV DL,AL
ADD DL,30H
INT 21H
MOV AL,BH
CBW
MOV BL,10
DIV BL
MOV BH,AH
MOV DL,AL
ADD DL,30H
MOV AH,2
INT 21H
MOV AH,2
MOV DL,BH
ADD DL,30H
INT 21H
MOV AH,4CH
INT 21H
SHENG ENDP
CODE ENDS
END MAIN
------解决方案--------------------------------------------------------
;思想:
;输入一个2位数与一个1位数做除或乘法,
;我的想法是先输入这2位数,输入运算符号,进行判断,当输入的是*时,
;跳到SHENGFA,当不是*时,直接输出"/"做除法.
;不过怎么输,它的结果都是 ":00 "望各柆帮下小女子
;
;你的程序算法有问题,只能算25*2
;除法你到http://www.fego.cn/m_FegoArticle/Detail.aspx?articleid=2130&username=leevic
;看看
CODE SEGMENT
ASSUME CS:CODE
MAIN:
MOV AH,01H
INT 21H
SUB AL,30H
MOV BL,10
MUL BL
MOV BX,AX
MOV AH,01H
int 21h
sub AL,30H
CBW
ADD AX,BX
PUSH AX
;MOV DL , '* '
MOV AH,01H
INT 21H
;CMP DL, '* '
CMP AL, '* '
JZ SHENG
MOV DL,08H
MOV AH,02H
;MOV DL, '/ '
INT 21H
MOV AL,02H
MOV DL, '/ '
INT 21H
MOV AH,01H
INT 21H
CMP AL,0
JZ END_PROGRAM
SUB AL,30H
CBW
MOV BX,AX
MOV DL, '= '
MOV AH,02H
INT 21H
POP AX
DIV BL
;-----输出商数----
MOV BL,AH
MOV DL,AL
ADD DL,30H
MOV AH,02H
INT 21H
;-------------------------
MOV DL, '. '
MOV AH,02H
INT 21H
;-------输出余数-----
MOV AL,BL
MOV AH,0
MOV BH,10
DIV BH
MOV BL,AH
MOV DL,AL
ADD DL,30H
MOV AH,02H
INT 21H
MOV DL,BL
ADD DL,30H
INT 21H
END_PROGRAM:
MOV DL,07H
MOV AL,02H
INT 21H
MOV DL,0DH
MOV AH,02H
INT 21H
MOV DL,0AH
MOV AH,02H
INT 21H