Unit 3 - Assembly Language Programming
Unit 3 - Assembly Language Programming
By:Prof.Niral Jadav
Machine Language
Categories of programs
Binary code
This is a sequence of instructions and operands in binary that list the exact
representation of instructions as they appear in computer memory.
Octal or hexadecimal code
This is an equivalent translation of the binary code to octal or hexadecimal
representation.
Symbolic code
➢ The user employs symbols (letters, numerals, or special characters) for the operation
part, the address part, and other parts of the instruction code.
➢ Each symbolic instruction can be translated into one binary coded instruction by a
special program called an assembler and language is referred to as an assembly
language program.
High-level programming languages
➢ These are special languages developed to reflect the procedures used in the
solution of a problem rather than be concerned with the computer hardware
behavior. E.g. Fortran, C++, Java, etc.
➢ The program is written in a sequence of statements in a form that people prefer
to think in when solving a problem.
➢ However, each statement must be translated into a sequence of binary
instructions before the program can be executed in a computer.
INTEGER A, B, C
DATA A, 83 B,-23
C = A + B
END
Assembly Language
Pseudo Instruction
A pseudo instruction is not a machine instruction but rather an instruction to the assembler
giving information about some phase of the translation.
Assembler
➢ An assembler is a program that accepts a symbolic language program and produces
its binary machine language equivalent.
➢ The input symbolic program is called the source program and the resulting binary
program is called the object program.
➢ The assembler is a program that operates on character strings and produces an
equivalent binary interpretation.
A.L.P. to subtract 2 numbers
First Pass of an assembler
Second Pass of an assembler
Program Loops
➢ A program loop is a sequence of instructions that are executed many times, each time
with a different set of data.
➢ A system program that translates a program written in a high-level programming
language to a machine language program is called a compiler.
Programming Arithmetic and Logic operations
A.L.P. to Add Two Double-Precision Numbers
Subroutine
➢ A set of common instructions that can be used in a program many times is called a
subroutine.
➢ Each time that a subroutine is used in the main part of the program, a branch is
executed to the beginning of the subroutine.
➢ After the subroutine has been executed, a branch is made back to the main program.
➢ A subroutine consists of a self contained sequence of instructions that carries a given
task.
I-O Programming
A.L.P. to input one character & output one character