1个回答
展开全部
;----------------------------------
DATAS SEGMENT
IN_1 DB 100
N1 DB ?
BUFF DB 100 DUP('$')
MSG1 DB 10, 13, 'Please Input STR : $'
MSG2 DB 10, 13, 'The STR Long is : $'
CRLF DB 10, 13, '$'
DATAS ENDS
;----------------------------------
CODES SEGMENT
ASSUME CS:CODES, DS:DATAS
START:
MOV AX, DATAS
MOV DS, AX
MOV DX, OFFSET MSG1 ;提示输入.
MOV AH, 09H
INT 21H
MOV DX, OFFSET IN_1 ;接收键盘输入.
MOV AH, 0AH
INT 21H
MOV DX, OFFSET CRLF ;回车换行.
MOV AH, 09H
INT 21H
MOV DX, OFFSET BUFF ;输出原字符串.
MOV AH, 09H
INT 21H
MOV DX, OFFSET MSG2 ;提示长度.
MOV AH, 09H
INT 21H
;----------------------------------
MOV AL, N1
MOV BL, 10
MOV CX, 0
L1:
MOV AH, 0
DIV BL
PUSH AX
INC CX
AND AL, AL
JNZ L1
L2:
POP DX
MOV DL, DH
ADD DL, 48
MOV AH, 2
INT 21H
LOOP L2
;----------------------------------
MOV AH, 4CH
INT 21H
CODES ENDS
END START
;----------------------------------
DATAS SEGMENT
IN_1 DB 100
N1 DB ?
BUFF DB 100 DUP('$')
MSG1 DB 10, 13, 'Please Input STR : $'
MSG2 DB 10, 13, 'The STR Long is : $'
CRLF DB 10, 13, '$'
DATAS ENDS
;----------------------------------
CODES SEGMENT
ASSUME CS:CODES, DS:DATAS
START:
MOV AX, DATAS
MOV DS, AX
MOV DX, OFFSET MSG1 ;提示输入.
MOV AH, 09H
INT 21H
MOV DX, OFFSET IN_1 ;接收键盘输入.
MOV AH, 0AH
INT 21H
MOV DX, OFFSET CRLF ;回车换行.
MOV AH, 09H
INT 21H
MOV DX, OFFSET BUFF ;输出原字符串.
MOV AH, 09H
INT 21H
MOV DX, OFFSET MSG2 ;提示长度.
MOV AH, 09H
INT 21H
;----------------------------------
MOV AL, N1
MOV BL, 10
MOV CX, 0
L1:
MOV AH, 0
DIV BL
PUSH AX
INC CX
AND AL, AL
JNZ L1
L2:
POP DX
MOV DL, DH
ADD DL, 48
MOV AH, 2
INT 21H
LOOP L2
;----------------------------------
MOV AH, 4CH
INT 21H
CODES ENDS
END START
;----------------------------------
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询