mov ax, ffffh
应该写成 mov ax, 0ffffh
否则编译报错BX存在的意义
1. asm编译器无法识别中括号,mov ax,[0]
编译时会默认去除中括号.使用bx替代可以解决这个问题,如果在debug模式下使用-a命令输入中括号则没有问题,可以正常识别
;错误写法:编译器无法识别[0],会直接取值为0 而不是偏移地址0所对应的内容
assumme cs:code
code segment
mov ax,2000h
mov ds,ax
mov al,[0]
mov bl,[1]
mov cl,[2]
mov dl,[3]
mov ax,4c00h
int 21h
code ends
end
问题: 那如果非要以带中括号的方式进行编写可以吗? 答案是:需要带上段地址ds,如下:
assumme cs:code
code segment
mov ax,2000h
mov ds,ax
mov al,ds:[0] ;其中ds称作段前缀
mov bl,ds:[1]
mov cl,ds:[2]
mov dl,ds:[3]
mov ax,4c00h
int 21h
code ends
end
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有