Integer, ASCII and Unicode

We will deal with computation machines. Having just mechanical devices at hand this still works:

Figure 88. Cash register Slide presentation Create comment in forum
Cash register

Figure 89. Zuse Z3 Slide presentation Create comment in forum
Zuse Z3

Figure 90. Eniac Slide presentation Create comment in forum
Eniac

So far all machines being described are based on non-semiconductor technologies. Inventing the transistor in the fifties gave rise to a rapid development of microprocessor chips:

Figure 91. Microprocessor ICs Slide presentation Create comment in forum
Microprocessor ICs

These sample devices differ heavily with respect to addressable memory, data size, supported arithmetic operations / speed and other features. We take a closer look to Zilog's Z80 processor:

Figure 92. Zilog Z80 CPU Slide presentation Create comment in forum
Zilog Z80 CPU

Following technological advances processors have been categorized by the length the so called address- and data-bus:

Figure 93. Address and data bus sizes Slide presentation Create comment in forum
Processor Year Address size / Bit Data size / Bit
Intel 4004 1971 12 4
Zilog Z80 1976 16 8
Motorola 68000 1980 24 / 32 16
Motorola 68020 1984 32 32
AMD Opteron 2003 64 64

Figure 94. Simple facts Slide presentation Create comment in forum

There are only 10 types of people in the world:

Those who understand binary and those who don't.


We remind the reader to the binary representation of signed integer values. Details will be discussed in your math lectures. Our first example features three bit signed integer values:

Figure 95. Unsigned 3 bit integer representation Slide presentation Create comment in forum

Figure 96. Adding unsigned integers Slide presentation Create comment in forum
o.K. Overflow!
   010       2
  +011      +3
  ----     ---
   101       5
                  100       4
                  101      +5
               ------     ---
discarded ━━━▶ (1)001       1
by 3 bit
representation

Figure 97. 3 bit two-complement representation Slide presentation Create comment in forum

Figure 98. Adding signed integers Slide presentation Create comment in forum

3 bit two complement representation:

o.K. Overflow!
   101      -3
  +010      +2
  ----     ---
   111      -1
  100     -4
  101     -3
 ----    ---
 1001      1

Signed byte values are being represented accordingly:

Figure 99. Signed 8 bit integer binary representation Slide presentation Create comment in forum
Signed 8 bit integer binary representation

exercise No. 12

Hotel key cards Create comment in forum

Q:

A hotel supplies the following type of cards for opening room doors:

A customer is worried concerning the impact of loosing his card. For security reasons the corresponding pattern can never be issued again. Thus the hotel may eventually run short on available combinations.

Discuss this argument by estimating the number of distinct patterns.

Hint: Consider a keycard's (likely?) grid of possible punch positions:

A:

No need to be worried: The 32 possible punch positions may be arranged in a linear fashion:

Since each position may either contain a hole or be solid we have 2 32 = 4294967296 distinct possibilities. Thus a lot of keycards may get lost before the hotel manager has reason to start worrying.

Regarding language characters we start with one of the oldest and widespread character encoding schemes:

Figure 100. 7-bit ASCII Slide presentation Create comment in forum
7-bit ASCII

ASCII by design is limited to US characters and does not include characters from non-English languages. Since ASCII only uses seven bits we may a parity bit to form one byte per character:

Figure 101. 7-bit ASCII with even parity bit Slide presentation Create comment in forum
7-bit ASCII with even parity bit

A byte's parity bit may instead be used for encoding non- ASCII supplementary characters. One such example is the ISO 8859-1 (ISO Latin 1) standard representing western European character sets:

Figure 102. ISO Latin 1 encoding Slide presentation Create comment in forum
ISO Latin 1 encoding

Supporting additional languages comes at a price: We have to increase the number of bytes representing a single character:

Figure 103. Some Unicode UTF-8 samples Slide presentation Create comment in forum
Some Unicode UTF-8 samples

Notice the representation's differing byte count: UTF-8 Unicode encoding allows for one-, two-, three- and four- byte encodings. See Unicode and You for further details.