试编写一个汇编语言程序,要求依次输出ASCII码0---127对应的128个字符。
2个回答
展开全部
DATAS SEGMENT
MSG DB 0,0,"H ","$"
CR DB 13,10,"$"
TAB1 DB "0123456789ABCDEF"
DATAS ENDS
STACKS SEGMENT
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,ES:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
MOV ES,AX
MOV CX,127
MOV DL,0
MOV SI,OFFSET TAB1
MOV DI,OFFSET MSG
AG: PUSH CX
PUSH DX
MOV AX,0
MOV AL,DL
MOV BL,10H
DIV BL
MOV BX,0
MOV BL,AH
MOV DH,[SI+BX]
MOV [DI+1],DH
MOV BL,AL
MOV DH,[SI+BX]
MOV [DI],DH
PUSH DX
MOV DX,OFFSET MSG
MOV AH,9
INT 21H
POP DX
MOV AH,2
INT 21H
PUSH AX
MOV DX,OFFSET CR
MOV AH,9
INT 21H
POP DX
POP DX
POP CX
INC DL
LOOP AG
MOV AH,4CH
INT 21H
CODES ENDS
END START
MSG DB 0,0,"H ","$"
CR DB 13,10,"$"
TAB1 DB "0123456789ABCDEF"
DATAS ENDS
STACKS SEGMENT
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,ES:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
MOV ES,AX
MOV CX,127
MOV DL,0
MOV SI,OFFSET TAB1
MOV DI,OFFSET MSG
AG: PUSH CX
PUSH DX
MOV AX,0
MOV AL,DL
MOV BL,10H
DIV BL
MOV BX,0
MOV BL,AH
MOV DH,[SI+BX]
MOV [DI+1],DH
MOV BL,AL
MOV DH,[SI+BX]
MOV [DI],DH
PUSH DX
MOV DX,OFFSET MSG
MOV AH,9
INT 21H
POP DX
MOV AH,2
INT 21H
PUSH AX
MOV DX,OFFSET CR
MOV AH,9
INT 21H
POP DX
POP DX
POP CX
INC DL
LOOP AG
MOV AH,4CH
INT 21H
CODES ENDS
END START
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询