实验程序如下
data segment
; add your data here!
DAT SEGMENT
AA DB 01H,23H,45H,67H,89H,0ABH,0CDH,0EFH
COUNT EQU $-AA
STRING DB COUNT*2 DUP(0),'$'
DAT ENDS
pkey db "press any key...$"
ends
stack segment
dw 128 dup(0)
ends
code segment
ASSUME CS:CODE,DS:DATA
start:
; set segment registers:
mov ax, data
mov ds, ax
; add your code here
MOV SI,OFFSET AA
MOV DI,OFFSET STRING
MOV BL,COUNT
GO:
MOV AL,[SI]
MOV BH,AL
MOV CL,4
SHR AL,CL
CMP AL,9
JBE NEXT1
ADD AL,7
NEXT1:
ADD AL,30H
MOV [DI],AL
INC DI
MOV AL,BH
AND AL,0FH
CMP AL,9
JBE NEXT2
ADD AL,7
NEXT2:
ADD AL,30H
MOV [DI],AL
INC DI
INC SI
SUB BL,1
JNZ GO
LEA DX,STRING
MOV AH,9
INT 21H
CODE ENDS
END START
|