当前位置:网站首页>Logical operation instruction
Logical operation instruction
2022-07-06 17:02:00 【My71】
Cyclic shift
- Shift is to shift the binary number in the register .
- stay debug The values in the registers in the mode have 16 Base display .
- When only one position is moved , You can put numbers 1 Put it on the source operand of the move instruction . If the number of moving digits is greater than 1, You need to save the moving digits to cl In the register .
Move left ROL
Move the highest weight to the lowest full-time weight .
example :0110 The result of moving left is 1100
Code implementation
- demand : Yes 12h Move one bit to the left
- Running results :24h.
- principle :12h = 00010010b, After shifting to the left 00100100 namely 24h
code segment assume cs:code main: mov bx,12h rol bx,1 edit: mov ah,4ch int 21h code ends end main
Move right ROR
- Move the lowest weight to the highest full-time weight .
- example :0110 The result of moving right is 0011
Logical operations
Knowledge point
- Logical operation with high-level language , Follow the and or principle .
- And operation : The whole is true , A fake is a fake .
- Or operations : One is true , All false is false .
- Bitwise operation refers to the operation in binary bits .
- In binary ,1 Said really ,0 Said the false .
Instructions
- Bitwise and operation :AND
- Bitwise OR operation :OR
- Bitwise non operation :NOT
- Bitwise exclusive or operation :XOR
Example
Calculation 24h and 36h And operations
code segment assume cs:code main: mov bx,24h and bx,36h edit: mov ah,4ch int 21h code ends end main
Calculation 24h and 36h Or operation of
code segment assume cs:code main: mov bx,24h or bx,36h edit: mov ah,4ch int 21h code ends end main
Keep the end number of binary , Other high bits are cleared .
code segment assume cs:code main: mov bx,0ffffh and bx,01h edit: mov ah,4ch int 21h code ends end main
Comprehensive application
Reserved bits and 1 Do with the operation .
Zero position sum 0 Do with the operation .
Output binary
demand : Output the value in the register to the terminal in binary form .
Code
code segment assume cs:code main: mov bl,12h mov cx,8h lopi: rol bl,1 mov dl,bl and dl,01h add dl,30h call d02 loop lopi mov dl,42h call d02 edit: mov ah,4ch int 21h d02 proc near mov ah,02h int 21h ret d02 endp code ends end main
Output hex
demand : Output the value in the register to the terminal in hexadecimal form .
Code
code segment assume cs:code main: mov bl,0a2h mov cx,2 lopi: push cx mov cl,4 rol bl,cl pop cx mov dl,bl and dl,0fh cmp dl,09h jg letter jng number letter: add dl,37h call d02 jmp endcmp number: add dl,30h call d02 endcmp: loop lopi mov dl,48h call d02 edit: mov ah,4ch int 21h d02 proc near mov ah,02h int 21h ret d02 endp code ends end main
边栏推荐
- The 116 students spent three days reproducing the ByteDance internal real technology project
- 谢邀,人在工区,刚交代码,在下字节跳动实习生
- Record the error reason: terminate called after throwing an instance
- ~78 radial gradient
- Eight part essay that everyone likes
- QT system learning series: 1.2 style sheet sub control lookup
- DOS 功能调用
- 冯诺依曼体系结构
- 汇编语言寻址方式
- 算数运算指令
猜你喜欢

汇编语言寻址方式

MySQL string function

~69 other ways to use icon fonts

算数运算指令

~68 Icon Font introduction

Activiti directory (IV) inquiry agency / done, approved

我走过最迷的路,是字节跳动程序员的脑回路

ByteDance 2022 school recruitment R & D advance approval publicity meeting, students' top 10 issues

搭建flutter环境入坑集合

Resume of a microservice architecture teacher with 10 years of work experience
随机推荐
redux使用说明
Shell_ 06_ Judgment and circulation
一个数10年工作经验的微服务架构老师的简历
7-5 blessing arrived
Activit零零碎碎要人命的坑
Activiti directory (I) highlights
Ce n'est qu'en apprenant que c est à la hauteur des attentes Top5 s1e8 | s1e9: caractères et chaînes & opérateurs arithmétiques
~84 form supplement
7-10 punch in strategy
The daemon thread starts redis and modifies the configuration file
Which is more important for programming, practice or theory [there are some things recently, I don't have time to write an article, so I'll post an article on hydrology, and I'll fill in later]
搭建flutter环境入坑集合
The "advertising maniacs" in this group of programmers turned Tiktok advertisements into ar games
控制转移指令
Install docker under windows10 (through Oracle VM VirtualBox)
MySQL日期函数
字节跳动海外技术团队再夺冠:高清视频编码已获17项第一
Solr standalone installation
~78 radial gradient
Fdog series (III): use Tencent cloud SMS interface to send SMS, write database, deploy to server, web finale.





