汇编- and,or逻辑运算指令
assume cs:codecode segment; 逻辑运算 按照二进制位运算start: mov ax,0mov al, 00001111Band al, 11110000B; 00000000B mov ax,0mov al, 00001111Bor al, 11110000B; 11111111B mov ax,4c00Hint 21Hcode endsend start
通过and,or逻辑运算指令实现大写转小写,小写转大写
assume cs:code, ds:datadata segmentdb 'puThon'db 'JAVA'data ends; z 122 7A 0111 1010 小写z;1101 1111; Z 90 5A 0101 1010 大写Z; 0010 0000code segmentstart: mov ax,datamov ds,axmov bx,0mov cx,6; 小写转大写upLet: mov al,ds:[bx]and al,11011111Bmov ds:[bx], alinc bxloop upLetmov cx,4; 大写转小写 upX: mov al,ds:[bx]or al,00100000Bmov ds:[bx],alinc bxloop upXmov ax,4C00Hint 21hcode endsend start
复制字符串
assume cs:code, ds:datadata segmentdb 'welcome to asm'db '--------------'
data endscode segmentstart: mov ax, datamov ds, ax mov cx, 7mov si,0mov di,16cp: mov ax, ds:[si]mov ds:[di], axadd si,2add di,2loop cpmov ax,4C00Hint 21Hcode endsend start