汇编语言 字符串逆序输出
DATASSEGMENTXXDB0AH,0DH,"pleaseinputstring:$"BVFDB30DB?DB30DUP(?)DATASENDSSSEGSEGMENT...
DATAS SEGMENT
XX DB 0AH,0DH,"please input string:$"
BVF DB 30
DB ?
DB 30 DUP(?)
DATAS ENDS
SSEG SEGMENT STACK
STK DB 100 DUP(?)
SSEG ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATAS,SS:SSEG
START:
MOV AX,DATAS
MOV DS,AX
LEA DX,XX
MOV AH,9
INT 21H
LEA DX,BVF
MOV AH,0AH
INT 21H
MOV CL,BVF+1
AND CX,0FH
BIAOJI:MOV AH,2
MOV DL,BVF[CX];这里
INT 21H
LOOP BIAOJI
MOV AH,4CH
INT 21H
CODE ENDS
END START
能给我讲讲错在哪里吗 展开
XX DB 0AH,0DH,"please input string:$"
BVF DB 30
DB ?
DB 30 DUP(?)
DATAS ENDS
SSEG SEGMENT STACK
STK DB 100 DUP(?)
SSEG ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATAS,SS:SSEG
START:
MOV AX,DATAS
MOV DS,AX
LEA DX,XX
MOV AH,9
INT 21H
LEA DX,BVF
MOV AH,0AH
INT 21H
MOV CL,BVF+1
AND CX,0FH
BIAOJI:MOV AH,2
MOV DL,BVF[CX];这里
INT 21H
LOOP BIAOJI
MOV AH,4CH
INT 21H
CODE ENDS
END START
能给我讲讲错在哪里吗 展开
2个回答
展开全部
DATAS SEGMENT
XX DB 0AH,0DH,"please input string:$"
BVF DB 30
DB ?
DB 30 DUP(?)
DATAS ENDS
SSEG SEGMENT STACK
STK DB 100 DUP(?)
SSEG ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATAS,SS:SSEG
START:
MOV AX,DATAS
MOV DS,AX
LEA DX,XX
MOV AH,9
INT 21H
LEA DX,BVF
MOV AH,0AH
INT 21H
MOV CL,BVF+1
AND CX,0FH
MOV BX,CX
ADD BX,1 ;确定BX的值,找到最后一个元素的偏移位置
BIAOJI:MOV AH,2
MOV DL,BVF[BX] ;这里括号内必须是BX,SI,DI寄存器其中之一
INT 21H
DEC BX ;指针往前移
LOOP BIAOJI
MOV AH,1
INT 21H ;暂停一下,查看输出的字符。若无,则一闪而过
MOV AH,4CH
INT 21H
CODE ENDS
END START
展开全部
;字符串逆序输出
DATAS SEGMENT
XX DB 0AH, 0DH, "please input string: "
YY DB 10, 13, '$'
BVF DB 30
DB ?
INB DB 30 DUP(?)
DATAS ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATAS
START:
MOV AX, DATAS
MOV DS, AX
LEA DX, XX
MOV AH, 9
INT 21H
LEA DX, BVF
MOV AH, 10
INT 21H
MOV CL, BVF + 1
CMP CL, 0
JE EXIT
MOV CH, 0
LEA BX, INB
ADD BX, CX
LEA DX, YY
MOV AH, 9
INT 21H
MOV AH, 2
BIAOJI:
DEC BX
MOV DL, [BX]
INT 21H
LOOP BIAOJI
EXIT:
MOV AH, 4CH
INT 21H
CODE ENDS
END START
DATAS SEGMENT
XX DB 0AH, 0DH, "please input string: "
YY DB 10, 13, '$'
BVF DB 30
DB ?
INB DB 30 DUP(?)
DATAS ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATAS
START:
MOV AX, DATAS
MOV DS, AX
LEA DX, XX
MOV AH, 9
INT 21H
LEA DX, BVF
MOV AH, 10
INT 21H
MOV CL, BVF + 1
CMP CL, 0
JE EXIT
MOV CH, 0
LEA BX, INB
ADD BX, CX
LEA DX, YY
MOV AH, 9
INT 21H
MOV AH, 2
BIAOJI:
DEC BX
MOV DL, [BX]
INT 21H
LOOP BIAOJI
EXIT:
MOV AH, 4CH
INT 21H
CODE ENDS
END START
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询