Page 10 - DCAP102_DCAP_401_Foundations of Computer Programming
P. 10
Unit 1: Foundation of Programming Languages
Use of Symbols Instead of Numeric of OpCodes Notes
All computers have the power of handling letters as well as numbers. Hence, a computer can be
taught to recognize certain combination of letter or numbers. It can be taught to substitute the
number 14 every time it sees the symbol ADD, substitute the number 15 every time it sees the
symbol SUB, and so forth. In this way, the computer can be trained to translate a program written
with symbols instead of numbers into the computer’s own machine language. Then we can write
program for the computer using symbols instead of numbers, and have the computer do its own
translating. This makes it easier for the programmer, because he can use letters, symbols, and
mnemonics instead of numbers for writing his programs.
Example: The preceding program that was written in machine language for adding two
numbers and printing out the result could be written in the following way:
CLA A
ADD B
STA C
TYP C
HLT
Which would mean “take A, add B, store the result in C, type C, and halt.” The computer by
means of a translating program, would translate each line of this program into the corresponding
machine language program.
Advantages of Assembly Language
The main advantages of assembly language are:
1. Assembly language is easier to use than machine language.
2. An assembler is useful for detecting programming errors.
3. Programmers do not have to know the absolute addresses of data items.
4. Assembly languages encourage modular programming.
Disadvantages of Assembly Language
The main disadvantages of assembly language are:
1. Assembly language programs are not directly executable.
2. Assembly languages are machine dependent and, therefore, not portable from one machine
to another.
3. Programming in assembly language requires a higher level of programming skill.
1.3 Assembly Program Execution
An assembly program is written according to a strict set of rules. An editor or word processor is
used for keying an assembly program into the computer as a file, and then the assembler is used
to translate the program into machine code.
LOVELY PROFESSIONAL UNIVERSITY 3