COMPUTER LANGUAGE
The functioning of a computer is controlled by a set of instructions (called a 'computer program'). These instructions are written to tell the computer:
- What operation to perform?
- Where to locate data?
- How to present results?
- When to make certain decisions? And so on.
The communication between two parties whether they are machines or human beings always need a common language or terminology. The language used in the communication of computer instructions is known as the programming language. The computer has its own language and any communication with the computer must be in its language or translated into this language.
Three levels of programming languages are available. They are:
- Machine Language (Binary Language)
- Assembly (or symbolic) Language
- Procedure-oriented languages (High Level Language)
Note: Assembly language is a low level language.
In the early days of computers, there was only one method for programming i.e. in machine language. The computer pioneers quickly learned that machine language programming was not very practical, so they devised a programming language that represented machine language instructions with symbolic names. They called this symbolic programming language as assembly language programming. Although, Assembly language programming was definitely a step in the right direction, computer programmers developed high-level languages like FORTRAN, COBOL and BASIC to make life even easier.
Modern computer programmers have a wide range of languages at their disposal. Many programmers prefer C or Pascal. However, a lot of other languages are widely used, including Assembly language. Although, it is rare today to see an application program written entirely in assembly language, some devoted Assembly language programmers use Assembly language combined with a high-level language to speed up certain time-dependent routines. While there are excellent optimizing compilers available, there are a number of routines that require the speed that can only be achieved using carefully crafted assembly language code. Additionally, intimate knowledge of the computers helps you to write very efficient high-level language programs and to understand how the computer actually performs its many tasks.
MACHINE LANGUAGE
The computer is made of two-state electronic components which can understand only pulse and no-pulse (or '1' and '0') conditions.Therefore, all instructions and data should be written using binary codes 1 and 0. The binary code is called the machine code or machine language.
Computers do not understand English or Hindi. They respond only to machine language. In addition to this, computers are not identical in design. Therefore, each computer has its own machine language (however, the script, 1 and 0, is the same of all computers). This poses two problems for the user.
First, it is a traumatic experience to understand and remember the various combinations of 1's and 0's representing numerous data and instructions. Also, writing error-free instructions is a slow process. Secondly, since every machine has its own machine language, the user cannot communicate with other computers, if he does not know its language.
As its name implies, machine language programming is performed in the language of the computer itself. A digital computer, such as a PC or compatible, only understands two different states: off and on. These two digital states are more commonly represented by the binary digits 0 and 1, respectively. Furthermore, a binary digit is traditionally referred to as a bit. A statement in a machine language program is comprised of a string of these bits. These bit strings are referred to as bit patterns. The following line illustrates a machine language bit pattern.
101110000000010100000000
These machine language bit patterns represent instructions, data and locations of instructions and data. The first 8 bits of the previous bit pattern are an 8088 machine language instruction. The last 16 bits of the previous bit pattern represent a data value. The following example illustrates how the computer views the previous bit pattern:
10111000 0000010100000000 | Machine Language |
mov ax 3 | Assembly Language |
As the previous example illustrates , the first 8 bits of the bit pattern tell the computer to move the 16-bit number that follows the instruction into a storage location called AX. These storage locations are called registers. In the case of the above instruction, the machine language instruction tells the CPU to store a value of 3 in its AX register.
Although, machine language is fascinating, it can be very hard to understand. After all, a machine language program can be constructed from an almost limitless variety of bit patterns. Recollecting what type of function the bit pattern performs is too much difficult for even the best programmer to remember.
ASSEMBLY LANGUAGE
To present the machine language instructions in a much more accessible form, early programmers devised a method for representing machine language instructions using a language called Assembly Language. To say the least, the previous assembly language statement is far easier to remember than its corresponding machine language bit pattern. Unfortunately, the computer is unable to recognize the assembly language statements. As the computer understands only machine-code instructions, a program written in assembly language must be translated into machine language before the program is executed. This translation is done by a computer program referred to as an assembler. The assembler simply translates Assembly language program into equivalent machine language bit patterns.
An assembly language uses mnemonic codes rather than numeric codes (as used in machine language). For example, ADD or A is used as a symbolic operation code to represent addition and SUB or S is used for subtraction. Memory locations containing data are given names such as TOTAL, MARKS, TIME, MONTH, etc.
The assembler language is again a machine-oriented language and hence the program has to be different for different machines, the programmer should remember machine characteristics when he prepared a program. Writing a program in assembly language is still a low and tedious task.
Comments
Post a Comment