Skip to main content

Machine Language


 Although we can design a computer to make it understand many different computer languages, every computer understands only one language without using translation program. This language is called machine language of the computer. normally, the machine language of the computer is written as the strings of binary 1s or 0s. The circuitry of a computer can recognize the machine language instructions immediately. It converts them into electricals signals to execute them.

A  machine language instruction has the two part format. The first part is operation code that tells the computer what function to perform, and the second part is operand that tells where to find or store the data on which the computer has to perform the function. hence, each instruction tells the computer what operation to perform and the length and locations of the data fields involved in the operation. every computer has a set of operation codes called its instruction set. Each operation code in the instruction set is meant to perform a specific basic operation or function. Typical operations included in the instruction set of a computer are:

1. Algorithm operation.

2. Logical operation.

3. Branch operations (either conditional or un conditional) for transfer of control to the given in the operand field.

4. Data movement operations for moving data between memory locations and resisters.

5. Data movement operations for moving data from input device to memory or from memory to output device.

Instruction format.

In above figure shows a typical single address machine language instruction. Although some computers use only single address instructions, many computers use multiple address instruction that include address of two or more operands. For example, legend and addend may be two operands of an additional methods.

All computers use binary digits  for operating internal operations. Hence, most computer's machine language instructions consist of string of binary numbers. For example, a typical program instruction to print a number on a printer might be:

 0110001010101110010110010000

A program to add two numbers in memory, and print the result might be:

10001000111100110011
11111100001010101010
10000000101010101100
00000001100000101101
00000000000000000000

                                              Obviously, this language is not easy to use because it is not easy to read and understand, and because it uses a number system, with which are not familiar. However, some of the first programmers, who worked with first few computers, actually wrote their program in binary from as this one.

Since human programmers are more familiar with decimal number system, they prefer to write instructions in decimal, and leave it to the input device to convert them into binary. In fact, without too much effort a computer can be wired so that instead of using long strings of 1s and 0s we can use the more familiar decimal numbers. With this change, the preceding program appears as follows:

100000471
146007770
134063562
105550000
000000000

This set of instructions, whether in binary or decimal, which a computer can understand directly without the help of a translating program is called machine code or  machine programming language. Hence, we need not necessarily code a machine language program as string of binary digits (1s and 0s). we can also write it using decimal digits if the computer's circuitry permits this.

Advantages and Limitations of machine language:

A computer can execute programs written in machine language at high and great speed because the computer can understand machine instruction without the need of any translation. However, writing a program in machine language has following disadvantages:

1. Machine dependent:

As the internal design of every computer is different from every other type of computer, machine language also differs from computer to computer. Hence, becoming proficient in the machine language of one type of computer, if a company decides to change another type, its programmer will have to learn new machine language, and would have to rewrite all the existing programs.

2. Difficult to program:

Although a computer executes machine language programs directly and efficiently, it is difficult to program in machine language. It is necessary for a programmer to either memorise the dozens of operation code numbers for the commands in the machine's instruction set or refer to a reference card constantly. A programmer must also keep track of storage locations of data and instructions. Moreover, a machine language programmer must be knowledgeable about the hardware structure of the computer.

3. Error prone:

For writing programs in machine language, a programmer has to remember the opcodes and must track of storage locations of data and instructions. This make it very difficult for him/her to concentrate fully on the logic of the problem, resulting in programming errors. Additionally, due to lack of any immediate visual indication of an error as the programmer writes  machine language code, it makes removal of such errors are the more difficult.

4. Difficult to modify:

It is difficult to currect or modify machine language programs. Checking machine instructions to locate errors is very difficult and time consuming. Similarly, modifying a machine language program later is so difficult that many programmers prefer to code the new logic afresh instead of incorporating necessary modifications in the old program.


In short we rarely use machine language today for writing programs because it is very difficult and time consuming to do so.



Comments

Popular posts from this blog

Word-processing Package

The term word processing describes use of hardware and software to create, edit, view, format, store, retrieve and print documents (written materials such as letters, reports, books, etc.). A word processing package enables us to do all these on computer system. Commonly supported features: Today's word processing packages normally support the features described below: 1. Entering Text : This feature allows a user to enter text with computer's keyboard. Every character typed on keyboard is displayed immediately on computer's screen. Word wrap feature of word processing software determines when current line is full, and it automatically moves the text that follows to the next line. Hence, only time the user has to press Enter key is at the end of the paragraph. This feature is very useful to those having fast typing speed because they can enter text at their speed, without the need to keep track of where to end a line. 2. Editing Text : This feature allows a user to make cha

Computer Languages - introduction

  This chapter continues with the discussion of development of computer programs. Once a programmer has finished planning of a computer program, he/she is now ready to write the steps of the corresponding algorithm in a programming language.  Computer language or programming language is a language acceptable to a computer system, and the process of writing instructions in such a language is called programming or coding.   The goal of this post is to introduce some popular programming languages.  Analogy with natural languages:   Language is a mans of communication. We use a natural language such as English, to communicate our emotions and ideas to others. Similarly a programmer uses a computer language to instruct computer what he/she want to do.  All natural languages (English, French, German, etc.) use a standard set of words and symbols for communication. Everyone uses that language understands these words and symbols. The set of words allowed in a language is called its vocabulary.

Central Processing Unit

  Central Processing Unit (CPU) A Central Processing Unit is also called a processor, central processor, or microprocessor. It carries out all the important functions of a computer. It receives instructions from both the hardware and active software and produces output accordingly. It stores all important programs like operating systems and application software. CPU also helps Input and output devices to communicate with each other. Owing to these features of CPU, it is often referred to as the brain of the computer. Central Processing Unit CPU is installed or inserted into a CPU socket located on the motherboard. Furthermore, it is provided with a heat sink to absorb and dissipate heat to keep the CPU cool and functioning smoothly. Generally, a CPU has three components: 1. Control Unit 2. Arithmetic Logic Unit 3. Memory or Storage Unit 1. Control Unit : It is the circuitry in the control unit, which makes use of electrical signals to instruct the computer system for executing already

Introduction to Computer

  The word "computer" comes from the word "compute", which means "to calculate". Hence, people usually consider a computer to be a calculating device that can perform arithmetic operations at high speed.  The straightforward meaning of a computer is a machine that can calculate. However, modern computers are not just a calculating device anymore. They can perform a variety of tasks. In simple terms, a computer is a programmable electronic machine used to store, retrieve, and process data. According to the definition, " A computer is a programmable electronic device that takes data, perform instructed arithmetic and logical operations, and gives the output." Whatever is given to the computer as input is called 'data', while the output received after processing is called 'information'. Although the original objective of inventing a computer was to create a fast calculating device, we name define a computer as a device that operates

Computer system architecture

  Computer Architecture  A computer system is basically a machine that simplifies complicated tasks. It should maximize performance and reduce costs as well as power consumption.The different components in the Computer System Architecture are Input Unit, Output Unit, Storage Unit, Arithmetic Logic Unit, Control Unit etc. A diagram that shows the flow of data between these units is as follows − The input data travels from input unit to ALU. Similarly, the computed data travels from ALU to output unit. The data constantly moves from storage unit to ALU and back again. This is because stored data is computed on before being stored again. The control unit controls all the other units as well as their data. Details about all the computer units are − Input Unit The input unit provides data to the computer system from the outside. So, basically it links the external environment with the computer. It takes data from the input devices, converts it into machine language and then loads it into t