and用来抠0 or用来填1
al第6位设为0的方法是 and al,10111111B
al第7位设为0的方法是 and al,01111111B
用单引号写的字符型数据 'unIX' 在编译的时候 会被转化为相应的ASCII码
字母A的ascii码是 41H 也就是65 01000001
小写字母的ascii码是61H 01100001
观察发现 第5位(左数第三位) 是0 就是大写 是1就是小写
例题 将 BaSiC 5个字母全变成大写
assume cs:codesg,ds:datasg
datasg segment
db 'BaSiC'
datasg ends
codesg segment
start: mov ax,datasg
mov ds,ax
mov bx,0
mov cx,5 一共5个字母
s: mov al,[bx]
and al,11011111B
mov [bx],al
inc bx
loop s
mov ax,4c00h
int 21h
codesg ends
end start
=================================================
[5+bx] 5[bx] [bx].5 都是一个意思
=================================================
例题 已知2000:1000 处数据是 BE 00 06 58 6A 22 .....
分析每一行代码的效果
mov ax,2000h
mov ds,ax DS=2000h
mov bx,1000h bx=1000h
mov si,0 si=0
mov ax,[bx+2+si] 偏移段为 1000+2+0=1002 对应的是06的位置 ax=5806