MCS-012 Computer Organisation and Assembly Language Programming

Admin | First year, Semester1

Alphanumeric Representation

Alphanumeric representation refers to the encoding of both letters (alphabetic characters) and numbers (numeric characters) within computer systems. This allows computers to process and display textual information alongside numerical data. Alphanumeric characters include the letters A-Z (both uppercase and lowercase), the digits 0-9, and often various punctuation marks and special symbols.


Character Encoding Schemes

To represent alphanumeric characters in computers, various character encoding schemes have been developed. These schemes map each character to a unique binary value, allowing the computer to store and manipulate text data. The most common character encoding schemes include:

  1. ASCII (American Standard Code for Information Interchange)
  2. EBCDIC (Extended Binary Coded Decimal Interchange Code)
  3. Unicode


ASCII (American Standard Code for Information Interchange)

ASCII is one of the oldest and most widely used character encoding schemes. It uses 7 bits to represent 128 different characters, including:

  • Uppercase letters: A-Z (65-90 in decimal)
  • Lowercase letters: a-z (97-122 in decimal)
  • Digits: 0-9 (48-57 in decimal)
  • Punctuation marks and special symbols (32-47, 58-64, 91-96, 123-126 in decimal)
  • Control characters (0-31 in decimal)

Example: Representing 'A' and '1' in ASCII

  • The ASCII code for 'A' is 65, which is 01000001 in binary.
  • The ASCII code for '1' is 49, which is 00110001 in binary.


EBCDIC (Extended Binary Coded Decimal Interchange Code)

EBCDIC is an 8-bit character encoding scheme used primarily on IBM mainframe and midrange systems. It represents 256 different characters and includes support for alphabetic, numeric, punctuation, and control characters. Although less common than ASCII, EBCDIC is still used in some legacy systems.

Example: Representing 'A' and '1' in EBCDIC

  • The EBCDIC code for 'A' is 193, which is 11000001 in binary.
  • The EBCDIC code for '1' is 241, which is 11110001 in binary.


Unicode

Unicode is a comprehensive character encoding standard that aims to support all characters from all writing systems in the world. It uses a variable-length encoding, allowing it to represent over a million different characters. Unicode has several encoding forms, including:

  • UTF-8: Uses 1 to 4 bytes per character, compatible with ASCII.
  • UTF-16: Uses 2 or 4 bytes per character.
  • UTF-32: Uses 4 bytes per character.

Example: Representing 'A' and '1' in UTF-8

  • The UTF-8 code for 'A' is the same as ASCII: 01000001 in binary.
  • The UTF-8 code for '1' is the same as ASCII: 00110001 in binary.

Unicode's vast range makes it suitable for global text representation, including scripts, symbols, and emoji.

Data Representation

A computer functions as an information transformer, taking input, processing it, and producing output. Information within a computer is represented in the form of binary digits, or bits. To present input and output in a human-understandable form, character representation is required, using codes like ASCII, EBCDIC, and ISCII. Arithmetic calculations are performed by representing numbers in binary and performing operations on these numbers. The following sections will address these concepts and revisit some fundamental number system principles.

Number Systems : A look Back

Number systems are methods for representing and working with numbers. The most common number systems used in computing are decimal, binary, octal, and hexadecimal. Each system has its own base and symbols for representing values.

Decimal Numbers

The decimal number system is the standard system for denoting integer and non-integer numbers. It is also known as the base-10 system because it is based on 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. For example, the number 345 in decimal represents 3×102+4×101+5×1003 \times 10^2 + 4 \times 10^1 + 5 \times 10^0.

Binary Numbers

The binary number system is used internally by almost all modern computers and computer-based devices. It is a base-2 system, meaning it uses only two symbols: 0 and 1. Each digit in a binary number is called a bit. For example, the binary number 101 represents 1×22+0×21+1×201 \times 2^2 + 0 \times 2^1 + 1 \times 2^0, which equals 5 in decimal.

Octal Numbers

The octal number system is a base-8 system, using digits from 0 to 7. It is sometimes used in computing as a more compact representation of binary numbers, since each octal digit represents three binary digits. For example, the octal number 17 represents 1×81+7×801 \times 8^1 + 7 \times 8^0, which equals 15 in decimal.

Hexadecimal Numbers

The hexadecimal number system is a base-16 system, using sixteen distinct symbols: 0-9 to represent values zero to nine, and A-F to represent values ten to fifteen. Hexadecimal is often used in computing as a human-friendly representation of binary-coded values. For example, the hexadecimal number 1A represents 1×161+A×1601 \times 16^1 + A \times 16^0 (where A = 10), which equals 26 in decimal.


Conversion of Decimal Number to Binary Number

To convert a decimal number to binary, repeatedly divide the number by 2 and record the remainder. Read the remainders from bottom to top.

Example: Convert 13 to binary

  1. 13 ÷ 2 = 6 remainder 1
  2. 6 ÷ 2 = 3 remainder 0
  3. 3 ÷ 2 = 1 remainder 1
  4. 1 ÷ 2 = 0 remainder 1

Reading the remainders from bottom to top, 13 in decimal is 1101 in binary.


Conversion of Binary to Octal and Hexadecimal

Binary to Octal: Group the binary digits into sets of three, starting from the right. Convert each set to its equivalent octal digit.

Example: Convert 1101 (binary) to octal

  1. Group: 1 101 (add leading zeros if needed: 001 101)
  2. Convert each group: 001 = 1, 101 = 5

So, 1101 in binary is 15 in octal.

Binary to Hexadecimal: Group the binary digits into sets of four, starting from the right. Convert each set to its equivalent hexadecimal digit.

Example: Convert 1101 (binary) to hexadecimal

  1. Group: 1101 (add leading zeros if needed: 0001 1010)
  2. Convert each group: 0001 = 1, 1010 = A

So, 1101 in binary is 1A in hexadecimal.

Decimal Representation in Computers

Computers fundamentally operate using the binary number system, which uses only two digits: 0 and 1. However, humans commonly use the decimal system, which uses ten digits: 0 through 9. To bridge this gap, computers need to convert and represent decimal numbers in a way that they can process while maintaining a format that is understandable to humans.


Representing Decimal Numbers

In computing, decimal numbers can be represented in several ways:

  1. Binary-Coded Decimal (BCD)
  2. Floating-Point Representation


Binary-Coded Decimal (BCD)

Binary-Coded Decimal (BCD) is a method of representing decimal numbers where each digit of the decimal number is represented by its own binary sequence. This means that each decimal digit from 0 to 9 is converted to its four-bit binary equivalent.

Example: Representing 93 in BCD

  • Decimal 9 is 1001 in binary.
  • Decimal 3 is 0011 in binary.

So, 93 in decimal is represented as 1001 0011 in BCD.


Floating-Point Representation

Floating-point representation is used to represent real numbers (numbers with fractional parts). It allows for a very wide range of values by using scientific notation. A floating-point number is typically represented in computers using the IEEE 754 standard, which divides the number into three parts:

  1. Sign bit: Indicates if the number is positive (0) or negative (1).
  2. Exponent: Represents the power of the base (usually 2) to scale the significand.
  3. Significand (or Mantissa): Represents the precision bits of the number.

Example: Representing 9.3 in IEEE 754 single precision

  • Convert the decimal to binary: 9.3 (approx 1001.0100110011 in binary).
  • Normalize the binary number: 1.0010100110011 × 2^3.
  • The sign bit is 0 (positive number).
  • The exponent is 3 (with a bias of 127): 3 + 127 = 130, which is 10000010 in binary.
  • The significand is the fraction part: 0010100110011 (padded with zeros to fit 23 bits).

So, 9.3 in IEEE 754 single precision is represented as: 0 | 10000010 | 00101001100110000000000


Character-Based Representation

For representing decimal digits as characters, computers use character encoding schemes like ASCII (American Standard Code for Information Interchange). In ASCII, each decimal digit is assigned a unique 7-bit binary code.

Example: Representing '9' in ASCII

  • The ASCII code for '9' is 57.
  • 57 in binary is 0111001.

So, the character '9' is represented as 0111001 in binary in ASCII.

Alphanumeric Representation

Alphanumeric representation refers to the encoding of both letters (alphabetic characters) and numbers (numeric characters) within computer systems. This allows computers to process and display textual information alongside numerical data. Alphanumeric characters include the letters A-Z (both uppercase and lowercase), the digits 0-9, and often various punctuation marks and special symbols.


Character Encoding Schemes

To represent alphanumeric characters in computers, various character encoding schemes have been developed. These schemes map each character to a unique binary value, allowing the computer to store and manipulate text data. The most common character encoding schemes include:

  1. ASCII (American Standard Code for Information Interchange)
  2. EBCDIC (Extended Binary Coded Decimal Interchange Code)
  3. Unicode


ASCII (American Standard Code for Information Interchange)

ASCII is one of the oldest and most widely used character encoding schemes. It uses 7 bits to represent 128 different characters, including:

  • Uppercase letters: A-Z (65-90 in decimal)
  • Lowercase letters: a-z (97-122 in decimal)
  • Digits: 0-9 (48-57 in decimal)
  • Punctuation marks and special symbols (32-47, 58-64, 91-96, 123-126 in decimal)
  • Control characters (0-31 in decimal)

Example: Representing 'A' and '1' in ASCII

  • The ASCII code for 'A' is 65, which is 01000001 in binary.
  • The ASCII code for '1' is 49, which is 00110001 in binary.


EBCDIC (Extended Binary Coded Decimal Interchange Code)

EBCDIC is an 8-bit character encoding scheme used primarily on IBM mainframe and midrange systems. It represents 256 different characters and includes support for alphabetic, numeric, punctuation, and control characters. Although less common than ASCII, EBCDIC is still used in some legacy systems.

Example: Representing 'A' and '1' in EBCDIC

  • The EBCDIC code for 'A' is 193, which is 11000001 in binary.
  • The EBCDIC code for '1' is 241, which is 11110001 in binary.


Unicode

Unicode is a comprehensive character encoding standard that aims to support all characters from all writing systems in the world. It uses a variable-length encoding, allowing it to represent over a million different characters. Unicode has several encoding forms, including:

  • UTF-8: Uses 1 to 4 bytes per character, compatible with ASCII.
  • UTF-16: Uses 2 or 4 bytes per character.
  • UTF-32: Uses 4 bytes per character.

Example: Representing 'A' and '1' in UTF-8

  • The UTF-8 code for 'A' is the same as ASCII: 01000001 in binary.
  • The UTF-8 code for '1' is the same as ASCII: 00110001 in binary.

Unicode's vast range makes it suitable for global text representation, including scripts, symbols, and emoji.

Data Representation for Computation

Data representation is crucial in computing as it determines how information is stored, processed, and interpreted by computer systems. For effective computation, data must be represented in a format that the computer can handle efficiently. This involves various types of data formats and encoding schemes. Here’s an overview of the key aspects of data representation for computation:


1. Binary Representation

At the core of data representation is the binary system, which uses two digits: 0 and 1. All data in computers, from numbers to text, is ultimately represented in binary form. This binary data can be grouped and processed in various ways:

  • Bits and Bytes: The smallest unit of data is a bit (binary digit), and eight bits make up a byte. Bytes are used to represent larger quantities of data, such as characters or small numbers.


2. Integer Representation

Integers are whole numbers and are represented in binary form. There are different methods for representing integers:

  • Unsigned Integers: Represent only non-negative numbers. For example, an 8-bit unsigned integer can represent values from 0 to 255.
  • Signed Integers: Represent both positive and negative numbers. Common methods include:
    • Sign-Magnitude Representation: The first bit indicates the sign (0 for positive, 1 for negative), and the remaining bits represent the magnitude.
    • One's Complement: Negative numbers are represented by inverting all bits of the positive number.
    • Two's Complement: A more common method where negative numbers are represented by inverting all bits and adding 1 to the result. This method simplifies arithmetic operations.


3. Floating-Point Representation

Floating-point representation is used for real numbers (numbers with fractional parts) and allows for a wide range of values by representing numbers in scientific notation:

  • IEEE 754 Standard: The most widely used standard for floating-point representation, which divides a number into three parts:
    • Sign Bit: Indicates whether the number is positive or negative.
    • Exponent: Scales the significand by a power of two.
    • Significand (Mantissa): Represents the precision bits of the number.

For example, the number 6.25 can be represented in IEEE 754 single precision as:

  • Sign Bit: 0 (positive)
  • Exponent: 10000001 (which is 129 in decimal, representing an exponent of 2^1)
  • Significand: 1001 (the fractional part)


4. Character Representation

Characters, including letters, digits, and symbols, are represented using encoding schemes:

  • ASCII: Uses 7 bits to represent 128 characters, including standard letters, digits, and punctuation.
  • Unicode: A more comprehensive standard that uses variable-length encoding (UTF-8, UTF-16) to represent characters from all writing systems and symbols worldwide.


5. Data Structures

Data structures are used to organize and manage data efficiently:

  • Arrays: Contiguous memory locations that hold elements of the same type.
  • Linked Lists: A collection of nodes, each containing data and a reference (or pointer) to the next node.
  • Trees: Hierarchical structures where each node has zero or more children, used for organizing data in a way that allows efficient searching and sorting.


6. Compression

Data compression reduces the size of data for efficient storage and transmission. Compression methods include:

  • Lossless Compression: Ensures that original data can be perfectly reconstructed, such as ZIP files and PNG images.
  • Lossy Compression: Reduces file size by removing some data, which is acceptable for certain applications like JPEG images and MP3 audio.


About John Doe

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Report an issue

Related Posts

3 Comments

John Doe

5 min ago

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Reply

John Doe

5 min ago

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Reply