當前位置:編程學習大全網 - 編程軟體 - 求壹個簡單的匯編程序

求壹個簡單的匯編程序

這是壹個通用的宏,用來以16進制的形式顯示所給參數的ASII碼.調用方式如下:

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

;************************************************************************

  • 上一篇:樹遊是什麽遊戲
  • 下一篇:快捷指令是什麽意思 快捷指令指什麽
  • copyright 2024編程學習大全網