Problem – Write an assembly language program in 8086 to print the table of input integer.
Assuption – Suppose the inputted number is at memory location 500 and the table will be printed from starting location 600 till 609 in hexadecimal.
- Load input number address in SI and also load the address where we want output in DI .
- Store 00 in CH register.
- Increment value of CH by 1 and move the content of [SI] into AH register.
- Multiply content of AL and CH and store it in AX and then move content of AL into [DI], then increment value of DI by 1.
- Compare the value of CH and 0A, if not equal then go to step number 3 otherwise halt the program.
|400||MOV SI, 500||SI<-500|
|403||MOV DI, 600||DI<-600|
|406||MOV CH, 00||CH<-00|
|409||MOV AL, [SI]||AL<-[SI]|
|40D||MOV [DI], AL||[DI]<-AL|
|410||CMP CH, 0A||CH-0A|
|413||JNZ 408||jump to address 408 if zero flag is 0|
|415||HLT||Terminates the program|
- MOV SI, 500: load 500 in SI.
- MOV DI, 600: load 600 in DI.
- MOV CH, 00: load 00 data in CH register.
- INC CH: increment the value inside CH register by 1.
- MOV AL, SI: move the content of SI into AL register.
- MUL CH: multiply the contents of AL and CH register and store in AX register.
- MOV [DI], AL: move the contents of AL register into [DI].
- INC DI: increment the value of DI by 1.
- CMP CH, 0A: subtract data inside CH register and 0A.
- JNZ 408: jump to address 408 if zero flag is 0.
- 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.
- 8085 program to print the table of input integer
- 8086 program to sort an integer array in ascending order
- 8086 program to sort an integer array in descending order
- 8086 program to Print a 16 bit Decimal number
- 8086 program to print a String
- 8086 program to find GCD of two numbers and print the GCD
- 8086 program to divide a 16 bit number by an 8 bit number
- 8086 program to subtract two 16-bit numbers with or without borrow
- 8086 program to add two 16-bit numbers with or without carry
- 8086 program to multiply two 16-bit numbers
- 8086 program to determine largest number in an array of n numbers
- 8086 program to convert an 8 bit BCD number into hexadecimal number
- 8086 program to find the factorial of a number
- 8086 program to add two 8 bit BCD numbers
- 8086 program to find Square Root of a number
- 8086 program to find the min value in a given array
- 8086 program to convert binary to Grey code
- 8086 program to convert 8 bit ASCII to BCD number
- 8086 program to find sum of odd numbers in a given series
- 8086 program to transfer a block of bytes by using string instruction
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.