主题:作业!!特急,求助
nekoxie
[专家分:0] 发布于 2006-10-21 19:55:00
望高手指点:
编程实现将存入3500H~3507H单元中的4个十进制非压缩BCD码(如0102,0304,0506,0708)转换成二进制数码(用十六进制表示),并存入起始地址为3510H的内存单元中
回复列表 (共1个回复)
沙发
mathshope [专家分:40] 发布于 2006-10-23 19:08:00
CSEG SEGMENT
assume cs:CSEG, ds:cSEG
start:
mov ax, cseg
mov ds, ax
mov bx,3500H
mov word ptr [bx+0],0102h
mov word ptr [bx+2],0304h
mov word ptr [bx+4],0506h
mov word ptr [bx+6],0708h
mov cl,4
mov ax,word ptr [bx]
shl ah,cl
or al,ah
mov byte ptr [bx+10h],al
mov ax,word ptr [bx+2]
shl ah,cl
or al,ah
mov byte ptr [bx+11h],al
mov ax,word ptr [bx+4]
shl ah,cl
or al,ah
mov byte ptr [bx+12h],al
mov ax,word ptr [bx+6]
shl ah,cl
or al,ah
mov word ptr [bx+13h],al
mov ax, 4c00h
int 21h
CSEG ENDS
END start
虽然不是很好,但我用DEBUG看过了,应该可行的,结果如下:
-d ds:3500
0B57:3500 02 01 04 03 06 05 08 07-70 72 6F 67 72 61 6D 20
0B57:3510 12 34 56 78 64 69 73 70-6C 61 79 73 20 74 68 65
我来回复