当前位置:网站首页>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
边栏推荐
- Shell_ 03_ environment variable
- Train 100 pictures for 1 hour, and the style of the photos changes at will. There is a demo at the end of the article | siggraph 2021
- redux使用说明
- When it comes to Google i/o, this is how ByteDance is applied to flutter
- GCC error: terminate called after throwing an instance of 'std:: regex_ error‘ what(): regex
- string. How to choose h and string and CString
- 唯有学C不负众望 TOP4 S1E6:数据类型
- Jedis
- Activiti目录(五)驳回、重新发起、取消流程
- ~74 JD top navigation bar exercise
猜你喜欢
Activiti目录(五)驳回、重新发起、取消流程
~83 form introduction
~81 long table
谢邀,人在工区,刚交代码,在下字节跳动实习生
Idea resolving jar package conflicts
I'm "fixing movies" in ByteDance
was unable to send heartbeat
MySQL字符串函数
The "advertising maniacs" in this group of programmers turned Tiktok advertisements into ar games
Shell_ 06_ Judgment and circulation
随机推荐
Eureka high availability
After idea installs the plug-in, restart the plug-in and disappear
逻辑运算指令
服务器端渲染(SSR)和客户端渲染(CSR)的区别
Only learning C can live up to expectations top5 S1E8 | S1E9: characters and strings & arithmetic operators
LeetCode 1638. Count the number of substrings with only one character difference
~73 other text styles
唯有学C不负众望 TOP2 p1变量
数据传送指令
~69 other ways to use icon fonts
~Introduction to form 80
Record the error reason: terminate called after throwing an instance
Record the error reason
ByteDance open source Gan model compression framework, saving up to 97.8% of computing power - iccv 2021
~83 form introduction
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]
8086 内存
When it comes to Google i/o, this is how ByteDance is applied to flutter
Shell_ 04_ Shell script
Monomer application concept