1 / 4

第 4 章:例 4.14 将 AL 寄存器中的无符号数乘以 10

sub ah,ah and ah,0. 第 4 章:例 4.14 将 AL 寄存器中的无符号数乘以 10. xor ah,ah ;实现 AH = 0 ,同时使 CF = 0 shl ax,1 ; AX←2×AL mov bx,ax ; BX←AX = 2×AL shl ax,1 ; AX←4×AL shl ax,1 ; AX←8×AL add ax,bx ; AX←8×AL + 2×AL = 10×AL. 逻辑左移一位相当于无符号数乘以 2 逻辑右移一位相当于无符号数除以 2. 第 4 章: 4.4.3 循环移位指令.

agrata
Download Presentation

第 4 章:例 4.14 将 AL 寄存器中的无符号数乘以 10

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. sub ah,ah and ah,0 第4章:例4.14 将AL寄存器中的无符号数乘以10 xor ah,ah;实现AH=0,同时使CF=0 shl ax,1;AX←2×AL mov bx,ax;BX←AX=2×AL shl ax,1;AX←4×AL shl ax,1;AX←8×AL add ax,bx;AX←8×AL+2×AL=10×AL • 逻辑左移一位相当于无符号数乘以2 • 逻辑右移一位相当于无符号数除以2

  2. 第4章:4.4.3 循环移位指令 • 循环移位指令类似移位指令,但要将从一端移出的位返回到另一端形成循环。分为: ROLreg/mem,1/CL ;不带进位循环左移 RORreg/mem,1/CL ;不带进位循环右移 RCLreg/mem,1/CL ;带进位循环左移 RCR reg/mem,1/CL ;带进位循环右移 • 循环移位指令的操作数形式与移位指令相同,按指令功能设置进位标志CF,但不影响SF、ZF、PF、AF标志 演示 演示 演示 演示

  3. AX DX CF 0 第4章:32位数据移位 ;将DX.AX中32位数值左移一位 shl ax,1 rcl dx,1 考虑32位数据的右移等操作

  4. rol dh,cl rcr dh,cl 第4章:例4.15 非压缩BCD码合并为压缩BCD ;DBCD有2位非压缩BCD码 mov dl,dbcd;取低字节 and dl,0fh;只要低4位 mov dh,dbcd+1;取高字节 mov cl,4 shl dh,cl;低4位移到高4位 or dl,dh;合并到DL No !

More Related