汇编逻辑运算和位移运算例题
data segment x db 55h,77h,14 dup (?) y dw 0ff00h,1234h,8 dup (?) data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax ;字节操作 mov al,x and al,x+1 mov x+2,al mov al,x or al,x+1 mov x+3,al mov al,x not al mov x+4,al mov al,x+1 not al mov x+5,al mov al,x xor al,x+1 mov x+6,al mov al,x shl al,1 mov x+7,al mov al,x shr al,1 mov x+8,al mov al,x+1 mov cl,4 shl al,cl mov x+9,al mov al,x+1 shr al,cl mov x+10,al mov al,x rol al,1 mov x+11,al mov al,x ror al,1 mov x+12,al mov al,x+1 mov cl,4 rol al,cl mov x+13,al mov al,x+1 ror al,cl mov x+14,al ;字操作 mov ax,y and ax,y+2 mov y+4,ax mov ax,y or ax,y+2 mov y+6,ax mov ax,y xor ax,y+2 mov y+8,ax mov ax,y mov cl,4 sar ax,cl mov y+10,ax mov ax,y+2 sar ax,cl mov y+12,ax mov ax,y mov dx,y+2 mov cl,8 rol ax,cl rol dx,cl mov cx,ax mov bx,dx and cx,00ffh and bx,00ffh and ax,0ff00h and dx,0ff00h or dx,cx or ax,bx mov ax,y+14 mov dx,y+16 mov al,4ch int 21h code ends end start
----------------------------------------------------------------------------
新手学习,若有错误请留言,转载请附上博文连接,谢谢!