+ -
当前位置:首页 → 问答吧 → 汇编

汇编

时间:2010-12-11

来源:互联网

data segment
table db 30h,31h,32h,33h,34h,35h,36h,37h
  db 38h,39h,41h,42h,43h,44h,45h,46h
hex db 9
asci db ?
data ends
code segment
  assume cs:code, ds:data
start: mov ax, data
mov ds, ax
mov bx, 0
mov bl,hex
mov al,table[bx]
mov asci,al
mov dl, asci
mov ah, 2 ;调用2号功能将asci的内容对应的字符输出到屏幕上
int 21h
mov ah,4ch
int 21h
code ends
end start


修改程序,使之实现的功能为:将DL中的内容(2位16进制数)转换成ASCII码,并输出到屏幕上。这里DL的值在程序中用mov指令给定。如mov dl, 56h 使(DL)=56H,则屏幕上应输出56。(提示:应对2位16进制数依次处理,每次处理一位,转换成ASCII码并输出。)

作者: wccmfc123   发布时间: 2010-12-11


d:\MASM>debug
-a
1472:0100 mov dl,56
1472:0102 mov ah,2
1472:0104 mov cl,4
1472:0106 push dx
1472:0107 rol dl,cl
1472:0109 and dl,f
1472:010C add dl,30
1472:010F int 21
1472:0111 pop dx
1472:0112 and dl,f
1472:0115 add dl,30
1472:0118 int 21
1472:011A
-g=100 11a
56
AX=0236 BX=0000 CX=0004 DX=0036 SP=FFEE BP=0000 SI=0000 DI=0000
DS=1472 ES=1472 SS=1472 CS=1472 IP=011A NV UP EI PL NZ NA PE NC
1472:011A DEC7 FADDP ST(7),ST
-q

d:\MASM>

作者: masmaster   发布时间: 2010-12-11