当前位置:网站首页>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_ 04_ Shell script
- Solr new core
- (multiple methods, need to continue to see) 7-11 go deep into the tiger's Den
- Log4j2 major vulnerabilities and Solutions
- TCP的三次握手和四次挥手
- Notes on how the network is connected
- Shell_ 03_ environment variable
- Saw local status change event StatusChangeEvent [timestamp=1644048792587, current=DOWN, previous=UP]
- Fdog series (III): use Tencent cloud SMS interface to send SMS, write database, deploy to server, web finale.
猜你喜欢

The QT program compiled on CentOS lacks a MySQL driven solution

ByteDance technical Interviewer: what kind of candidate do I want to pick most

Shell_ 06_ Judgment and circulation

MySQL数字函数

7-4 harmonic average

~Introduction to form 80

TCP的三次握手和四次挥手

Notes on how the network is connected

High performance mysql (Third Edition) notes

Yao BanZhi and his team came together, and the competition experts gathered together. What fairy programming competition is this?
随机推荐
Shell_ 06_ Judgment and circulation
LeetCode 1638. Count the number of substrings with only one character difference
登陆验证koa-passport中间件的简单使用
[unsolved] 7-15 shout mountain
After the subscript is used to assign a value to the string type, the cout output variable is empty.
Introduction to microservices
Fdog series (I): think about it. It's better to write a chat software. Then start with the imitation QQ registration page.
@RestController、@Controller
The QT program compiled on CentOS lacks a MySQL driven solution
字节跳动技术新人培训全记录:校招萌新成长指南
唯有學C不負眾望 TOP5 S1E8|S1E9:字符和字符串&&算術運算符
Continue and break jump out of multiple loops
Shell_ 07_ Functions and regular expressions
服务器端渲染(SSR)和客户端渲染(CSR)的区别
The most lost road I have ever walked through is the brain circuit of ByteDance programmers
TypeScript基本操作
@RequestMapping、@GetMapping
算数运算指令
Activiti目录(五)驳回、重新发起、取消流程
在 vi 编辑器中的命令模式下,删除当前光标处的字符使用 __ 命 令。





