Computer is a collection of digital electronic circuits in which the memory circuits play a major role. The input to as well as outputs from the microprocessor are all expressed in terms of voltages applied on the specified set of terminals meant for input and outputs, respectively. We may code the high value of voltage (typical value 5 V) as 1 and low value of voltage (typical value 0) as 0. Thus, an instruction to the microprocessor of the computer may be represented as a sequence of 0s and 1s (ones and zeros), such as 11001001. These ones and zeros are electronic signals that tell the computer what to do. In fact, microprocessors are designed to carry out a large number of instructions. The manufacturers supply the set of instructions and their respective codes.
Also, the numbers that we use in our daily life, i.e., decimal numbers, can also be represented in terms of binary numbers. For instance, 1 is represented as 1, 2 are represented as 10, 3 is represented as 11, 4 is represented as 100, and so on. A typical program comprises of instructions and data which may be represented as sequences of 0s and 1s. Thus, a complete program becomes a long list of sequences of 0s and 1s. You may now raise the query "How does a computer know which number is instruction and which number is simple data?" There are different instruction formats which are combinations of opcodes (operation code), other codes, and data. The first number in an instruction is opcode which is linked to the instruction for the microprocessor. An instruction may or may not be followed by data because some instructions do not require data. Thus, the processor can make out which sequence of 0s and 1s is instruction and which is data. The complete set of these instructions for a CPU is called machine language code or simply machine language. Although we make the program as sequences of 0s and 1s, these are interpreted as 5V and 0V respectively (some systems work on 3V and 0V).This is the language which the machine or the microprocessor understands. Machine code is the only language a computer understands. The format of typical instruction requiring two data items is illustrated in Fig.
A program written in machine language will consist of a large number of sequences of 0s and 1s. Because of this reason, it is very difficult to write programs using machine language. It is even more difficult to locate errors and debug the program.
The instruction codes for processors made by different manufacturers are different for the same process such as storage or for manipulations such as addition, subtraction etc. Therefore, the program written in one machine language for one type of CPU will work only on computers having same type of CPU and it will not work on computers based on other types of CPUs. That is, besides being cumbersome to write and debug there is no portability of these programs from one type of computer to another type of computer. Moreover, it is very difficult to convert a program made for one type of CPU to suit another type of CPU. For these two reasons, high-level languages (HLL) have been developed. With high-level computer languages it is easy to develop a program, easy to maintain the program, and most importantly the programs are portable from one computing platform to another.
Related Articles (You May Also Like)