Write the I, I + 1 bits in Al into the I, I + 1 bits of the mem unit. The other BITs remain unchanged.

Source: Internet
Author: User
MoV Al, 3ah; raw data
MoV cl, 4; I = 4
CMP Cl, 6; I <= 6
JG exit; exit if the value is greater
MoV BL, 3; mask with 0011 = 3
Shl bl, Cl; locate the desired mask based on the CL value to obtain the required mask.
And Al, BL; logically intercept the value of 1
Not BL;
And [mem], BL; clear the bits except I + 1
Or [mem], Al; and write I + 1 bit to Mem

This is the csdn compilation forum.Delphiguy ()Algorithm

My algorithm is
MoV Al, 3ah; raw data
MoV BL, 4; I = 4
Cmp bl, 6
JG exit
 
Cmp bl, 0
JZ num_i0;
Cmp bl, 1
JZ num_i1
Cmp bl, 2
JZ num_i2
Cmp bl, 3
JZ num_i3
Cmp bl, 4
JZ num_i4
Cmp bl, 5
JZ num_i5
Cmp bl, 6
JZ num_i6
JMP numout
Num_i0:
And Al, 03 h
JMP numout
Num_i1:
And Al, 06 h
JMP numout
Num_i2:
And Al, 0ch
JMP numout
Num_i3:
And Al, 18 h
JMP numout
Num_i4:
And Al, 30 h
JMP numout
Num_i5:
And Al, 60 h
JMP numout
Num_i6:
And Al, 0c0h
Numout: mov [mem], Al
The calculated mask of the algorithm does not have the calculated relative mask.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.