8 BIT DATA ADDITION
AIM:
To add two 8 bit numbers stored at consecutive memory locations.
ALGORITHM:
1. Initialize memory pointer to data location.
2. Get the first number from memory in accumulator.
3. Get the second number and add it to the accumulator.
4. Store the answer at another memory location.
PROGRAM:
ADDRESS
|
OPCODE
|
LABEL
|
MNEMONICS
|
OPERAND
|
COMMENT
|
8000
|
START
|
MVI
|
C, 00
|
Clear C reg.
| |
8001
| |||||
8002
|
LXI
|
H, 9000
|
Initialize HL reg. to 9000
| ||
8003
| |||||
8004
| |||||
8005
|
MOV
|
A, M
|
Transfer first data to accumulator
| ||
8006
|
INX
|
H
|
Increment HL reg. to point next memory location.
| ||
8007
|
ADD
|
M
|
Add first number to acc. Content.
| ||
8008
|
JNC
|
L1
|
Jump to location if result does not yield carry.
| ||
8009
| |||||
800A
| |||||
800B
|
INR
|
C
|
Increment C reg.
| ||
800C
|
L1
|
INX
|
H
|
Increment HL reg. to point next memory location.
| |
800D
|
MOV
|
M, A
|
Transfer the result from acc. to memory.
| ||
800E
|
INX
|
H
|
Increment HL reg. to point next memory location.
| ||
800F
|
MOV
|
M, C
|
Move carry to memory
| ||
8010
|
RST 5
|
Stop the program
|
OBSERVATION:
INPUT
|
OUTPUT
| ||
ADDRESS
|
DATA
|
ADDRESS
|
DATA
|
9000
|
9002
| ||
9001
|
9003
|
RESULT:
8 bit numbers stored at 9000 &9001 are added and the result stored at 9002 & 9003.
8 BIT DATA SUBTRACTION
AIM:
To subtract two 8 bit numbers stored at consecutive memory locations.
ALGORITHM:
1. Initialize memory pointer to data location.
2. Get the first number from memory in accumulator.
3. Get the second number and subtract from the accumulator.
4. If the result yields a borrow,
a. The content of the acc. is complemented and 01H is added to it (2’s complement).
b. A register is cleared and the content of that reg. is incremented to store borrow.
5. If there is no borrow the content of the acc. is directly taken as the result.
6. Store the answer (in the accumulator and register) at next memory location.
RESULT:
Thus the 8 bit numbers stored at 9000 &9001 are subtracted and the result stored at 9002 & 9003.
PROGRAM:
ADDRESS
|
OPCODE
|
LABEL
|
MNEMONICS
|
OPERAND
|
COMMENT
|
8100
|
START
|
MVI
|
C, 00
|
Clear C reg.
| |
8101
| |||||
8102
|
LXI
|
H, 9000
|
Initialize HL reg. to
9000
| ||
8103
| |||||
8104
| |||||
8105
|
MOV
|
A, M
|
Transfer first data to accumulator
| ||
8106
|
INX
|
H
|
Increment HL reg. to point next
mem. Location.
| ||
8107
|
SUB
|
M
|
Subtract first number from acc. Content.
| ||
8108
|
JNC
|
L1
|
Jump to location if result does not yield borrow.
| ||
8109
| |||||
810A
| |||||
810B
|
INR
|
C
|
Increment C reg.
| ||
810C
|
CMA
|
Complement the Acc. content
| |||
810D
|
ADI
|
01H
|
Add 01H to content of acc.
| ||
810E
| |||||
810F
|
L1
|
INX
|
H
|
Increment HL reg. to point next mem. Location.
| |
8110
|
MOV
|
M, A
|
Transfer the result from acc. to memory.
| ||
8111
|
INX
|
H
|
Increment HL reg. to point next mem. Location.
| ||
8112
|
MOV
|
M, C
|
Move carry to mem.
| ||
8113
|
RST 5
|
Stop the program
|
OBSERVATION:
INPUT
|
OUTPUT
| ||
ADDRESS
|
DATA
|
ADDRESS
|
DATA
|
9000
|
9002
| ||
9001
|
9003
|
8 BIT DATA MULTIPLICATION
AIM:
To multiply two 8 bit numbers stored at consecutive memory locations and store the result in memory.
ALGORITHM:
LOGIC: Multiplication can be done by repeated addition.
1. Initialize memory pointer to data location.
2. Move multiplicand to a register.
3. Move the multiplier to another register.
4. Clear the accumulator.
5. Add multiplicand to accumulator
6. Decrement multiplier
7. Repeat step 5 till multiplier comes to zero.
8. The result, which is in the accumulator, is stored in a memory location.
RESULT:
Thus the 8-bit multiplication was done in 8085mp using repeated addition method.
PROGRAM:
ADDRESS
OPCODE
LABEL
MNEMONICS
OPERAND
COMMENT
8100
START
LXI
H, 9000
Initialize HL reg. to 9000
8101
8102
Transfer first data to reg. B
8103
MOV
B, M
8104
INX
H
Increment HL reg. to point next memory location.
8105
MVI
A, 00H
Clear the acc.
8106
8107
MVI
C, 00H
Clear C register for carry
8108
8109
L1
ADD
M
Add multiplicand, multiplier times.
810A
JNC
NEXT
Jump to NEXT if there is no carry
810B
810C
810D
INR
C
Increment C register
810E
NEXT
DCR
B
Decrement B register
810F
JNZ
L1
Jump to L1 if B is not zero.
8110
8111
8112
INX
H
Increment HL reg. to point next memory location.
8113
MOV
M, A
Transfer the result from acc. to memory.
8114
INX
H
Increment HL reg. to point next memory location.
8115
MOV
M, C
Transfer the result from C reg. to memory.
8116
RST 5
Stop the program
OBSERVATION:
INPUT
OUTPUT
ADDRESS
DATA
ADDRESS
DATA
9000
9002
9001
9003
8 BIT DIVISION
AIM:
To divide two 8-bit numbers and store the result in memory.
ALGORITHM:
LOGIC: Division is done using the method repeated subtraction.
1. Load Divisor and Dividend
2. Subtract divisor from dividend
3. Count the number of times of subtraction which equals the quotient
4. Stop subtraction when the dividend is less than the divisor .The dividend now becomes the remainder. Otherwise go to step 2.
5. Stop the program execution.
RESULT:
An ALP was written for 8-bit division using repeated subtraction method and executed using 8085m p kits
PROGRAM:
ADDRESS
OPCODE
LABEL
MNEMONICS
OPERAND
COMMENTS
8100
MVI
B,00
Clear B register for quotient
8101
8102
LXI
H,9000
Initialize HL reg. to 9000H
8103
8104
8105
MOV
A,M
Transfer dividend to acc.
8106
INX
H
Increment HL reg. to point next memory location.
8107
LOOP
SUB
M
Subtract divisor from dividend
8108
INR
B
Increment B register
8109
JNC
LOOP
Jump to LOOP if result does not yield borrow
810A
810B
810C
ADD
M
Add divisor to acc.
810D
DCR
B
Decrement B register
810E
INX
H
Increment HL reg. to point next memory location.
810F
MOV
M,A
Transfer the remainder from acc. to memory.
8110
INX
H
Increment HL reg. to point next memory location.
8111
MOV
M,B
Transfer the quotient from B reg. to memory.
8112
RST 5
Stop the program
OBSERVATION:
INPUT
OUTPUT
ADDRESS
DATA
ADDRESS
DATA
9000
9002
9001
9003
AIM:
To multiply two 8 bit numbers stored at consecutive memory locations and store the result in memory.
ALGORITHM:
LOGIC: Multiplication can be done by repeated addition.
1. Initialize memory pointer to data location.
2. Move multiplicand to a register.
3. Move the multiplier to another register.
4. Clear the accumulator.
5. Add multiplicand to accumulator
6. Decrement multiplier
7. Repeat step 5 till multiplier comes to zero.
8. The result, which is in the accumulator, is stored in a memory location.
RESULT:
Thus the 8-bit multiplication was done in 8085mp using repeated addition method.
PROGRAM:
ADDRESS
|
OPCODE
|
LABEL
|
MNEMONICS
|
OPERAND
|
COMMENT
|
8100
|
START
|
LXI
|
H, 9000
|
Initialize HL reg. to 9000
| |
8101
| |||||
8102
|
Transfer first data to reg. B
| ||||
8103
|
MOV
|
B, M
| |||
8104
|
INX
|
H
|
Increment HL reg. to point next memory location.
| ||
8105
|
MVI
|
A, 00H
|
Clear the acc.
| ||
8106
| |||||
8107
|
MVI
|
C, 00H
|
Clear C register for carry
| ||
8108
| |||||
8109
|
L1
|
ADD
|
M
|
Add multiplicand, multiplier times.
| |
810A
|
JNC
|
NEXT
|
Jump to NEXT if there is no carry
| ||
810B
| |||||
810C
| |||||
810D
|
INR
|
C
|
Increment C register
| ||
810E
|
NEXT
|
DCR
|
B
|
Decrement B register
| |
810F
|
JNZ
|
L1
|
Jump to L1 if B is not zero.
| ||
8110
| |||||
8111
| |||||
8112
|
INX
|
H
|
Increment HL reg. to point next memory location.
| ||
8113
|
MOV
|
M, A
|
Transfer the result from acc. to memory.
| ||
8114
|
INX
|
H
|
Increment HL reg. to point next memory location.
| ||
8115
|
MOV
|
M, C
|
Transfer the result from C reg. to memory.
| ||
8116
|
RST 5
|
Stop the program
|
OBSERVATION:
INPUT
|
OUTPUT
| ||
ADDRESS
|
DATA
|
ADDRESS
|
DATA
|
9000
|
9002
| ||
9001
|
9003
|
8 BIT DIVISION
AIM:
To divide two 8-bit numbers and store the result in memory.
ALGORITHM:
LOGIC: Division is done using the method repeated subtraction.
1. Load Divisor and Dividend
2. Subtract divisor from dividend
3. Count the number of times of subtraction which equals the quotient
4. Stop subtraction when the dividend is less than the divisor .The dividend now becomes the remainder. Otherwise go to step 2.
5. Stop the program execution.
RESULT:
An ALP was written for 8-bit division using repeated subtraction method and executed using 8085m p kits
PROGRAM:
ADDRESS
|
OPCODE
|
LABEL
|
MNEMONICS
|
OPERAND
|
COMMENTS
|
8100
|
MVI
|
B,00
|
Clear B register for quotient
| ||
8101
| |||||
8102
|
LXI
|
H,9000
|
Initialize HL reg. to 9000H
| ||
8103
| |||||
8104
| |||||
8105
|
MOV
|
A,M
|
Transfer dividend to acc.
| ||
8106
|
INX
|
H
|
Increment HL reg. to point next memory location.
| ||
8107
|
LOOP
|
SUB
|
M
|
Subtract divisor from dividend
| |
8108
|
INR
|
B
|
Increment B register
| ||
8109
|
JNC
|
LOOP
|
Jump to LOOP if result does not yield borrow
| ||
810A
| |||||
810B
| |||||
810C
|
ADD
|
M
|
Add divisor to acc.
| ||
810D
|
DCR
|
B
|
Decrement B register
| ||
810E
|
INX
|
H
|
Increment HL reg. to point next memory location.
| ||
810F
|
MOV
|
M,A
|
Transfer the remainder from acc. to memory.
| ||
8110
|
INX
|
H
|
Increment HL reg. to point next memory location.
| ||
8111
|
MOV
|
M,B
|
Transfer the quotient from B reg. to memory.
| ||
8112
|
RST 5
|
Stop the program
|
OBSERVATION:
INPUT
|
OUTPUT
| ||
ADDRESS
|
DATA
|
ADDRESS
|
DATA
|
9000
|
9002
| ||
9001
|
9003
| ||
No comments:
Post a Comment