Basics of Programming (Coding)
Coding :
*We need a language to interact with computer
Programming languages are classified as :
1. Machine language
2 . Assembly language
3 . High level language
Basics of Programming (Coding)
MACHINE LANGUAGE :-
the language of 0s and 1s
system dependent
different set of binary instructions for different types of computer
systems .
LIMITATIONS :
It is very tedious and error prone process of writing programs in
machine languages .
Basics of Programming (Coding)
ASSEMBLY LANGUAGE:
low level programming language
the sequence of 0s and 1s are replaced by mnemonic (ni-monic)
codes.
Example :- ADD for addition, SUB for subtraction etc
system dependent program
*Assembler(a system program) is used to translate an assembly
language program into the machine language program.
Basics of Programming (Coding)
HIGH LEVEL LANGUAGE :-
English like statements and programs
programs are needed to be translated into machine language
Compiler or Interpreter are used for translation
programs are much easier to write, maintain and modified .
*HIGH LEVEL LANGUAGE PROGRAM IS ALSO CALLED SOURCE CODE.
Translators
COMPILER
High-Level Machine Language
Language Program
OR Program
INTERPRETER
Assembly language Machine Language
ASSEMBLER Program
Program
Example: an assembly language program
MVI C, 00 'Initialize C register to 00
LDA 4150 'Load the value to Accumulator.
MOV B, A 'Move the content of Accumulator to B
register.
LDA 4151 'Load the value to Accumulator.
ADD B 'Add the value of register B to A
JNC LOOP 'Jump on no carry.
INR C 'Increment value of register C
LOOP: STA 4152 'Store the value of Accumulator (SUM).
MOV A, C 'Move content of register C to Acc.
STA 4153 'Store the value of Accumulator (CARRY)
HLT 'Halt the program.
Linker
A linker takes several object files and libraries as
input and produces one executable object file.
It retrieves from the input files (and puts them
together in the executable object file) the code of all
the referenced functions/procedures and it resolves
all external references to real addresses. The libraries
include the operating sytem libraries, the language-
specific libraries, and, maybe, user-created libraries.
"Linking is simply the process of placing the address
of a called function into the calling function's code.
This is a fundamental software concept."
Loader
A loader loads an executable object file into memory, initializes the
registers, heap, data, etc and starts the execution of the program.
This refers to copying a program image from hard disk to the main
memory in order to put the program in a ready-to-run state.