0% found this document useful (0 votes)
30 views4 pages

Practical 4

coa practical with commands

Uploaded by

yolirox135
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views4 pages

Practical 4

coa practical with commands

Uploaded by

yolirox135
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical 4

AIM: Write the assembly language code in GNUsim8085


to implement arithmetic instruction.
 To perform addition of two 8-bit numbers using 8085.
Algorithm:
1. Start the program by loading the first data into Accumulator.
2. Move the data to a register.
3. Get the second data and load into Accumulator.
4. Add the two register contents.
5. Check for carry.
6. Store the value of sum and carry in memory location.
7. Terminate the program.

PROGRAM:
Mnemonics Comments
LDA 2050H Moves the content of 2050 memory Location to the Accumulator.
MOV H,A Copies Contents of Accumulator to Register H to A
LDA 2051H Moves the Contents of 2051 Memory Location to The Accumulator.
ADD H Adds Contents of A(Accumulator) and H Register
MOV L,A Copies Contents of A To L
MVI A,00H Moves Immediate Data (i.e.. 00) to A
ADC A A adds contents of A (00), contents of register specified (i.e A) and carry.
MOV H,A Copies contents of A (01) to H
SHLD 2052H Moves the contents of L Register in Memory Location And Contents of H
register in Memory Location
HLT Terminate the Program.

OBSERVATION:
Input: 05 (2050h)
05 (2051h)
Output: 10 (2052h)
RESULT: Thus, the program to add two 8-bit numbers was executed
 To perform the subtraction of two 8-bit numbers using 8085.
ALGORITHM:
1. Start the program by loading the first data into Accumulator.
2. Move the data to a register.
3. Get the second data and load into Accumulator.
4. Subtract the two register contents.
5. Check for carry.
6. If carry is present take 2's complement of Accumulator.
7. Store the value of borrow in memory location.
8. Store the difference value (present in Accumulator) to a memory
9. location and terminate the program.
PROGRAM:
Mnemonics Comments
MVI C, 00 Initialize C to 00
LDA 4150H Load the value to Acc.
MOV B, A Move the content of Acc to B register.
LDA 4151H Load the value to Acc.
SUB B
JNC LOOP Jump on no carry
CMA Complement Accumulator contents.
INR A Increment value in Accumulator.
INR C Increment value in register C
LOOP: STA 4152H Store the value of A-reg to memory address.
MOV A, C Move contents of register C to Accumulator.
STA 4153 Store the value of Accumulator memory address.
HLT Terminate the program.

OBSERVATION:
Input: 30(4150)
50 (4251)

Output: 20 (4152)
RESULT: Thus, the program to subtract two 8-bit numbers was executed.
 To perform the multiplication of two 8-bit numbers using 8085.
ALGORITHM:
1. Start the program loading HL register pair With address of
memory location.
2. Move the data to a register (B register).
3. Get the second data and load into Accumulator.
4. Add the two register contents.
5. Check for carry.
6. Increment the value of carry.
7. Check whether repeated addition is over and store the value of
product and carry in memory location.
8. Terminate the program.
LabelMnemonics Comments
MVI D, 00 Initialize register D to 00
MVI A, 00 Initialize Accumulator content to 00
LXI H, 4150
MOV B, M Get the first number in B - reg
INX H
MOV C, M Get the second number in C- reg.
LOOP: ADD B Add content of A - reg to regtster B.
JNC NEXT Jump on no carry to NEXT.
INR D Increment content ofregtster D
NEXT: DCR C Decrement content of register C.
JNZ LOOP Jump on no zero to a
STA 4152 Store the result in Memory
MOV A, D
STA 4153 Store the MSB of result in Memory
HLT Terminate the program.
OBSERVATION:
Input: FF(4150)
FF(4151)

Output: 01 (4152)
FE(4153)

RESULT: Thus, the program to multiply two 8-bit numbers was executed.
 To perform the Division of two 8-bit numbers using 8085.
ALGORITHM:
1. Start the program by loading HL register pair With address of
memory location.
2. Move the data to a register (B register).
3. Get the second data and load into Accumulator.
4. Compare the two numbers to check for carry.
5. Subtract the two numbers.
6. Increment the value of carry
7. Check whether repeated subtraction IS over and store the value
of product and carry to memory location.
8. Terminate the program.
Label Mnemonics Comments
LXI H, 4150
MOV B, M Get the dividend in B reg.
MVI C, 00 Clear C — reg for quotient
INX H
MOV A, M Get the divisor in A — reg.
NEXT: CMP B Compare A - reg With regtster B.
JC LOOP Jump on carry to LOOP
SUB B Subtract A — reg from B- reg.
INR C Increment content of register C.
JMP NEXT Jump to NEXT
LOOP: STA 4152 Store the remainder In Memory
MOV A, C
STA 4153
HLT Terminate the program.
OBSERVATION:
Input: FF (4150)
FF(4251)
Output: 01 (4152) Remainder
FE (4153) Quotient89
RESULT: Thus, the program to divide two 8-bit numbers was
Executed.

You might also like