急求 汇编语言程序设计 题目自拟 但不要太难 行数不少于200 10
1个回答
展开全部
;**************************************************
;* 子程序名:PRINT *
;* 子程序功能:分别用十六进制和二进制显示AL的ASCII*
;* 入口参数:AL *
;* 出口参数:显示 *
;* 用到寄存器:对所有寄存器均无影响 *
;**************************************************
STACK SEGMENT PARA STACK 'STACK'
DW 256 DUP(?)
TOP LABEL WORD
STACK ENDS
DATA SEGMENT
STRING DB 128 DUP (?)
SH DB (?)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,SS:STACK
START:MOV AX,STACK
MOV SS,AX
MOV SP,OFFSET TOP
MOV AX ,DATA
MOV DS,AX
AGAIN1: MOV AH,01H
INT 21H
CMP AL,1BH
JZ Q1
CALL PRINT
JMP AGAIN1
Q1: JMP Q
PRINT PROC NEAR
PUSH AX
PUSH CX
PUSH DI
MOV SH,AL
AND AX,00FFH
MOV CL,04H
SHL AX,CL
ROR AL,CL
LEA DI,STRING
MOV BYTE PTR [DI],3AH
INC DI
CMP AH,0AH
JNL HH
ADD AH,30H
MOV BYTE PTR [DI],AH
INC DI
JMP ONE1
HH: ADD AH,37H
MOV BYTE PTR [DI],AH
INC DI
ONE1:CMP AL,0AH
JNL HH0
ADD AL,30H
MOV BYTE PTR [DI],AL
INC DI
JMP TWO
HH0: ADD AL,37H
MOV BYTE PTR [DI],AL
INC DI
TWO: MOV BYTE PTR [DI],48H
INC DI
MOV BYTE PTR [DI],00H
INC DI
MOV CX,08H
AGAIN: ROL SH,01
JB ONE
JNB ZERO
LOOP AGAIN
JMP TT
ONE:MOV BYTE PTR [DI],31H
INC DI
LOOP AGAIN
JMP TT
ZERO:MOV BYTE PTR [DI],30H
INC DI
LOOP AGAIN
TT: MOV BYTE PTR [DI],24H
LEA DX,STRING
MOV AH,09H
INT 21H
MOV AH,02H
MOV DL,0AH
INT 21H
MOV DL,0DH
INT 21H
POP AX
POP CX
POP DI
RET
PRINT ENDP
Q: CALL PRINT
MOV AH,4CH
INT 21H
CODE ENDS
END START
;* 子程序名:PRINT *
;* 子程序功能:分别用十六进制和二进制显示AL的ASCII*
;* 入口参数:AL *
;* 出口参数:显示 *
;* 用到寄存器:对所有寄存器均无影响 *
;**************************************************
STACK SEGMENT PARA STACK 'STACK'
DW 256 DUP(?)
TOP LABEL WORD
STACK ENDS
DATA SEGMENT
STRING DB 128 DUP (?)
SH DB (?)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,SS:STACK
START:MOV AX,STACK
MOV SS,AX
MOV SP,OFFSET TOP
MOV AX ,DATA
MOV DS,AX
AGAIN1: MOV AH,01H
INT 21H
CMP AL,1BH
JZ Q1
CALL PRINT
JMP AGAIN1
Q1: JMP Q
PRINT PROC NEAR
PUSH AX
PUSH CX
PUSH DI
MOV SH,AL
AND AX,00FFH
MOV CL,04H
SHL AX,CL
ROR AL,CL
LEA DI,STRING
MOV BYTE PTR [DI],3AH
INC DI
CMP AH,0AH
JNL HH
ADD AH,30H
MOV BYTE PTR [DI],AH
INC DI
JMP ONE1
HH: ADD AH,37H
MOV BYTE PTR [DI],AH
INC DI
ONE1:CMP AL,0AH
JNL HH0
ADD AL,30H
MOV BYTE PTR [DI],AL
INC DI
JMP TWO
HH0: ADD AL,37H
MOV BYTE PTR [DI],AL
INC DI
TWO: MOV BYTE PTR [DI],48H
INC DI
MOV BYTE PTR [DI],00H
INC DI
MOV CX,08H
AGAIN: ROL SH,01
JB ONE
JNB ZERO
LOOP AGAIN
JMP TT
ONE:MOV BYTE PTR [DI],31H
INC DI
LOOP AGAIN
JMP TT
ZERO:MOV BYTE PTR [DI],30H
INC DI
LOOP AGAIN
TT: MOV BYTE PTR [DI],24H
LEA DX,STRING
MOV AH,09H
INT 21H
MOV AH,02H
MOV DL,0AH
INT 21H
MOV DL,0DH
INT 21H
POP AX
POP CX
POP DI
RET
PRINT ENDP
Q: CALL PRINT
MOV AH,4CH
INT 21H
CODE ENDS
END START
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询