当前位置:网站首页>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
边栏推荐
- 亮相Google I/O,字节跳动是这样应用Flutter的
- ~82 style of table
- 7-4 harmonic average
- High performance mysql (Third Edition) notes
- Saw local status change event StatusChangeEvent [timestamp=1644048792587, current=DOWN, previous=UP]
- Jedis
- Activiti directory (I) highlights
- Shell_ 02_ Text three swordsman
- [graduation project] QT from introduction to practice: realize imitation of QQ communication, which is also the last blog post in school.
- ~Introduction to form 80
猜你喜欢
Shell_ 02_ Text three swordsman
~83 form introduction
The "advertising maniacs" in this group of programmers turned Tiktok advertisements into ar games
7-4 harmonic average
Shell_ 04_ Shell script
J'ai traversé le chemin le plus fou, le circuit cérébral d'un programmeur de saut d'octets
姚班智班齐上阵,竞赛高手聚一堂,这是什么神仙编程大赛?
was unable to send heartbeat
~79 Movie card exercise
Ruoyi-Cloud 踩坑的BUG
随机推荐
唯有学C不负众望 TOP3 Demo练习
~71 abbreviation attribute of font
~Introduction to form 80
Error: case label `15 'not within a switch statement
Design of DS18B20 digital thermometer system
[unsolved]7-14 calculation diagram
~78 radial gradient
7-8 likes (need to continue to improve)
Erlang installation
DOS 功能调用
The "advertising maniacs" in this group of programmers turned Tiktok advertisements into ar games
yum install xxx报错
The daemon thread starts redis and modifies the configuration file
登陆验证koa-passport中间件的简单使用
Record the error reason: terminate called after throwing an instance
MySQL日期函数
Activit零零碎碎要人命的坑
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
Eureka single machine construction
Description of project structure configuration of idea