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
- 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
|400||MOV AL, ||AL<-|
|404||MOV CX, 0004||CX <- 0004|
|407||ROL AL, CX||Rotate AL content left by 4 bits(value of CX)|
|409||MOV , AL||<-AL|
- MOV AL,  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 , AL stores the content of AL in 2050 memory address
- HLT stops executing 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.