0% found this document useful (0 votes)
39 views12 pages

Experiment 7: Aim: To Find The 1's Complement of An 8-Bit Number. Flowchart

1. The program subtracts two 8-bit numbers stored in memory locations 4500H and 4501H without considering borrow. 2. It loads the first operand from 4500H into the accumulator, then loads the second operand from 4501H into register B. 3. It subtracts the value in B from the accumulator and stores the result in memory location 4502H.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views12 pages

Experiment 7: Aim: To Find The 1's Complement of An 8-Bit Number. Flowchart

1. The program subtracts two 8-bit numbers stored in memory locations 4500H and 4501H without considering borrow. 2. It loads the first operand from 4500H into the accumulator, then loads the second operand from 4501H into register B. 3. It subtracts the value in B from the accumulator and stores the result in memory location 4502H.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Experiment 7

Aim: To find the 1’s complement of an 8-bit number.


Flowchart:

Start

Load accumulator with operand from memory

Complement accumulator

Store the result from accumulator to memory

Stop

Program:
Address Mnemonics Operand Opcode Remarks
0000 LDA 2500 3A Load H-L pair with data
from 2500H
0001 00 Lower order of 2500H
0002 25 Higher order of 2500H
0003 CMA 2F Complement
Accumulator
0004 STA 2501 32 Store the result at memory
location on 2501H
0005 01 Lower order of 2501H
0006 25 Higher order of 2501H
0007 HLT 76 Halt

Explanation:
1. This program finds the 1’s complement of 8-bit number
stored in memory location 2500H.
2. Let us assume that the operand stored at memory location
is 50H.
3. The operand is moved to accumulator from memory
location 2500H.
4. Then its complement is found by using CMA instruction.
5. The result is stored at memory location 2501H.

Output:
- Before execution
2500H: 50H
- After execution
2501H: AFH
Experiment 8
Aim: Program to find 2’s complement of an 8-bit
number.
Flowchart:
Start

Load accumulator with operand from memory

Complement accumulator

Store the result from accumulator to memory

Stop

Program:
Address Mnemonics Operand Opcode Remarks
0000 LDA 2500 3A Load H-L pair with data
from 2500H
0001 00
0002 25
0003 CMA 2F Complement Accumulator
0004 INR A 3C Increment Accumulator
0005 STA 2501 32 Share the result with
memory location 2501H
0006 01
0007 25
0008 HLT 76 Halt

Explanation:
1. This program finds the 2’s complement of 8-bit number
stored in memory location 2500H.
2. Let us assume that the operand stored at memory location
is 50H.
3. The operand is moved to accumulator from memory
location 2500H.
4. Then its complement is found by using CMA instruction.
5. One is added to accumulator by incrementing it is to find
its 2’s complement.
6. The result is stored at memory location 2501H.
Experiment 9

Aim: Program to add two 8-bit numbers without


considering array.
Flowchart:

start

Load H-L pair with Add. Of first operand of memory location

Move the first operand from memory to accumulator

Increment H-L pair to point to next memory location

Move the second operand from memory to register B

Add B with A

Increment H-L pair

Move the result from accumulator to memory

stop
Program:
Address Mnemonics operand opcode Remark
0000 LXI H , 4500H 21 Load H-L pair with
address 4500H
0001 00
0002 45
0003 MOV A,M 7E Move the first operand
from memory to
register A

0004 INX H 23 Increment H-L pair


and move the 2nd
operand
0004 MOV B,M 46 Move the second
operand from memory
to register B

0006 ADD B 80 Add B with register A


0007 MOV M,A 77 Move the result from
register A to memory

0008 HLT 76 Halt

Explanation:
1. The program adds two operands stored in memory
Location 4500H without considering the carry.
2. Let us assume that the operand stored at memory location
45004 is 08H and 4501H & 09H.
3. Initially H-L pair is loaded with the address of first memory
location.
4. The first operand is moved to accumulator from memory
location 4500H and H-L pair is incremented to next
memory location.
5. The second operand is moved from memory location
4501H to register B.
6. The two operand are added and the result are stored in
accumulator.
7. H-L pair is moved from the accumulator to memory
location 4502H.

Output:
- Before execution:
4500H:08H
4501H:01H
- After execution:
4502H:09H
Experiment 10
Aim: Program to multiply two 8-bit numbers.
Flowchart:
start

Load H-L pair with Address Of first operand of memory location

Move the first operand from memory to register B

Increment H-L pair to point to next memory location

Move the second operand from memory to register C

Initialize register A with D

Add B with C

Decrement C

If
C=0

YES
Increment H-L pair
Move the result from accumulator to memory

stop
Experiment 11
Aim: Program to subtract two 8-bits number without
considering borrow.
Flowchart:
Start

Load HL pair with add of first operand memory location.

Move the first operand from memory to accumulator.

Increment HL pair to point to next memory location.

Move the second operand from memory to register B

Subtract B from A

Increment HL pair

Move result from accumulator to memory.

Stop
Program:
Address Mnemonics Operand Opcode Remarks
0000 LXI H, 21 Load HL pair with address
4500H 4500H
0001 00
0002 45
0003 MOV A,M 7E Move the operand from
memory to register A
0004 INX +1 23 Increment HL pair
0005 MOV B,M 46 Move the 2nd operand from
memory to register B
0006 SUB B 90 Subtract B from A
0007 MOV M,A 77 Move result from register A
to memory
0008 HLT 76 Halt

Explanation:
1. This program subtracts two operands stored in memory
location 4500H without considering the borrow.
2. Let us assume that the operand stored at memory location
is 4500H, operand 1 is 08H and operand 2 is 01H.
3. Initially HL pair is loaded with address of just memory
location.
4. The first operand is moved to accumulator from memory
location 4500H and HL pair is incremented to point to
next memory location.
5. The second operand is moved to register B from memory
location 4500H.
6. The two operands are subtracted and stored in accumulator
7. HL pair is again incremented and the result is moved to
accumulator to memory location 4502H.
Output:
- Before execution
4500H: 08H
4501H: 01H
- After execution
4502H: 07H

You might also like