Page 36 - ARM 64 Bit Assembly Language
P. 36
Introduction 19
comprehensive coding schemes. Most modern multi-lingual coding schemes are compatible
with ASCII, though they support a wider range of characters.
At the time that it was developed, transmission of digital data over long distances was very
slow, and usually involved converting each bit into an audio signal which was transmitted over
a telephone line using an acoustic modem. In order to maximize performance, the standards
committee chose to define ASCII as a 7-bit code. Because of this decision, all textual data
could be sent using seven bits rather than eight, resulting in approximately 10% better overall
performance when transmitting data over a telephone modem. A possibly unforeseen benefit
was that this also provided a way for the code to be extended in the future. Since there are
128 possible values for a 7-bit number, the ASCII standard provides 128 characters. However,
33 of the ASCII characters are non-printing control characters. These characters, shown in
Table 1.3, are used to send information about how the text is to be displayed and/or printed.
The remaining 95 printable characters are shown in Table 1.4.
1.3.4.1 Non-printing characters
The non-printing characters are used to provide hints or commands to the device that is re-
ceiving, displaying, or printing the data. The FF character, when sent to a printer, will cause
the printer to eject the current page and begin a new one. The LF character causes the printer
or terminal to end the current line and begin a new one. The CR character causes the termi-
nal or printer to move to the beginning of the current line. Many text editing programs allow
the user to enter these non-printing characters by using the control key on the keyboard. For
instance, to enter the BEL character, the user would hold the control key down and press the
G key. This character, when sent to a character display terminal, will cause it to emit a beep.
Many of the other control characters can be used to control specific features of the printer,
display, or other device that the data is being sent to.
1.3.4.2 Converting character strings to ASCII codes
Suppose we wish to convert a string of characters, such as “Hello World” to an ASCII rep-
resentation. We can use an 8-bit byte to store each character. Also, it is common practice to
include an additional byte at the end of the string. This additional byte holds the ASCII NUL
character, which indicates the end of the string. Such an arrangement is referred to as a null-
terminated string.
To convert the string “Hello World” into a null terminated string, we can build a table with
each character on the left and its equivalent binary, octal, hexadecimal, or decimal value (as
defined in the ASCII table) on the right. Table 1.5 shows the characters in “Hello World” and
their equivalent binary representations, found by looking in Table 1.4. Since most modern