LIAQUAT UNIVERSITY OF MEDICAL HEALTH & SCIENCES JAMSHORO
INSTITUTE OF BIO MEDICAL TECHNOLOGY
BS IN BIO-MEDICAL Engineering (5th Term 3rd Year) _________ Batch
LAB. EXPERIMENT # 06
Name: __________________________________ Roll No. _______________ Score: _____________ Signature of Teacher: __________________ Date:___________
BASIC ARITHMATIC OPERATIONS IN 8085 MICROPROCESSOR ASSEMBLY LANGUAGE FOR MAT-980 TRAINER
PERAFORMANCE OBJECTIVE:
Upon successful completion of this experiment, the student will be able to: Develop and run a program for basic arithmetic operations in 8085 Assemble language.
PERAFORMANCE OBJECTIVE:
Develop a Addition program in 8085Microprocessor Assembly language for the following requirements: To add two numbers immediately and store result at memory location5020H. Develop a subtraction program in 8085 Microprocessor Assemble language for the following requirements: Subtract one number from another number immediately and store at memory location 5050H. Write and run program on MAT980.
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:
Basic arithmetic operations of 8085 Microprocessor are used to performs the addition, subtraction, increment, decrement and compare operations. Arithmetic operations can be signed or unsigned (unsigned is useful for effective address computations). Microprocessor has instructions for each operation such as ADD, SUB, CMP, DCR, INR etc. These instructions normally used with different addressing modes. In this practical we will concentrate on two most commonly used instructions i.e ADD and SUB.
To develop a Assembly language program for the ADD & SUB operations. First we develop a data map in which all program requirements are mentioned along with addresses and their contents. After data map, a program operation is developed graphically by using flow chart technique. Flow chart is then converted into Assembly language program of 8085 microprocessor. At the end Assembly language program is converted into machine language program through instruction set.
ADD instruction is used to add the numbers from different location such as register, memory location or immediate data and result is stored in register.
ADD Arithmetic Addition; DEC VAX; signed addition of scalar quantities (8, 16, or 32 bit integer or 32 or 64 bit gloating point) in general purpose register or memory, available in two operand (first operand added to second operand with result replacing second operand) and three operand (first operand is added to second operand with result placed in third operand) (ADDB2 add byte to operand, ADDB3 add byte 3 operand, ADDW2 add word 2 operand, ADDW3 add word 3 operand, ADDL2 add long 2 operand, ADDL3 add long 3 operand); clears or sets flags.
ADDAdd Integers; Intel 80x86; integer add of the contents of a register or memory (8, 16 or 32 bits) to a memory location or a register; sets or clear flags.
ADDAdd; MIX; add word or partial word field contents of memory to A-register (accumulator), overflow toggle set if result is too large for A-register.
AR Add Register; IBM 360/370; RR format; signed add of the contents of a general purpose register (32 bits) to a general purpose register (32 bits); register to register only; sets or clear flags.
A Add; IBM 360/370; RX format; signed add of the contents of a memory location (32 bits) to a general purpose register (32 bits); main memory to register only; sets or clear flags.
AH Add half-word; IBM 360/370; RX format; signed add of the contents of a memory location (16 bits) to a general purpose register (low order 16 bits); main memory to register only; sets or clear flags.
STATEMENT:
Develop a program to ADD two numbers immediately and store the result at memory address 5020H.
DATA:
5020H: Result
GRAPHICAL REPRESENTATION:
Accumulator A
Accumulator A
Register B ADD B
PROGRAM:
MACHINE ASSEMBLY LANGUAGE PROGRAM LANGUAGE PROGRAM ADDRESS CONTENTS MNEMONICS OPERANDS 4800 21 LXI H, 5020H 4801 20 4802 50 4803 3E MVI A, 05H 4804 03 4805 06 MVI B, 06H 4806 04 4807 80 ADD B 4808 77 MOV M,A 4809 76 HLT
SUB instruction is used to subtract the number from another number from different location such as register, memory location or immediate data and result is stored in register.
05 09 ADD 0B SUB subtract; DEC VAX; signed subtraction of scalar quantities (8, 16, or 32 bit integer) in general purpose registers or memory, available in two operand (first operand subtracted from second operand with result replacing second operand) and three operand (first operand subtracted from second operand with result placed third operand) (SUBB2 subtract byte 2 operand, SUBB3 subtract byte 3 operand, SUBW2 subtract word 2 operand, SUBW3 subtract word 3 operand, SUBL2 subtract long 2 operand, SUBL3 subtract long 3 operand); clears or sets flags.
SUB Subtract Integer; Intel 80x86; integer subtraction of the contents of a register or memory (8, 16, or 32 bits) from a memory location or a register; sets or clear flags.
SUB Subtract; MIX; subtract word or partial word field contents of memory from A- register (accumulator), overflow toggle possibly set.
SR Subtract Register; IBM 360/370; RR format; signed subtract of the contents of the general purpose register (32 bits) from a general purpose register (32 bits); register to register only; sets or clear flags.
S Subtract; IBM 360/370; RX format; signed subtract from the contents of a memory location (32 bits) from a general purpose register (32 bits); main memory to register only; sets or clear flags.
SH Subtract half-word; IBM 360/370; RX format; signed subtract of the contents of a memory location (16 bits) from a general purpose register (low order 16 bits); main memory to register only; sets or clear flags.
STATEMENT:
Develop a program to subtract one number from another number immediately and store the result at memory address 5050H.
DATA:
5050H = Result
GRAPHICAL REPRESENTATION:
Accumulator A
Register B SUB B
0A 08 SUB 02 PROGRAM:
MACHINE ASSEMBLY LANGUAGE PROGRAM LANGUAGE PROGRAM ADDRESS CONTENTS MNEMONICS OPERANDS 4800 21 LXI H , 5050H 4801 50 4802 50 4803 3E MVI A, 05H 4804 0A 4805 06 MVI B, 06H 4806 04 4807 90 SUB B 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 location 5020H & 5050H.
TEST RESULT:
i. Fill the observation table #1 for the Addition program at the end of execution. ii. Fill the observation table #2 for the Subtraction program at the end of execution. iii. By varying the immediate data in both registers such as Register A = EF and register B = 0F, what will be the contents of accumulator after Addition & Subtraction program.
After Addition program After Subtraction program
Accumulator Accumulator
TABLES:
For Addition
Table #01
For Subtraction
Register / Memory location Contents Accumulator A Register B MEM 5050H
Table #02
Register / Memory location Contents Accumulator Register B MEM 5020H REVIEW QUESTIONS:
1. What is the purpose of immediate addressing mode in Addition programs? ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________
2. In which general purpose register, all arithmetic & logical operations are performed? ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________
3. What is the purpose of MOV M , A instruction? ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________
4. Which addressing mode is used for ADD B instruction? ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________
5. Why load H & L registers with immediate address? ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________
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.