Coa 4
Coa 4
• Introduction,
• Machine Language,
• Assembly Language and Assembler,
• Program loops,
• Programming Arithmetic and
• logic operations,
• Subroutines,
• I-O Programming.
Introduction
• A total computer system includes both hardware
and software . hardware consists of the physical
components and all associated equipment.
• Software refers to the programs that are written
foe the computer.
• It is possible to be familiar with various aspects of
computer software without being concerned with
details of how the computer hardware operates.
• It is also possible to design parts of the hardware
without a knowledge of its software capabilities.
Machine Language
• A program is a list of instructions or statements
for directing the computer to perform a required
data-processing task.
• CLA non-MRI
• ADDOPR d i re c t a d d r e s s M R I
• ADDPTRI i n d i re c t a d d r e s s M R I
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.
The 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.
Representation of Symbolic Program in
Memory
• Prior to starting the assembly process, the
symbolic program must be stored in memory. The
user types the symbolic program on a terminal.
• A loader program is used to input the characters
of the symbolic program into memory.
• Since the program consists of symbols, its
representation in memory must use an
alphanumeric character code.
• In the basic computer, each character is
represented by an 8-bit code. The high-order
bit is always 0 and the other seven bits are as
specified by ASCII.
• Each character is assigned two hexadecimal
digits which can be easily converted to their
equivalent 8-bit code.
line of code
• A line of code is stored in consecutive memory locations with
two characters in each location. Two characters can be stored in
each word since a memory word has a capacity of 16 bits. A
label symbol is terminated with a comma.
Example : PL3, LDA SUB I
First Pass
• A two-pass assembler scans the entire symbolic
program twice.
• During the first pass, it generates a table that
correlates all user-defined address symbols with
their binary equivalent value.
• The binary translation is done during the second
pass.
• To keep track of the location of instructions, the
assembler uses a memory location counter (LC)
word called a location counter (abbreviated LC).
Second Pass
• Machine instructions are translated during the
second pass by means of tablelookup
procedures.
• A table-lookup procedure is a search of table
entries to determine whether a specific item
matches one of the items stored in the table.
• The assembler uses four tables. Any symbol
that is encountered in the program must be
available as an entry in one of these tables;
otherwise, the symbol cannot be interpreted.
• Four Tables:
• 1. Pseudoinstruction table.
• 2. MRI table.
• 3. Non-MRI table.
• 4. Address symbol table.