Preview

Bit Manipulation

Better Essays
Open Document
Open Document
11543 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Bit Manipulation
Bit Manipulation

Bit Manipulation
5.1 Chapter Overview

Chapter Five

Manipulating bits in memory is, perhaps, the thing that assembly language is most famous for. Indeed, one of the reasons people claim that the “C” programming language is a “medium-level” language rather than a high level language is because of the vast array of bit manipulation operators that it provides. Even with this wide array of bit manipulation operations, the C programming language doesn’t provide as complete a set of bit manipulation operations as assembly language. This chapter will discuss how to manipulate strings of bits in memory and registers using 80x86 assembly language. This chapter begins with a review of the bit manipulation instructions covered thus far and it also introduces a few new instructions. This chapter reviews information on packing and unpacking bit strings in memory since this is the basis for many bit manipulation operations. Finally, this chapter discusses several bit-centric algorithms and their implementation in assembly language.

5.2

What is Bit Data, Anyway?
Before describing how to manipulate bits, it might not be a bad idea to define exactly what this text means by “bit data.” Most readers probably assume that “bit manipulation programs” twiddle individual bits in memory. While programs that do this are definitely “bit manipulation programs,” we’re not going to limit this title to just those programs. For our purposes, bit manipulation refers to working with data types that consist of strings of bits that are non-contiguous or are not an even multiple of eight bits long. Generally, such bit objects will not represent numeric integers, although we will not place this restriction on our bit strings. A bit string is some contiguous sequence of one or more bits (this term even applies if the bit string’s length is an even multiple of eight bits). Note that a bit string does not have to start or end at any special point. For example, a bit string

You May Also Find These Documents Helpful

  • Good Essays

    Nt1310 Unit 1 Quiz

    • 1980 Words
    • 8 Pages

    6 . For an unconditional approach to a particular part of a complex PL/SQL block, which of the following control structures can be used?…

    • 1980 Words
    • 8 Pages
    Good Essays
  • Satisfactory Essays

    SD1230 Lab 1

    • 239 Words
    • 2 Pages

    1. What happens to the volatile memory when the power is lost? –RAM is deleted…

    • 239 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    A user has opened a calculator application, typed the numbers 123456789, and then done some math problem using this number. Which of the following determines, in part, what bits the computer stores in RAM to represent the number 123456789?…

    • 957 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Nt1310 Unit 1 Test Paper

    • 746 Words
    • 3 Pages

    We are running programs on a machine where values of type int have a 32-…

    • 746 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    a long name for a small chip that holds bits of data code that can be rewritten and…

    • 281 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    13.) What do you use to specify what bits are being used to lock a number into place?…

    • 641 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Pt1420 Unit 7 Study Guide

    • 582 Words
    • 3 Pages

    17.Write a program to read a binary input from the keyboard and display it. Page: 130…

    • 582 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    Pt1420 Unit 1 Assignment 2

    • 1305 Words
    • 6 Pages

    2. What number does a bit that is turned on represent? What number does a bit that is turned off represent?…

    • 1305 Words
    • 6 Pages
    Powerful Essays
  • Satisfactory Essays

    Quiz Comp Archi

    • 438 Words
    • 3 Pages

    13) For each of the following 6-bit operations, calculate the values of the C, Z, V, and N flags in the ARM.…

    • 438 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    The operating systems job is managing the memory. The operating system is in charge of bringing this process into main memory (Stallings, 2012). However the processor must deal with references within the program. Branch instructions include an address to reference the order to be executed next. Data reference instructions include the address of the byte or word of data referenced. The processor hardware and operating system software must be able to translate the memory references found in the code of the program into actual physical memory addresses, reflecting the current location of the program in main memory. (Stallings, 2012).…

    • 573 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Unit 1&2 Discussion

    • 379 Words
    • 2 Pages

    Access control is typically achieved by reserving a collection of bits within the general “Flag Register” to indicate the current “access control level”. Certain instructions are restricted so that they are only legal if the “access control level” is at least some minimum value; otherwise the instruction generates an “illegal operation” interrupt.…

    • 379 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Due to the bits explosion, the world changed very suddenly. Almost everything is stored in a computer somewhere. Court records, grocery purchases, precious family photos, radio programs… It is all being reduced to zeroes and ones – “bits.” The bits are stashed on disks of home computers and in the data centers of big corporations and government agencies. The disks can hold so many bits that there is no need to pick and choose what gets remembered. So much disk storage is being produced every year that it could be used to record a page of information, every minute or two, about you and every other human being on earth.…

    • 786 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    A Description of Computers

    • 1084 Words
    • 5 Pages

    Data Bit- each individual ‘1’ or ‘0’ is a bit-short for binary digit. Byte- 8 bits are a byte. Kilobyte-is 1000 bytes (1024) Megabyte-is 1,000,000 bytes Gigabyte-is 1,000,000,000 bytes…

    • 1084 Words
    • 5 Pages
    Powerful Essays
  • Good Essays

    Blown To Bits Analysis

    • 751 Words
    • 4 Pages

    At the beginning of chapter 8, Bits in the Air,Old Metaphors, New Technologies, and Free speech, of the novel Blown to Bits they discussed the FCC gaining the authority to regulate the content that is broadcasted on the radio. Later as the nations technology progressed the television overtook the radio in popularity and the FCC tried to regulate the new public broadcasting system that had been created. In 1978 a Supreme Court case I was concurred that the government had a special interest in protecting the people from malicious content being broadcasted. With this regulation of media by the government there was a development of communications technologies. This priority of the government quickly thought of to be essentially…

    • 751 Words
    • 4 Pages
    Good Essays
  • Good Essays

    We all know that digital electronics use the binary number system. However, with new computers containing 32, 64, and even 128 bit data busses, displaying numbers in binary is quite cumbersome. For example, a single piece of data on a 64-bit data bus would look like this:…

    • 412 Words
    • 4 Pages
    Good Essays

Related Topics