8086 program to reverse 8 bit number using 8 bit operation
Problem – Write an assembly language program in 8086 microprocessor to reverse 8 bit number using 8 bit operation.
Example – Assume 8 bit number is stored at memory location 2050

Algorithm –
- Load contents of memory location 2050 in register AL
- Assign 0004 to CX Register Pair
- Rotate the contents of AL by executing ROL instruction using CX
- Store the content of AL in memory location 2050
Program –
| Memory Address | Mnemonics | Comments |
|---|---|---|
| 400 | MOV AL, [2050] | AL<-[2050] |
| 404 | MOV CX, 0004 | CX <- 0004 |
| 407 | ROL AL, CX | Rotate AL content left by 4 bits(value of CX) |
| 409 | MOV [2050], AL | [2050]<-AL |
| 40D | HLT | Stop Execution |
Explanation –
- MOV AL, [2050] loads contents of memory location 2050 in AL
- MOV CX, 0004 assign 0004 to CX register pair
- ROL AL, CX rotate the content of AL register left by 4 bits i.e. value of CX register pair
- MOV [2050], AL stores the content of AL in 2050 memory address
- HLT stops executing the program
Recommended Posts:
- 8086 program to reverse 16 bit number using 8 bit operation
- 8086 program to reverse a string
- 8086 program to convert an 8 bit BCD number into hexadecimal number
- 8086 program to search a number in a string
- 8086 program to convert 8 bit ASCII to BCD number
- 8086 program to find the factorial of a number
- 8086 program to find sum of digits of 8 bit number
- 8086 program to Print a 16 bit Decimal number
- 8086 program to find Square Root of a number
- 8086 program to convert a 16 bit decimal number to Hexadecimal
- 8086 program to convert 8 bit BCD number into ASCII Code
- 8086 program to convert a 16 bit decimal number to binary
- 8086 program to convert a 16 bit Decimal number to Octal
- 8086 program to divide a 16 bit number by an 8 bit number
- 8086 program to determine largest number in an array of n numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.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.



