官术网_书友最值得收藏!

Accumulators

The EAX register is also known as an accumulator and is used with multiplication and division operations, both as implied and target operands. It is important to mention that the result of a binary multiplication is twice the size of the operands and the result of a binary division consists of two parts (quotient and remainder), each of which has the same bit width as the operands. Since the x86 architecture began with 16-bit registers and for the sake of backward compatibility, the EDX register is used for storing partial results when the values of the operands are larger than could fit into 8 bits. For example, if we want to multiply two bytes, 0x50 and 0x04, we would expect the result to be 0x140, which cannot be stored in a single byte. However, since the operands were 8 bits in size, the result is stored into the AX register, which is 16 bits. But if we want to multiply 0x150 by 0x104, the result would need 17 bits to be stored (0x150 * 0x104 = 0x15540) and, as we have mentioned already, the first x86 registers were only 16 bits. This is the reason for using an additional register; in the case of the Intel architecture, this register is EDX (to be more precise, only the DX part would be used in this specific case). As a verbal explanation may sometimes be too generalized, it would be better to simply demonstrate the rule.

Division implies a slightly different rule. To be more precise, this is the inverted multiplication rule, meaning that the result of the operation is half the bit width of the dividend, which in turn means that the largest dividend in the long mode may be 128-bit wide. The smallest dividend value remains the same as in the smallest value of the source operand in the case of multiplication--8 bits.

主站蜘蛛池模板: 肃北| 顺平县| 伽师县| 灵台县| 河南省| 曲麻莱县| 仪征市| 龙里县| 明水县| 萨迦县| 五寨县| 博爱县| 长宁县| 维西| 平阳县| 阳西县| 新闻| 孙吴县| 平南县| 石棉县| 临沭县| 高要市| 泰和县| 普陀区| 宝清县| 石狮市| 江都市| 屏东市| 黑水县| 湖北省| 抚松县| 壶关县| 鹿泉市| 尖扎县| 黎川县| 东兴市| 克拉玛依市| 周宁县| 镇安县| 正蓝旗| 安宁市|