[bx]的使用
assume cs:codesg codesg segment mov ax,1000h mov ds,ax mov ax,[5];this [5] can not symbol [5] in debug ;or mov ax,ds:[5] ; mov bx,5 ; mov ax,[bx] ; mov [bx],1fh mov ax,4c00h int 21h ;return to cmd -p codesg ends end
[bx]就是说你用mov ax,[0]编译器会识别成mov ax,0所以要用mov ax,ds:[0]
在debug里面你可以在定义好ds(数据段地址)之后用mov ax,[1](这个1是偏移地址)但是编译器不认得所以写清楚,mov ax,ds:[1]意思是把这个地址的东西给ax
可以发现这个ds:[1]代表01就是二进制的(0000)(0001)但是ax是16位寄存器(0000)(0001)(0000)(0000)
可以看出本来是1221现在是2112,他默认是从地址[dx]位置开始读,读到就写入,从低位开始写
assume cs:code code segment mov ax,2000h mov ds,ax mov ax,ds:[0] code ends end
段地址x10+偏移地址=物理地址