| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1701 人关注过本帖
标题:[求助]2数相加,相乘问题 各位朋友近
取消只看楼主 加入收藏
yyj47
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2006-12-3
收藏
 问题点数:0 回复次数:6 
[求助]2数相加,相乘问题 各位朋友近

大家帮忙改一下 让人看上去不像是吵的 谢谢拉

键盘输入2个数 相加
DATA SEGMENT
A1 DB 100 DUP(?)
A2 DB 100 DUP(?)
A3 DB 101 DUP(?)
A4 DB 0DH,0AH,'Are you ready?(Y/N)$'
A5 DB 0DH,0AH,'Please enter your first number:$'
A6 DB 0DH,0AH,'Please enter your second number:$'
A7 DB 0DH,0AH,'The answer is:$'
A8 DB 0DH,0AH,'Your enter number is error',0DH,'$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
BEGIN PROC
L1: MOV DX,OFFSET A4
MOV AH,09H
INT 21H
L2: MOV AH,01H
INT 21H
MOV BL,AL
CMP BL,'Y'
JE L3
CMP BL,'y'
JE L3
CMP BL,'N'
JE L4
CMP BL,'n'
JE L4
JMP L1
L3: CALL NUM1
CALL NUM2
CALL ADD1
CALL PRINT
JMP L1
L4: MOV AH,4CH
INT 21H
BEGIN ENDP
NUM1 PROC
N11: MOV SI,00H
MOV CX,64H
N12: MOV A1[SI],00H
MOV A3[SI],00H
INC SI
LOOP N12
MOV A3[SI],00H
MOV DX,OFFSET A5
MOV AH,09H
INT 21H
MOV SI,00H
N13: MOV AH,01H
INT 21H
MOV BL,AL
CMP BL,30H
JB N14
CMP BL,39H
JA N15
JMP N16
N14: CMP BL,0DH
JE N17
N15: MOV DX,OFFSET A8
MOV AH,09H
INT 21H
JMP N11
N16: SUB BL,30H
MOV A1[SI],BL
INC SI
JMP N13
N17: DEC SI
MOV BP,SI
RET
NUM1 ENDP
NUM2 PROC
N21: MOV SI,00H
MOV CX,64H
N22: MOV A2[SI],00H
INC SI
LOOP N22
MOV DX,OFFSET A6
MOV AH,09H
INT 21H
MOV SI,00H
N23: MOV AH,01H
INT 21H
MOV BL,AL
CMP BL,30H
JB N24
CMP BL,39H
JA N25
JMP N26
N24: CMP BL,0DH
JE N27
N25: MOV DX,OFFSET A8
MOV AH,09H
INT 21H
JMP N21
N26: SUB BL,30H
MOV A2[SI],BL
INC SI
JMP N23
N27: DEC SI
MOV DX,SI
RET
NUM2 ENDP
ADD1 PROC
MOV SI,BP
MOV DI,DX
CMP SI,DI
JA AD1
MOV CX,BP
JMP AD2
AD1: MOV CX,DX
AD2: INC CX
CLC
MOV BP,00H
JMP AD3
AD8: DEC SI
DEC DI
AD3: MOV BL,A1[SI]
MOV AL,A2[DI]
ADC AL,BL
AAA
MOV A3[BP],AL
INC BP
LOOP AD8
LAHF
CMP SI,DI
JB AD5
CMP SI,DI
JE AD7
MOV CX,SI
AD4: SAHF
AD9: DEC SI
MOV AL,A1[SI]
ADC AL,00H
AAA
MOV A3[BP],AL
INC BP
LOOP AD9
LAHF
JMP AD7
AD5: MOV CX,DI
AD6: SAHF
AD11: DEC DI
MOV AL,A2[DI]
ADC AL,00H
AAA
MOV A3[BP],AL
INC BP
LOOP AD11
LAHF
AD7: SAHF
MOV AL,A3[BP]
ADC AL,00H
AAA
MOV A3[BP],AL
RET
ADD1 ENDP
PRINT PROC
MOV DX,OFFSET A7
MOV AH,09H
INT 21H
MOV CX,64H
MOV SI,64H
P1: MOV BL,A3[SI]
CMP BL,00H
JNE P2
DEC SI
LOOP P1
MOV DL,30H
MOV AH,02H
INT 21H
JMP P4
P2: MOV CX,SI
INC CX
P3: MOV AL,A3[SI]
OR AL,30H
MOV AH,02H
MOV DL,AL
INT 21H
DEC SI
LOOP P3
P4: RET
PRINT ENDP
CODE ENDS
END START

搜索更多相关主题的帖子: 相乘 相加 朋友 
2006-12-03 22:22
yyj47
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2006-12-3
收藏
得分:0 

输入2数相乘
DATA SEGMENT
A1 DB 50 DUP(?)
A2 DB 50 DUP(?)
A3 DB 101 DUP(?)
A9 DB 100 DUP(?)
A10 DB 100 DUP(?)
A11 DB 1(?)
A4 DB 0DH,0AH,'Are you ready?(Y/N)$'
A5 DB 0DH,0AH,'Please enter your first number:$'
A6 DB 0DH,0AH,'Please enter your second number:$'
A7 DB 0DH,0AH,'The answer is:$'
A8 DB 0DH,0AH,'Your enter number is error',0DH,'$'
DATA ENDS
MYSTA SEGMENT PARA STACK 'STACK'
DB 20 DUP(?)
MYSTA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,SS:MYSTA
START: MOV AX,DATA
MOV DS,AX
MOV AX,MYSTA
MOV SS,AX
BEGIN PROC
L1: MOV A11[00],00H
MOV DX,OFFSET A4
MOV AH,09H
INT 21H
L2: MOV AH,01H
INT 21H
MOV BL,AL
CMP BL,'Y'
JE L3
CMP BL,'y'
JE L3
CMP BL,'N'
JE L4
CMP BL,'n'
JE L4
JMP L1
L3: CALL NUM1
CALL NUM2
CALL MUL1
CALL PRINT
JMP L1
L4: MOV AH,4CH
INT 21H
BEGIN ENDP
NUM1 PROC
N11: MOV SI,00H
MOV CX,64H
N12: MOV A1[SI],00H
INC SI
LOOP N12
MOV A3[SI],00H
MOV DX,OFFSET A5
MOV AH,09H
INT 21H
MOV SI,00H
N13: MOV AH,01H
INT 21H
MOV BL,AL
CMP BL,'-'
JE N18
CMP BL,30H
JB N14
CMP BL,39H
JA N15
JMP N16
N14: CMP BL,0DH
JE N17
N15: MOV DX,OFFSET A8
MOV AH,09H
INT 21H
JMP N11
N16: SUB BL,30H
MOV A1[SI],BL
INC SI
JMP N13
N18: CMP SI,00H
JNE N15
NOT A11[00]
JMP N13
N17: CMP SI,00H
JE N15
DEC SI
MOV BP,SI
RET
NUM1 ENDP
NUM2 PROC
N21: MOV SI,00H
MOV CX,64H
N22: MOV A2[SI],00H
MOV A10[SI],00H
INC SI
LOOP N22
MOV DX,OFFSET A6
MOV AH,09H
INT 21H
MOV SI,00H
N23: MOV AH,01H
INT 21H
MOV BL,AL
CMP BL,'-'
JE N28
CMP BL,30H
JB N24
CMP BL,39H
JA N25
JMP N26
N24: CMP BL,0DH
JE N27
N25: MOV DX,OFFSET A8
MOV AH,09H
INT 21H
JMP N21
N26: SUB BL,30H
MOV A2[SI],BL
INC SI
JMP N23
N28: CMP SI,00H
JNE N25
NOT A11[00]
JMP N23
N27: CMP SI,00H
JE N25
DEC SI
MOV DX,SI
RET
NUM2 ENDP
MUL1 PROC
MOV SI,64H
MOV CX,64H
M11: MOV A3[SI],00H
INC SI
LOOP M11
MOV SI,DX
MOV DI,00H
MOV CX,DX
INC CX
M12: MOV BL,A2[SI]
MOV A10[DI],BL
INC DI
DEC SI
LOOP M12
MOV CX,DI
MOV DI,00H
M13: MOV SI,BP
PUSH BP
PUSH CX
PUSH DI
MOV AH,A10[DI]
CMP AH,00H
JE M14
CALL MUL2
CALL ADD1
M14: POP DI
INC DI
POP CX
POP BP
LOOP M13
RET
MUL1 ENDP
MUL2 PROC
MOV CX,64H
MOV BP,00H
M22: MOV A9[BP],00H
INC BP
LOOP M22
MOV CX,SI
INC CX
MOV BP,00H
M21: MOV AL,A1[SI]
MOV BL,A10[DI]
MUL BL
AAM
MOV BL,AH
MOV BH,A9[BP]
ADC AL,BH
AAA
MOV A9[BP],AL
INC BP
MOV AL,A9[BP]
ADC AL,BL
AAA
MOV A9[BP],AL
DEC SI
LOOP M21
RET
MUL2 ENDP
ADD1 PROC
MOV CX,BP
INC CX
MOV SI,00H
AD1: MOV AL,A9[SI]
MOV BL,A3[DI]
ADC AL,BL
AAA
MOV A3[DI],AL
INC DI
INC SI
LOOP AD1
RET
ADD1 ENDP
PRINT PROC
MOV DX,OFFSET A7
MOV AH,09H
INT 21H
MOV CX,64H
MOV SI,64H
P1: MOV BL,A3[SI]
CMP BL,00H
JNE P2
DEC SI
LOOP P1
JMP P3
P2: MOV BL,A11[00]
CMP BL,00H
JE P3
MOV DL,'-'
MOV AH,02H
INT 21H
P3: MOV CX,64H
MOV SI,64H
P4: MOV BL,A3[SI]
CMP BL,00H
JNE P5
DEC SI
LOOP P4
MOV DL,30H
MOV AH,02H
INT 21H
JMP P7
P5: MOV CX,SI
INC CX
P6: MOV AL,A3[SI]
OR AL,30H
MOV AH,02H
MOV DL,AL
INT 21H
DEC SI
LOOP P6
P7: RET
PRINT ENDP
CODE ENDS
END START

2006-12-03 22:23
yyj47
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2006-12-3
收藏
得分:0 
大家帮忙改一下 让人看上去不像是吵的 谢谢拉
2006-12-03 22:23
yyj47
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2006-12-3
收藏
得分:0 
楼上的朋友 你给的这段怎么我用MASM不行?
2006-12-04 16:32
yyj47
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2006-12-3
收藏
得分:0 

朋友 真不行啊 抱了6个错

2006-12-04 17:15
yyj47
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2006-12-3
收藏
得分:0 
能发个你用的编译器的下载地址吗?
2006-12-04 17:27
yyj47
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2006-12-3
收藏
得分:0 
谢谢拉 今天晚上就要交作业了 郁闷
2006-12-04 17:33
快速回复:[求助]2数相加,相乘问题 各位朋友近
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027744 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved