PRINT DATA
DATA是參數
;************************************************************************
;--Display a area with formated form-----------
;MACRO instruction:
;A MACRO to print out the data of DATA(parameter)
;in the formated hex form.
PRINT MACRO DATA
LOCAL SWITCHBITS
LOCAL DISPNOW
PUSH AX
PUSH BX
PUSH CX
PUSH DX
MOV BL,DATA ;data
MOV CL,4 ;service for rotate
MOV DH,0 ;the flag of high bits or low bits
SWITCHBITS:
INC DH
ROL BL,CL ;Rotate 4 bits, display the high 4bits first
MOV BH,BL ;BH:store the data rotated
AND BH,0FH
ADD BH,30H
CMP BH,3AH ;If DH<3AH, DH is a number, jump to "DISPNOW":display now!
;else is a character, add 07H
JL DISPNOW
ADD BH,07H ;is a character
DISPNOW:
MOV AH,02H
MOV DL,BH
INT 21H ;output the data
CMP DH,1
JE SWITCHBITS ;There are bits left
POP DX
POP CX
POP BX
POP AX
ENDM
;************************************************************************