Lecture 6 Updated
Lecture 6 Updated
Lecture 6 Updated
ORGANIZATION
Dr. Zahraa Salaheldin Ismail
Lecture 6: Basic Computer Instructions
PROGRAM
❑A program is a set of instructions that specify the operations, operands, and the sequence by which processing has to
occur.
▪ (Machine) Instruction: a group of bits that tell the computer to perform a specific operation (a sequence of micro-
operation)
▪Control circuitry in the control unit → translates the instruction into the sequence of microoperations necessary
to implement it.
INSTRUCTION FORMAT
❑Computer instruction is often divided into three parts
◦ An opcode (Operation Code) that specifies the operation for that instruction
◦ An address that specifies the registers and/or locations in memory to use for that operation
◦ 1-bit for Addressing mode
◦ Direct address: the address in memory of the data to use (the address of the operand). or
◦ Indirect address: the address in memory of the address in memory of the data to use.
e: …..
….. Jmp e
ADD AR a+12
read M[AR]
BASIC COMPUTER INSTRUCTIONS (EXAMPLE)
Give the equivalent hexadecimal code and explain what the instruction is going to perform.
Sol:
HEXADECIMAL NUMBER SYSTEM (BASE 16)
BASIC COMPUTER INSTRUCTION FORMAT
BASIC COMPUTER INSTRUCTIONS
BASIC COMPUTER INSTRUCTIONS
▪ A computer should have a set of instructions so that the user can construct machine language programs to evaluate any
function that is known to be computable.
▪ Instruction Types
◦ Functional Instructions
Arithmetic, logic, and shift instructions
◦ Transfer Instructions
Data transfers between the main memory and the processor registers
◦ Control Instructions
Program sequencing and control
◦ Input/Output Instructions
Input and output
BASIC COMPUTER INSTRUCTIONS
o Functional Instructions
Arithmetic instructions ADD, CMA, INC
There is one arithmetic instruction, ADD, and two related instructions, complement AC(CMA) and increment AC(INC). With
these three instructions we can add and subtract binary numbers when negative numbers are in signed-2's complement
representation. Multiplication and division can be performed using addition, subtraction, and shifting.
Write a program using basic computer microoperations to increment data stored in the memory location 12C
REGISTER-REFERENCE INSTRUCTIONS
REGISTER-REFERENCE INSTRUCTIONS (EXAMPLE)
AND INSTRUCTION
MICRO-OPERATIONS
DR M[AR]
AC DR and AC
MEMORY-REFERENCE INSTRUCTIONS (EXAMPLE)
An instruction at address 021 in the basic computer has I = 0, an operation code of the
AND instruction, and an address part equal to 083.
M[083] = B8F2 and the content of AC is A937.
Go over the instruction cycle and determine the contents of the following registers after the execution phase.
Repeat the problem six more times starting with an operation code of another memory-reference instruction.
INPUT-OUTPUT INSTRUCTIONS
The branch instruction is not skipped if the flag is 0. If the flag is 1, the branch instruction is skipped and an input or
output instruction is executed.
BASIC COMPUTER INSTRUCTIONS (EXAMPLE)
BASIC COMPUTER INSTRUCTIONS (EXAMPLE)