AND指令可用于复位某些位(同0相和).pptVIP

  • 7
  • 0
  • 约2.72千字
  • 约 45页
  • 2017-07-26 发布于河南
  • 举报
AND指令可用于复位某些位(同0相和)

Chapter 8 Bit Manipulation;8.1 Logical Operations;True table;flags;Clear selected bits (marking);Set selected bits;negate selected bits;;AND指令可用于复位某些位(同0相与),不影响其他位:将BL中D3和D0位清0,其他位不变 and bl ;OR指令可用于置位某些位(同1相或),不影响其他位:将BL中D3和D0位置1,其他位不变 or bl, ;XOR指令可用于求反某些位(同1相异或),不影响其他位:将BL中D3和D0位求反,其他不变 xor bl,;Perform certain arithmetic operation;Manipulate ASCII codes;Application of TEST;test al,01h ;测试AL的最低位D0 jnz there ;标志ZF=0,即D0=1 ;则程序转移到there ... ;否则ZF=1,即D0=0,顺序执行 there: ...;Shift and Rotate;Shift instructions;Shift instructions;SHL / SAL instruction;SHR instruction;SAR instruction;flags;Examples;;将DX.AX中32位数值左移一位 shl ax,1 rcl dx,1;;把AL最低位送BL最低位,保持AL不变 ror bl,1 ror al,1 rcl bl,1 rol al,1;Figure 8.7;Double shift instructions;flags;Examples:;Figure 8.7;Rotate instructions;Rotate operation;ROL instruction;ROR instruction;RCL instruction;RCR instruction;;将DX.AX中32位数值左移一位 shl ax,1 rcl dx,1;;把AL最低位送BL最低位,保持AL不变 ror bl,1 ror al,1 rcl bl,1 rol al,1;Figure 8.7;ASCII to double integer conversion;mov esi,[ebp+8] ; get parameter (source addr) WhileBlankD:cmp BYTE PTR [esi], ; space? jne EndWhileBlankD ; exit if not inc esi ; increment character pointer jmp WhileBlankD ; and try again EndWhileBlankD:;;;;cmp cx,0 ; no digits? jz overflowD ; if so, set overflow error flag ; if value is and sign is -, ; want to return (-2^32) cmp eax ; ? jne TooBigD? cmp DWORD PTR [ebp-4],-1 ; multiplier -1 ? je ok1D ; if so, return 8000h TooBigD?: test eax,eax ; check sign flag jns okD ; will be set if number 2^32 - 1 ;overflowD: pop ax ; get flags or ax,0000100001000100B ; set overflow, zero parity flags and ax,1111111101111110B ; reset sign and carry flags pu

文档评论(0)

1亿VIP精品文档

相关文档