21,459
社区成员
发帖
与我相关
我的任务
分享
data segment
table db 30h,31h,32h,33h,34h,35h,36h,37h
db 38h,39h,41h,42h,43h,44h,45h,46h
hex db 5h ;x为待转换的十六进制数
asci db ? ;存放转换后的ASCII码
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
lea bx,table
mov al,hex
xlat
mov asci,al
mov ah,4ch
int 21h
code ends
end start
我是这样写的,可是屏幕上看不到
table segment
tab_da db 30h,31h,32h,33h,34h,35h,36h,37h,38h,39h
db 41h,42h,43h,44h,45h,46h
hextab db 0,1,2,3,4,5,6,7,8,9,0ah,0bh,0ch,0dh,0eh,0fh
asibuf db 16 dup(?)
eol db '$'
table ends
stack segment para stack 'stack'
stapn db 100 dup(?)
stack ends
coseg segment
assume cs:coseg,ds:table,ss:stack,es:table
start:
mov ax,table
mov ds,ax
mov es,ax
mov si,offset hextab ;根据si
mov bx,offset tab_da ;表的基址必须放在bx中(必须的)
mov di,offset asibuf ;结果放进di
mov cx,16 ;循环计数器
next:
lodsb ;从[si] 装入一个字节 --> al
xlat tab_da ;xlat以al为索引,查tab_da表,结果还是放在al中
stosb ;再将al存入[di]
loop next ;cx--,if cx<> 进入下一循环
mov cx,16
mov ah,2 ;显示字符的功能号
xor si,si
again:
mov dl,asibuf[si]
int 21h
inc si
loop again
mov ax,4c00h
int 21h
coseg ends
end start