回 帖 发 新 帖 刷新版面

主题:作业!!特急,求助

望高手指点:
   编程实现将存入3500H~3507H单元中的4个十进制非压缩BCD码(如0102,0304,0506,0708)转换成二进制数码(用十六进制表示),并存入起始地址为3510H的内存单元中

回复列表 (共1个回复)

沙发

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

我来回复

您尚未登录,请登录后再回复。点此登录或注册