Problem – Write an assembly language program in 8085 to print the table of input integer.
Assumption – Suppose the inputted number is at memory location 2050 and the table will be printed from starting location 3050.
- Load the value of input in accumulator from memory location 2050 and then copy it to another register say D.Also store 0A in register B.
- Store memory location 3050 in M using LXI instruction and take another register say C with its value 00.
- Now copy the content of D register to A and add the contents of A and C and store it in A then copy it to M.
- Increment value of M by 1.
- Copy content of A to C and decrements the content of B by 1 and if its value is 0 then halt otherwise again go to step number 3.
|2003||MOV D, A||D<-[A]|
|2004||MVI B 0A||B<-0A|
|2006||LXI H 3050||H<-30 & L<-50|
|2009||MVI C 00||C<-00|
|200B||MOV A, D||A<-[D]|
|200D||MOV M, A||M<-[A]|
|200F||MOV C, A||C<-[A]|
|2011||JNZ 200B||Jump to address 200B if ZF=0|
|2014||HLT||Terminates the program|
- LDA 2050: load the contents from 2050 memory location to accumulator(register A).
- MOV D, A: move the contents of accumulator to register D.
- MVI B 0A: store 0A data into register B.
- LXI H 3050: store 30 in H register and 50 in L register, hence M will contain 3050 inside it.
- MVI C 00: store 00 data in register C.
- MOV A, D: move the contents of D register into A.
- ADD C: add the contents of A and C register and store in A.
- MOV M, A: move the contents of A register into M.
- INX H: increments content of M by 1.
- MOV C, A: move the contents of A register into C.
- DCR B: decrements the content of B register by 1.
- JNZ 200B: jump to address 200B if Carry flag is not zero.
- HLT: terminate the program.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- 8086 program to print the table of input integer
- 8085 program for Linear search | Set 2
- 8085 program to convert a BCD number to binary
- 8085 program to find the element that appears once
- 8085 program to find maximum and minimum of 10 numbers
- 8085 program to search a number in an array of n numbers
- 8085 program to find maximum of two 8 bit numbers
- 8085 program to add two 8 bit numbers
- 8085 program to multiply two 8 bit numbers
- 8085 program to convert an 8 bit number into Grey number
- 8085 program to find the factorial of a number
- 8085 program to count the number of ones in contents of register B
- 8085 program to add two 16 bit numbers
- 8085 program to exchange a block of bytes in memory
- 8085 program to find square root of a number
- 8085 program to find 1's and 2's complement of 8-bit number
- 8085 program to convert 8 bit BCD number into ASCII Code
- 8085 program to find 1’s and 2’s complement of 16-bit number
- 8085 program to swap two 8-bit numbers
- 8085 program to add three 16 bit numbers stored in registers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.