LIAQUAT UNIVERSITY OF MEDICAL HEALTH & SCIENCES JAMSHORO
INSTITUTE OF BIO MEDICAL TECHNOLOGY
BS IN BIO-MEDICAL Engineering (5th Term 3rd Year) _________ Batch
LAB. EXPERIMENT # 07
Name: __________________________________ Roll No. _______________ Score: _____________ Signature of Teacher: __________________ Date:___________
BASIC LOGICAL OPERATIONS MICROPROCESSOR ASSEMBLY LANGUAGE FOR MAT-980 TRAINER
PERFORMANCE OBJECTIVE:
Upon successful completion of this experiment, the student will be able to: Develop and run a program for basic logical operations in 8085 Assembly language. Develop a program for AND operation in 8085 Microprocessor Assembly language for the following requirements: To AND two numbers immediately and store result at memory location 5030H. Develop a program for OR operation in 8085 Microprocessor Assembly language for the following requirements: To OR one number with another number immediately and store result at memory location 5040H. Write and run program on MAT980. EQUIPEMENT:
The power supply requirement of the MAT980 with no connected equipment is +5V 0.25V d.c at 400mA Before switch on your trainer please get it checked by the teacher.
DISCUSSION:
Logical instructions typically work on a bit by bit basis, although some processors use the entire contents of the operands as whole flags (zero or not zero input, zero or negative one output). Typical logical operations include logical negation or logical compliments (NOT), logical and (AND), logical inclusive or (OR or IOR), and logical exclusive or (XOR or EOR). Logical tests are a comparison of a value to a bit string (or operand treated as a bit string) of all zeros. Some processors have an instruction that sets or clears a bit or byte in registers or memory based on the processor condition codes. In this practical we will concentrate on two most commonly used instructions i.e AND and OR program through instruction set.
AND instruction is used to ANDing the numbers from different location such as register, memory location or immediate data an result is stored in register. AND instruction can be explained by the following graphical way.
STATEMENT:
Develop a program to AND two numbers immediately and store the result at memory address 5030H.
DATA:
5030H: Result
GRAPHICAL REPRESENTATION:
Accumulator A
Register C ANA C
08 09 AND 08 PROGRAM: MACHINE ASSEMBLY LANGUAGE PROGRAM LANGUAGE PROGRAM ADDRESS CONTENTS MNEMONICS OPERANDS 4800 21 LXI H, 5030H 4801 30 4802 50 4803 3E MVI A, 08H 4804 03 4805 0E MVI C, 09H 4806 09 4807 A0 ANA B 4808 77 MOV M,A 4809 76 HLT
ORinstruction is used to ORing the numbers from different location such as register, memory location or immediate data and result is stored in register.
STATEMENT:
Develop a program to OR one number with another number immediately and store the result at memory address 5040H.
DATA:
5040H = Result
GRAPHICAL REPRESENTATION:
Accumulator A
Register D ORA D
0A 0B OR 0B PROGRAM:
MACHINE ASSEMBLY LANGUAGE PROGRAM LANGUAGE PROGRAM ADDRESS CONTENTS MNEMONICS OPERANDS 4800 21 LXI H, 5040H 4801 40 4802 50 4803 3E MVI A, 0AH 4804 0A 4805 16 MVI D, 0BH 4806 0B 4807 B0 ORA D 4808 77 MOV M,A 4809 76 HLT
PROCEDURE:
1. Write data at memory locations through MEM key. 2. Write a program at memory locations 4800H through MEM key. 3. Use SST key to execute program step by step with + key. 4. Use REG and of different registers at each instruction execution. 5. Use MEM keys to view the results at memory locations 5030H & 5040H.
TEST RESULT:
(i) Fill the observation table #1 for the AND program at the end of execution.
(ii) Fill the observation table #2 for the OR program at the end of execution.
(iii) By varying the immediate data in both registers such as Register A = EF and register C = 0F or D = 0C, what will be the contents of Accumulator after ANDing&ORing program.
After AND ProgramAfter ORProgram
Accumulator Accumulator
TABLES:
For AND operation
Table #01
For ORing operation
Register / Memory location Contents Accumulator A Register D MEM 5040H
Table #02
Register / Memory location Contents Accumulator A Register B MEM 5030H
REVIEW QUESTIONS:
1. What is the purpose of immediate addressing mode in ANDing&ORing programs? ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________
2. In which general purpose register all arithmetic & logical operations are performed? ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________
3. What is the purpose of ORA D instruction? ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________
4. Which addressing mode is used for ANA C instruction? ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________
5. Why HALT instruction is used? ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________
FINAL CHECK LIST:
1. Clean your equipment/material and workbench before you leave. 2. Return all equipment and material to their proper storage area. 3. Submit your answers to questions, together with your data, calculations and result before the next laboratory.