Lecture 9 Programming
Lecture 9 Programming
Lecture-9
Programming the Basic Computer
Spring 2024
1
Today
• Introduction
• Assembly Language
• Control functions
• Example Problems
Introduction
• Programs written for a computer may be in one of the following
categories:
2. Non-MRI:
– A non-MRI is defined as an instruction that does not have
an address part.
Assembly Language
• Instruction Field: The instruction field in an assembly
language program may specify one of the following items:
3. Pseudoinstruction:
– A pseudoinstruction is not a machine instruction but rather
an instruction to the assembler giving information about
some phase of the translation.
– Four pseudoinstructions that are recognized by the
assembler are listed below.
Assembly Language
• Comments Field: The third field in a program is reserved for
comments. A line of code may or may not have a comment, but if
it has, it must be preceded by a slash for the assembler to
recognize the beginning of a comment field.
• Comments are inserted for explanation purposes only and are
neglected during the binary translation process.
Example-1
• The first line has the pseudoinstruction ORG to define the origin of
the program at memory location (100)16.
• The next six lines define machine instructions, and the last four
have pseudoinstructions.
Example-1
• Three symbolic addresses have been used and each is listed in
column 1 as a label and in column 2 as an address of a memory-
reference instruction.
• Three of the pseudoinstructions specify operands, and the last one
signifies the END of the program.
Example-1
• When the program is translated into binary code and executed by
the computer it will perform a subtraction between two numbers.