ENTER MACRO ;定义宏 回车
MOV DL,0AH
MOV AH,2H
INT 21H
MOV DL,0DH
MOV AH,2H
INT 21H
ENDM
.MODEL LONG
.STACK
DB 50 DUP(?)
.DATA
MSG DB 'HELLO WORLD!$'
.CODE
MAIN PROC FAR
START:
PUSH DS
SUB AX,AX
PUSH AX
MOV AX,@DATA ;输出一个以$结尾的字符串
MOV DS,AX
MOV DX,OFFSET MSG
MOV AH,9
INT 21H
ENTER
MOV BX,OFFSET MSG
LOP:
PUSH BX
MOV DL,[BX]
MOV BL,DL
MOV CH,2 ;以16进制输出低8位
LOPHEX:
MOV CL,4
ROL BL,CL ;循环左移4位
MOV AL,BL
AND AL,0FH
ADD AL,30H
CMP AL,3AH
JL PRINTOUT
ADD AL,7H
PRINTOUT:
MOV DL,AL
MOV AH,2H
INT 21H
DEC CH
JNZ LOPHEX
MOV DL,00H
MOV AH,2H
INT 21H
POP BX
INC BX
CMP BYTE PTR[BX],24H ;判断终点
JNZ LOP
RET
MAIN ENDP
END START
本文地址:http://com.8s8s.com/it/it26152.htm