Tag Archives: 8085

8-BIT ADDITION OF TWO NUMBERS

To write an 8085 assembly language program to add two 8 bit numbers and to store the result in the memory location 8100H & 8101H.
ALGORITHM:
STEP 1: Load the 8 bit data in the accumulator.
STEP 2: Add the other 8 bit data present in the accumulator.
STEP 3: Store the result from the accumulator in the memory location
8100H.
STEP 4: If carry occurs then store 01H in the memory location through
Accumulator.
STEP 5: If there is no carry then store 00H in the memory location
through accumulator.
STEP 6: Stop the execution.
________________________________________________________________________________________________
MEMORY ADDRESS HEXA- CODE LABEL MNEMONICS COMMENTS
8000 3E MVIA, DATA 1 Load the accumulator with 8-bit data
8001 Data 1
8002 C6 ADI, DATA 2 Add other 8-bit data with accumulator contents
8003 Data 2
8004 32 STA 8100H Store the contents of A in memory location 8100H
8005 00
8006 81
8007 D2 JNC 800FH(L1) Move to location 8101H. If there is necessary.
8008 OF
8009 80
800A 3E MVFA, 01H A is loaded with 01H. If no carry occurs.
800B 01
800C C3 JMP 8011H(L2) After loading A move to memory location 8010H.
800D 11
800E 80
800F 3E L1 MVIA, 00H If carry occurs load 00H in the accumulator.
8010 00
8011 32 L2 STA 8101H Store the contents of A in memory location 8101H
8012 01
8013 81
8014 76 HLT Stop the execution.
__________________________________________________________________________________________________
8085(10)

MULTIPLICATION OF 8-BIT DATA

To write an 8085 assembly language program to multiply the two 8 bit numbers and to store the result in the memory location 8100H & 8101H.

ALGORITHM:

STEP 1: Load the data 00H to the register.
STEP 2: Load the B register with the 8-bit data1.
STEP 3: Load the C register with the 8-bit data2.
STEP 4: Move the load 00H to the accumulator.
STEP 5: Add the contents of C register with the accumulator.
STEP 6: If carry is equal to zero go to step 8.
STEP 7: Increment the contents of the D register.
STEP 8: Decrement the contents of the B register.
STEP 9: If count is not equal to zero then go to step 5.
STEP 10: Store the result in the memory location 8100H.
STEP 11: Move the contents of D register to the accumulator.
STEP 12: Store the accumulator contents in memory location 8108H.
STEP 13: Stop the execution.
_______________________________________________________________________________________________
8085(5)

DIVISION OF 8-BIT DATA

To write an 8085 assembly language program to divide the two 8 bit numbers and to store the result in the memory location 8200H & 8201H.
ALGORITHM:
STEP 1: Load the B register with the data 1.
STEP 2: Load the C register with the data 2.
STEP 3: Move the data 00H to the register.
STEP 4: Move the contents of the B register to the accumulator.
STEP 5: Subtract the contents of B register with the accumulator.
STEP 6: If carry occurs then go to step 9.
STEP 7: Increment the contents of the D register.
STEP 8: Go to step 5 after incrementing the D register.
STEP 9: Add the contents of the C register with the accumulator.
STEP 10: Store the result in the memory location 8200H.
STEP 11: Move the contents of D register to the accumulator.
STEP 12: Store the quotient in memory location 8201H.
STEP 13: Stop the execution.
____________________________________________________________________________________________________
8085(4)

Ascending Order

To write an 8085 assembly language program to arrange the given array 5 data bytes stored in the memory location starting from 8100 in ascending order.
ALGORITHM:
STEP 1: Load the D register with the data 05.
STEP 2: Decrement the content of D register.
STEP 3: Load the C register with the data 05.
STEP 4: Decrement the content of C register.
STEP 5: Load the HL register pair with the address 8100.
STEP 6: Move the data in the location 8100, which is addressed by HL
register pair.
STEP 7: Increment the address of HL register pair.
STEP 8: Move the data from M to B register.
STEP 9: Compare the data in B register with the accumulator.
STEP 10: If there is carry, move the data from M to B register.
STEP 11: Decrement the address of HL register-pair.
STEP 12: Move the data from M to B register.
STEP 13: Increment the address of HL register pair.
STEP 14: Decrement the content of C register.
STEP 15: If count is not equal to zero go to step 6.
STEP 16: Decrement the contents of contents of D register.
STEP 17: Stop the execution.

PROGRAM:

MEMORY ADDRESS HEXA- CODE LABEL MNEMONICS COMMENTS
8000 16 MVI D, 05H Move the data 05H to D register.
8001 05
8002 15 DCR D Decrement the contents of D register.
8003 0E L3 MVI C, 05H Move the contents 05H to C register.
8004 05
8005 0D DCR C Decrement the contents of the C register.
8006 21 LXI H, 8100H Load the HL register-pair with the address 8100H.
8007 00
8008 81
8009 7E L2 MOV A,M Move the data from M to A.
800A 23 INX H Increment the address of HL register-pair.
800B 46 MOV B,M Move the data from M to A.
800C B8 CMP B Compare the contents of B with the accumulator.
800D DA JC 8014(L1) If there is carry.
800E 14 L2
800F 80
8010 77 MOV M,A Move the data from A to M.
8011 2B DCX H Decrement the address of HL register-pair.
8012 70 MOV M,B Move the data from B to M.
8013 23 INX H Increment the address of HL register-pair.
8014 0D L1 DCR C Decrement the content of C register.
8015 C2 JNZ 8009H(L2) IF the carry is not zero then jump to location 8009H.
8016 09
8017 80
8018 15 DCR D Decrement the contents of D register.
8019 C2 JNZ 8009H(L2) If the carry is not zero then jump to location 8003H.
801A 03
801B 80
801C 76 HLT Stop the execution.
____________________________________________________________________________________________________

8085(3)

16-BIT ADDITION OF TWO NUMBERS

To write an 8085 assembly language program to perform 16 bit addition
ALGORITHM:
STEP 1: Load the HL register pair with the address of 8100.
STEP 2: Move the content of DE register pair.
STEP 3: Get the input value.
STEP 4: Add both the inputs and store the result in 8200.
STEP 5: Store the carry in 8202.
STEP 6: Stop the execution.

PROGRAM:

MEMORY ADDRESS HEXA- CODE MNEMONICS COMMENTS
8000 2A LHLD 8200 Get the first 16 bit data.
8001 00
8002 82
8003 EB XCHG DE Exchange the HL pair with DL pair.
8004 2A LHLD 8202 Get the second 16 bit data.
8005 02
8006 82
8007 7D MOV A,L Move the DL content to accumulator.
8008 83 ADD E Add E with accumulator.
8009 6F MOV L,A Move the accumulator to L register.
800A 7C MOV A,H Move the register content to accumulator.
800B 8A ADC D Add D content with accumulator and carry.
800C 67 MOV H,A Move the accumulator to H register.
800D 22 SHLD 8204 Store the content HL into 8204.
800E 04
800F 82
8010 76 HLT Stop the execution.

_________________________________________________________________________________________________
8085(1)