回头再来 发表于 2012-11-2 12:22:48

王爽《汇编语言》第六章程序6.1错误

定义数据 并累加进ax中

书上代码
assume cs:code
code segment
dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h

mov ax,0
mov bx,0

mov cx,8
s: add ax,cs:
add bx,2

loop s
mov ax,4c00h
int 21h
code ends
end

因为为一个字节8位
代码 add ax.cs与原意相违背

修改代码如下
assume cs:code
code segment
dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h

mov ax,0
mov bx,0

mov cx,8
s: mov dl,cs:
inc bx
mov dh,cs:
add ax,dx
inc bx

loop s
mov ax,4c00h
int 21h
code ends
end
如有不对请大家指出
页: [1]
查看完整版本: 王爽《汇编语言》第六章程序6.1错误