Basic Math Functions

2018-09-13  本文已影响0人  lindyang

pushl 高位
pushl 低位

有符号数的加减是否影响 CF?

NEG命令无论你是否为正负数,都会按照取反+1或用0减去这个数的二进制的办法去计算

two unsigned integers
AL, AX, or EAX
DX:AX
EDX:EAX

IMUL instruction can be used by both signed and unsigned integers, 
although you must be careful that the result does not use the most significant bit of the destination. For larger values, 
the IMUL instruction is only valid for signed integers
  • imul source
  • imul source, destination

source can be a 16- or 32-bit register or value in memory, and destination must be a 16- or 32-bit general-purpose register

  • imul multiplier, source, destination

where multiplier is an immediate value, source is a 16- or 32-bit register or value in memory, and destination must be a general-purpose register

dividend in AX, DX:AX, EDX:EAX
低位存储商

only one format for the IDIV instruction
For signed integer division, the sign of the remainder is always the sign of the dividend

SAL (shift arithmetic left)
SHL (shift logical left)

sal destination
sal %cl, destination
sal shifter, destination
  • destination operand can be an 8-, 16-, or 32-bit register or value in memory
  • Any bits that are shifted out of the data size are first placed in the carry
    flag, and then dropped in the next shift

first moved to the carry flag, and then
shifted out

only AAD 用在 DIV 之前
都使用默认的 AL register

  • DAA: Adjusts the result of the ADD or ADC instructions
  • DAS: Adjusts the result of the SUB or SBB instructions
上一篇下一篇

猜你喜欢

热点阅读