试编写一个汇编语言程序,要求依次输出ASCII码0---127对应的128个字符。

2024-12-20 14:25:02
推荐回答(2个)
回答1:

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

回答2:

mov cx,80
mov dl,0
again:mov ah,2
int 21
inc dl
loop again
int 20