EXP NO: 1 (a)
SIMPLE ARITHMETIC OPERATION - ADDITION
DATE:
FLOWCHAT: -
Start the Program
To Clear ‘A’ register content
Initialize HL register pair
Move the content of M to A
Increment HL register pair to point memory location
Add the values of M with A
Check
for
NO
carry
YES
Increment C register by 1
Increment HL Register to point next memory
Transfer the data from Accumulator to M
Increment the HL Register pair to point Next memory location
Transfer the content C register to M
STOP
EXP NO: 1 (a)
SIMPLE ARITHMETIC OPERATION - ADDITION
DATE:
AIM OF THE EXPERIMENT:-
To write an assembly language program to add two 8 bit numbers and store the result in a
memory location.
APPARATUS REQUIERD:-
Microprocessor Trainer Kit
Power Supply
ALGORITHM: -
Initialize memory pointer to data location.
Get the first number from memory in accumulator.
Get the second number and add it to accumulator.
Store the answer at another memory location.
PROCEDURE:-
Specified key in the opcode from the address.
Enter data at 4200 & 4201 as specified in the example.
Execute the program and check for the result at 4202.
Change data at 4200 & 4201 and execute each time and check for result.
PROGRAM: -
MEMORY
LABEL MNEMONICS OPERAND OPCODE DESCRIPTION
LOCATION
(ADDRESS)
4100 START MVI A 00 3E 00 Clear C Register
4101
Initialize HL Register to
4102 LXI H 4200 21 00 42
4200
4103
4104
Transfer first data to
4105 MOV A M 7E
accumulator.
Increment HL register to
4106 INX H 23
point next memory location.
Add first number to
4107 ADD M 86 accumulator content.
4108 L1 JNC 41 0C D2 0C 41 Jump to location if result
does not yield carry.
410A
410B INR C OC Increment C Register
Increment HL Register to
410C L1 INX H 23
point next memory location.
Transfer the result from
410D MOV M A 77
Accumulator to memory
Increment HL register to
410E INX H 23
point next memory location
410F MOV M C 71 Move carry to memory
4110 HLT 76 Stop the program
OBSERVATION: -
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
4201 4203
4202 4204
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
4201 4203
4202 4204
RESULT:-
Thus the assembly language program for addition among the array was executed using 8085
microprocessor.
EXP NO: 1 (b)
SIMPLE ARITHMETIC OPERATION - SUBTRACTION
DATE:
FLOWCHAT: -
Start the Program
To Clear ‘A’ register content
Initialize HL register pair
Move the content of M to A
Increment HL register pair to point memory location
Subtract the values of M with A
Check
NO
for
carry
YES
Increment C register by 1
Increment HL Register to point next memory
Transfer the data from Accumulator to M
Increment the HL Register pair to point Next memory location
Transfer the content C register to M
STOP
EXP NO: 1 (b)
SIMPLE ARITHMETIC OPERATION - SUBTRACTION
DATE:
AIM OF THE EXPERIMENT:-
To write an assembly language program to subtract two 8 bit numbers and store the result
in a memory location.
APPARATUS REQUIERD:-
Microprocessor Trainer Kit
Power Supply
ALGORITHM: -
Initialize memory pointer to data location.
Get the first number from memory in accumulator.
Get the second number and add it to accumulator.
If the results yields a borrow, the content of the accumulator is complemented and 01H is
added to it(2’s compliment). A Register is cleared and content of that register is
incremented in case there is borrow. If there is no borrow the content of the accumulator is
directly taken as the result.
Store the answer at another memory location.
PROCEDURE:-
Specified key in the opcode from the address.
Enter data at 4200 & 4201 as specified in the example.
Execute the program and check for the result at 4202.
Change data at 4200 & 4201 and execute each time and check for result.
PROGRAM: -
MEMORY
LABEL MNEMONICS OPERAND OPCODE DESCRIPTION
LOCATION
(ADDRESS)
4100 START MVI A 00 3E 00 Clear C Register
4101
Initialize HL Register to
4102 LXI H 4200 21 00 42
4200
4103
4104
Transfer first data to
4105 MOV A M 7E
accumulator.
Increment HL register to
4106 INX H 23
point next memory location.
Subtract first number to
4107 SUB M 96 accumulator content.
4108 L1 JNC 41 0C D2 0C 41 Jump to location if result
does not yield carry.
410A
410B INR C OC Increment C Register
Increment HL Register to
410C L1 INX H 23
point next memory location.
Transfer the result from
410D MOV M A 77
Accumulator to memory
Increment HL register to
410E INX H 23
point next memory location
410F MOV M C 71 Move carry to memory
4110 HLT 76 Stop the program
OBSERVATION: -
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
4201 4203
4202 4204
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
4201 4203
4202 4204
RESULT:-
Thus the assembly language program for subtraction among the array was executed using 8085
microprocessor.