Page 47 - ARM 64 Bit Assembly Language
P. 47
30 Chapter 1
cal circuit with two states, using two discrete voltage levels, but much more difficult to build a
stable circuit with ten discrete voltage levels. Therefore, modern computers work in base two.
Computer data can be viewed as simple bit strings. The programmer is responsible for sup-
plying interpretations to give meaning to those bit strings. A set of bits can be interpreted as a
number, a character, or anything that the programmer chooses. There are standard methods for
encoding and interpreting characters and numbers. Fig. 1.4 shows some common methods for
encoding integers. The most common encodings for characters are UTF-8 and ASCII.
Computer memory can be viewed as a sequence of bytes. Each byte has a unique address. A
running program has several regions of memory. One region holds the executable code. The
other regions hold different types of variables.
Exercises
1.1. What is the two’s complement of 11011101?
1.2. Perform the base conversions to fill in the blank spaces in the following table:
Base 10 Base 2 Base 16 Base 21
23
010011
ABB
2HE
1.3. What is the 8-bit ASCII binary representation for the following characters?
a. “A”
b. “a”
c. “!”
1.4. What is \ minus ! given that \ and ! are ASCII characters? Give your answer in binary.
1.5. Representing characters:
a. Convert the string “Super!” to its ASCII representation. Show your result as a se-
quence of hexadecimal values.
b. Convert the hexadecimal sequence into a sequence of values in base four.
1.6. Suppose that the string “This is a nice day” is stored beginning at address 4B3269AC 16 .
What are the contents of the byte at address 4B3269B1 16 in hexadecimal?
1.7. Perform the following:
a. Convert 101101 2 to base ten.
b. Convert 1023 10 to base nine.
c. Convert 1023 10 to base two.
d. Convert 301 10 to base 16.